aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llscrolllistctrl.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llui/llscrolllistctrl.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-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/llscrolllistctrl.cpp')
-rw-r--r--linden/indra/llui/llscrolllistctrl.cpp166
1 files changed, 86 insertions, 80 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp
index 307d045..6561bb5 100644
--- a/linden/indra/llui/llscrolllistctrl.cpp
+++ b/linden/indra/llui/llscrolllistctrl.cpp
@@ -42,9 +42,7 @@
42#include "llcheckboxctrl.h" 42#include "llcheckboxctrl.h"
43#include "llclipboard.h" 43#include "llclipboard.h"
44#include "llfocusmgr.h" 44#include "llfocusmgr.h"
45#include "llgl.h"
46#include "llrender.h" 45#include "llrender.h"
47#include "llglheaders.h"
48#include "llresmgr.h" 46#include "llresmgr.h"
49#include "llscrollbar.h" 47#include "llscrollbar.h"
50#include "llstring.h" 48#include "llstring.h"
@@ -85,7 +83,7 @@ struct SortScrollListItem
85 S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column? 83 S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column?
86 if (cell1 && cell2) 84 if (cell1 && cell2)
87 { 85 {
88 sort_result = order * LLString::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); 86 sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString());
89 if (sort_result != 0) 87 if (sort_result != 0)
90 { 88 {
91 break; // we have a sort order! 89 break; // we have a sort order!
@@ -133,7 +131,7 @@ void LLScrollListIcon::setValue(const LLSD& value)
133 } 131 }
134 else 132 else
135 { 133 {
136 LLString value_string = value.asString(); 134 std::string value_string = value.asString();
137 if (LLUUID::validate(value_string)) 135 if (LLUUID::validate(value_string))
138 { 136 {
139 setValue(LLUUID(value_string)); 137 setValue(LLUUID(value_string));
@@ -239,7 +237,7 @@ void LLScrollListSeparator::draw(const LLColor4& color, const LLColor4& highligh
239// 237//
240U32 LLScrollListText::sCount = 0; 238U32 LLScrollListText::sCount = 0;
241 239
242LLScrollListText::LLScrollListText( const LLString& text, const LLFontGL* font, S32 width, U8 font_style, LLFontGL::HAlign font_alignment, LLColor4& color, BOOL use_color, BOOL visible) 240LLScrollListText::LLScrollListText( const std::string& text, const LLFontGL* font, S32 width, U8 font_style, LLFontGL::HAlign font_alignment, LLColor4& color, BOOL use_color, BOOL visible)
243: LLScrollListCell(width), 241: LLScrollListCell(width),
244 mText( text ), 242 mText( text ),
245 mFont( font ), 243 mFont( font ),
@@ -418,9 +416,9 @@ void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell )
418 } 416 }
419} 417}
420 418
421LLString LLScrollListItem::getContentsCSV() const 419std::string LLScrollListItem::getContentsCSV() const
422{ 420{
423 LLString ret; 421 std::string ret;
424 422
425 S32 count = getNumColumns(); 423 S32 count = getNumColumns();
426 for (S32 i=0; i<count; ++i) 424 for (S32 i=0; i<count; ++i)
@@ -476,7 +474,7 @@ void LLScrollListItem::setEnabled(BOOL b)
476//--------------------------------------------------------------------------- 474//---------------------------------------------------------------------------
477// LLScrollListItemComment 475// LLScrollListItemComment
478//--------------------------------------------------------------------------- 476//---------------------------------------------------------------------------
479LLScrollListItemComment::LLScrollListItemComment(const LLString& comment_string, const LLColor4& color) 477LLScrollListItemComment::LLScrollListItemComment(const std::string& comment_string, const LLColor4& color)
480: LLScrollListItem(FALSE), 478: LLScrollListItem(FALSE),
481 mColor(color) 479 mColor(color)
482{ 480{
@@ -541,7 +539,7 @@ void LLScrollListItemSeparator::draw(const LLRect& rect, const LLColor4& fg_colo
541// LLScrollListCtrl 539// LLScrollListCtrl
542//--------------------------------------------------------------------------- 540//---------------------------------------------------------------------------
543 541
544LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect, 542LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect,
545 void (*commit_callback)(LLUICtrl* ctrl, void* userdata), 543 void (*commit_callback)(LLUICtrl* ctrl, void* userdata),
546 void* callback_user_data, 544 void* callback_user_data,
547 BOOL allow_multiple_selection, 545 BOOL allow_multiple_selection,
@@ -605,12 +603,12 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
605 mItemListRect.mBottom, 603 mItemListRect.mBottom,
606 SCROLLBAR_SIZE, 604 SCROLLBAR_SIZE,
607 mItemListRect.getHeight()); 605 mItemListRect.getHeight());
608 mScrollbar = new LLScrollbar( "Scrollbar", scroll_rect, 606 mScrollbar = new LLScrollbar( std::string("Scrollbar"), scroll_rect,
609 LLScrollbar::VERTICAL, 607 LLScrollbar::VERTICAL,
610 getItemCount(), 608 getItemCount(),
611 mScrollLines, 609 mScrollLines,
612 mPageLines, 610 mPageLines,
613 &LLScrollListCtrl::onScrollChange, this ); 611 &LLScrollListCtrl::onScrollChange, this );
614 mScrollbar->setFollowsRight(); 612 mScrollbar->setFollowsRight();
615 mScrollbar->setFollowsTop(); 613 mScrollbar->setFollowsTop();
616 mScrollbar->setFollowsBottom(); 614 mScrollbar->setFollowsBottom();
@@ -623,7 +621,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
623 if (show_border) 621 if (show_border)
624 { 622 {
625 LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); 623 LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
626 mBorder = new LLViewBorder( "dlg border", border_rect, LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, 1 ); 624 mBorder = new LLViewBorder( std::string("dlg border"), border_rect, LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, 1 );
627 addChild(mBorder); 625 addChild(mBorder);
628 } 626 }
629 627
@@ -758,7 +756,7 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllData() const
758// returns first matching item 756// returns first matching item
759LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const 757LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const
760{ 758{
761 LLString string_val = sd.asString(); 759 std::string string_val = sd.asString();
762 760
763 item_list::const_iterator iter; 761 item_list::const_iterator iter;
764 for(iter = mItemList.begin(); iter != mItemList.end(); iter++) 762 for(iter = mItemList.begin(); iter != mItemList.end(); iter++)
@@ -1405,7 +1403,7 @@ void LLScrollListCtrl::deselectAllItems(BOOL no_commit_on_change)
1405/////////////////////////////////////////////////////////////////////////////////////////////////// 1403///////////////////////////////////////////////////////////////////////////////////////////////////
1406// Use this to add comment text such as "Searching", which ignores column settings of list 1404// Use this to add comment text such as "Searching", which ignores column settings of list
1407 1405
1408LLScrollListItem* LLScrollListCtrl::addCommentText(const LLString& comment_text, EAddPosition pos) 1406LLScrollListItem* LLScrollListCtrl::addCommentText(const std::string& comment_text, EAddPosition pos)
1409{ 1407{
1410 LLScrollListItem* item = NULL; 1408 LLScrollListItem* item = NULL;
1411 if (getItemCount() < mMaxItemCount) 1409 if (getItemCount() < mMaxItemCount)
@@ -1426,7 +1424,7 @@ LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos)
1426 1424
1427// Selects first enabled item of the given name. 1425// Selects first enabled item of the given name.
1428// Returns false if item not found. 1426// Returns false if item not found.
1429BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensitive) 1427BOOL LLScrollListCtrl::selectItemByLabel(const std::string& label, BOOL case_sensitive)
1430{ 1428{
1431 // ensure that no stale items are selected, even if we don't find a match 1429 // ensure that no stale items are selected, even if we don't find a match
1432 deselectAllItems(TRUE); 1430 deselectAllItems(TRUE);
@@ -1436,10 +1434,10 @@ BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensit
1436 return FALSE; 1434 return FALSE;
1437 } 1435 }
1438 1436
1439 LLString target_text = label; 1437 std::string target_text = label;
1440 if (!case_sensitive) 1438 if (!case_sensitive)
1441 { 1439 {
1442 LLString::toLower(target_text); 1440 LLStringUtil::toLower(target_text);
1443 } 1441 }
1444 1442
1445 BOOL found = FALSE; 1443 BOOL found = FALSE;
@@ -1450,10 +1448,10 @@ BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensit
1450 { 1448 {
1451 LLScrollListItem* item = *iter; 1449 LLScrollListItem* item = *iter;
1452 // Only select enabled items with matching names 1450 // Only select enabled items with matching names
1453 LLString item_text = item->getColumn(0)->getValue().asString(); 1451 std::string item_text = item->getColumn(0)->getValue().asString();
1454 if (!case_sensitive) 1452 if (!case_sensitive)
1455 { 1453 {
1456 LLString::toLower(item_text); 1454 LLStringUtil::toLower(item_text);
1457 } 1455 }
1458 BOOL select = !found && item->getEnabled() && item_text == target_text; 1456 BOOL select = !found && item->getEnabled() && item_text == target_text;
1459 if (select) 1457 if (select)
@@ -1473,7 +1471,7 @@ BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensit
1473} 1471}
1474 1472
1475 1473
1476BOOL LLScrollListCtrl::selectItemByPrefix(const LLString& target, BOOL case_sensitive) 1474BOOL LLScrollListCtrl::selectItemByPrefix(const std::string& target, BOOL case_sensitive)
1477{ 1475{
1478 return selectItemByPrefix(utf8str_to_wstring(target), case_sensitive); 1476 return selectItemByPrefix(utf8str_to_wstring(target), case_sensitive);
1479} 1477}
@@ -1510,7 +1508,7 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen
1510 if (!case_sensitive) 1508 if (!case_sensitive)
1511 { 1509 {
1512 // do comparisons in lower case 1510 // do comparisons in lower case
1513 LLWString::toLower(target_trimmed); 1511 LLWStringUtil::toLower(target_trimmed);
1514 } 1512 }
1515 1513
1516 for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) 1514 for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++)
@@ -1526,11 +1524,11 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen
1526 LLWString item_label = utf8str_to_wstring(cellp->getValue().asString()); 1524 LLWString item_label = utf8str_to_wstring(cellp->getValue().asString());
1527 if (!case_sensitive) 1525 if (!case_sensitive)
1528 { 1526 {
1529 LLWString::toLower(item_label); 1527 LLWStringUtil::toLower(item_label);
1530 } 1528 }
1531 // remove extraneous whitespace from searchable label 1529 // remove extraneous whitespace from searchable label
1532 LLWString trimmed_label = item_label; 1530 LLWString trimmed_label = item_label;
1533 LLWString::trim(trimmed_label); 1531 LLWStringUtil::trim(trimmed_label);
1534 1532
1535 BOOL select = item->getEnabled() && trimmed_label.compare(0, target_trimmed.size(), target_trimmed) == 0; 1533 BOOL select = item->getEnabled() && trimmed_label.compare(0, target_trimmed.size(), target_trimmed) == 0;
1536 1534
@@ -1554,7 +1552,7 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen
1554 return found; 1552 return found;
1555} 1553}
1556 1554
1557const LLString LLScrollListCtrl::getSelectedItemLabel(S32 column) const 1555const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const
1558{ 1556{
1559 LLScrollListItem* item; 1557 LLScrollListItem* item;
1560 1558
@@ -1564,14 +1562,14 @@ const LLString LLScrollListCtrl::getSelectedItemLabel(S32 column) const
1564 return item->getColumn(column)->getValue().asString(); 1562 return item->getColumn(column)->getValue().asString();
1565 } 1563 }
1566 1564
1567 return LLString::null; 1565 return LLStringUtil::null;
1568} 1566}
1569 1567
1570/////////////////////////////////////////////////////////////////////////////////////////////////// 1568///////////////////////////////////////////////////////////////////////////////////////////////////
1571// "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which 1569// "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which
1572// has an associated, unique UUID, and only one of which can be selected at a time. 1570// has an associated, unique UUID, and only one of which can be selected at a time.
1573 1571
1574LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const LLString& item_text, const LLUUID& id, EAddPosition pos, BOOL enabled, S32 column_width) 1572LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos, BOOL enabled, S32 column_width)
1575{ 1573{
1576 LLScrollListItem* item = NULL; 1574 LLScrollListItem* item = NULL;
1577 if (getItemCount() < mMaxItemCount) 1575 if (getItemCount() < mMaxItemCount)
@@ -1799,7 +1797,7 @@ BOOL LLScrollListCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks)
1799 return handled; 1797 return handled;
1800} 1798}
1801 1799
1802BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) 1800BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen)
1803{ 1801{
1804 S32 column_index = getColumnIndexFromOffset(x); 1802 S32 column_index = getColumnIndexFromOffset(x);
1805 LLScrollListColumn* columnp = getColumn(column_index); 1803 LLScrollListColumn* columnp = getColumn(column_index);
@@ -2539,7 +2537,7 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void
2539} 2537}
2540 2538
2541 2539
2542void LLScrollListCtrl::sortByColumn(LLString name, BOOL ascending) 2540void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending)
2543{ 2541{
2544 if (name.empty()) 2542 if (name.empty())
2545 { 2543 {
@@ -2547,15 +2545,15 @@ void LLScrollListCtrl::sortByColumn(LLString name, BOOL ascending)
2547 return; 2545 return;
2548 } 2546 }
2549 2547
2550 std::map<LLString, LLScrollListColumn>::iterator itor = mColumns.find(name); 2548 std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name);
2551 if (itor != mColumns.end()) 2549 if (itor != mColumns.end())
2552 { 2550 {
2553 sortByColumn((*itor).second.mIndex, ascending); 2551 sortByColumnIndex((*itor).second.mIndex, ascending);
2554 } 2552 }
2555} 2553}
2556 2554
2557// First column is column 0 2555// First column is column 0
2558void LLScrollListCtrl::sortByColumn(U32 column, BOOL ascending) 2556void LLScrollListCtrl::sortByColumnIndex(U32 column, BOOL ascending)
2559{ 2557{
2560 if (setSort(column, ascending)) 2558 if (setSort(column, ascending))
2561 { 2559 {
@@ -2582,7 +2580,7 @@ void LLScrollListCtrl::dirtyColumns()
2582 // just in case someone indexes into it immediately 2580 // just in case someone indexes into it immediately
2583 mColumnsIndexed.resize(mColumns.size()); 2581 mColumnsIndexed.resize(mColumns.size());
2584 2582
2585 std::map<LLString, LLScrollListColumn>::iterator column_itor; 2583 std::map<std::string, LLScrollListColumn>::iterator column_itor;
2586 for (column_itor = mColumns.begin(); column_itor != mColumns.end(); ++column_itor) 2584 for (column_itor = mColumns.begin(); column_itor != mColumns.end(); ++column_itor)
2587 { 2585 {
2588 LLScrollListColumn *column = &column_itor->second; 2586 LLScrollListColumn *column = &column_itor->second;
@@ -2671,7 +2669,7 @@ LLXMLNodePtr LLScrollListCtrl::getXML(bool save_children) const
2671 2669
2672 // Contents 2670 // Contents
2673 2671
2674 std::map<LLString, LLScrollListColumn>::const_iterator itor; 2672 std::map<std::string, LLScrollListColumn>::const_iterator itor;
2675 std::vector<const LLScrollListColumn*> sorted_list; 2673 std::vector<const LLScrollListColumn*> sorted_list;
2676 sorted_list.resize(mColumns.size()); 2674 sorted_list.resize(mColumns.size());
2677 for (itor = mColumns.begin(); itor != mColumns.end(); ++itor) 2675 for (itor = mColumns.begin(); itor != mColumns.end(); ++itor)
@@ -2763,7 +2761,7 @@ void LLScrollListCtrl::setScrollListParameters(LLXMLNodePtr node)
2763// static 2761// static
2764LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) 2762LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
2765{ 2763{
2766 LLString name("scroll_list"); 2764 std::string name("scroll_list");
2767 node->getAttributeString("name", name); 2765 node->getAttributeString("name", name);
2768 2766
2769 LLRect rect; 2767 LLRect rect;
@@ -2813,7 +2811,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2813 2811
2814 if (sort_column >= 0) 2812 if (sort_column >= 0)
2815 { 2813 {
2816 scroll_list->sortByColumn(sort_column, sort_ascending); 2814 scroll_list->sortByColumnIndex(sort_column, sort_ascending);
2817 } 2815 }
2818 2816
2819 LLSD columns; 2817 LLSD columns;
@@ -2824,19 +2822,19 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2824 { 2822 {
2825 if (child->hasName("column")) 2823 if (child->hasName("column"))
2826 { 2824 {
2827 LLString labelname(""); 2825 std::string labelname("");
2828 child->getAttributeString("label", labelname); 2826 child->getAttributeString("label", labelname);
2829 2827
2830 LLString columnname(labelname); 2828 std::string columnname(labelname);
2831 child->getAttributeString("name", columnname); 2829 child->getAttributeString("name", columnname);
2832 2830
2833 LLString sortname(columnname); 2831 std::string sortname(columnname);
2834 child->getAttributeString("sort", sortname); 2832 child->getAttributeString("sort", sortname);
2835 2833
2836 BOOL sort_ascending = TRUE; 2834 BOOL sort_ascending = TRUE;
2837 child->getAttributeBOOL("sort_ascending", sort_ascending); 2835 child->getAttributeBOOL("sort_ascending", sort_ascending);
2838 2836
2839 LLString imagename; 2837 std::string imagename;
2840 child->getAttributeString("image", imagename); 2838 child->getAttributeString("image", imagename);
2841 2839
2842 BOOL columndynamicwidth = FALSE; 2840 BOOL columndynamicwidth = FALSE;
@@ -2845,7 +2843,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2845 S32 columnwidth = -1; 2843 S32 columnwidth = -1;
2846 child->getAttributeS32("width", columnwidth); 2844 child->getAttributeS32("width", columnwidth);
2847 2845
2848 LLString tooltip; 2846 std::string tooltip;
2849 child->getAttributeString("tool_tip", tooltip); 2847 child->getAttributeString("tool_tip", tooltip);
2850 2848
2851 if(!columndynamicwidth) total_static += llmax(0, columnwidth); 2849 if(!columndynamicwidth) total_static += llmax(0, columnwidth);
@@ -2890,15 +2888,15 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2890 { 2888 {
2891 if (row_child->hasName("column")) 2889 if (row_child->hasName("column"))
2892 { 2890 {
2893 LLString value = row_child->getTextContents(); 2891 std::string value = row_child->getTextContents();
2894 2892
2895 LLString columnname(""); 2893 std::string columnname("");
2896 row_child->getAttributeString("name", columnname); 2894 row_child->getAttributeString("name", columnname);
2897 2895
2898 LLString font(""); 2896 std::string font("");
2899 row_child->getAttributeString("font", font); 2897 row_child->getAttributeString("font", font);
2900 2898
2901 LLString font_style(""); 2899 std::string font_style("");
2902 row_child->getAttributeString("font-style", font_style); 2900 row_child->getAttributeString("font-style", font_style);
2903 2901
2904 row["columns"][column_idx]["column"] = columnname; 2902 row["columns"][column_idx]["column"] = columnname;
@@ -2912,7 +2910,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2912 } 2910 }
2913 } 2911 }
2914 2912
2915 LLString contents = node->getTextContents(); 2913 std::string contents = node->getTextContents();
2916 if (!contents.empty()) 2914 if (!contents.empty())
2917 { 2915 {
2918 typedef boost::tokenizer<boost::char_separator<char> > tokenizer; 2916 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
@@ -2922,7 +2920,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2922 2920
2923 while(token_iter != tokens.end()) 2921 while(token_iter != tokens.end())
2924 { 2922 {
2925 const char* line = token_iter->c_str(); 2923 const std::string& line = *token_iter;
2926 scroll_list->addSimpleElement(line); 2924 scroll_list->addSimpleElement(line);
2927 ++token_iter; 2925 ++token_iter;
2928 } 2926 }
@@ -2936,7 +2934,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2936// virtual 2934// virtual
2937void LLScrollListCtrl::copy() 2935void LLScrollListCtrl::copy()
2938{ 2936{
2939 LLString buffer; 2937 std::string buffer;
2940 2938
2941 std::vector<LLScrollListItem*> items = getAllSelected(); 2939 std::vector<LLScrollListItem*> items = getAllSelected();
2942 std::vector<LLScrollListItem*>::iterator itor; 2940 std::vector<LLScrollListItem*>::iterator itor;
@@ -3006,7 +3004,7 @@ BOOL LLScrollListCtrl::canDeselect() const
3006 3004
3007void LLScrollListCtrl::addColumn(const LLSD& column, EAddPosition pos) 3005void LLScrollListCtrl::addColumn(const LLSD& column, EAddPosition pos)
3008{ 3006{
3009 LLString name = column["name"].asString(); 3007 std::string name = column["name"].asString();
3010 // if no column name provided, just use ordinal as name 3008 // if no column name provided, just use ordinal as name
3011 if (name.empty()) 3009 if (name.empty())
3012 { 3010 {
@@ -3037,7 +3035,7 @@ void LLScrollListCtrl::addColumn(const LLSD& column, EAddPosition pos)
3037 S32 top = mItemListRect.mTop; 3035 S32 top = mItemListRect.mTop;
3038 S32 left = mItemListRect.mLeft; 3036 S32 left = mItemListRect.mLeft;
3039 { 3037 {
3040 std::map<LLString, LLScrollListColumn>::iterator itor; 3038 std::map<std::string, LLScrollListColumn>::iterator itor;
3041 for (itor = mColumns.begin(); itor != mColumns.end(); ++itor) 3039 for (itor = mColumns.begin(); itor != mColumns.end(); ++itor)
3042 { 3040 {
3043 if (itor->second.mIndex < new_column->mIndex && 3041 if (itor->second.mIndex < new_column->mIndex &&
@@ -3047,7 +3045,7 @@ void LLScrollListCtrl::addColumn(const LLSD& column, EAddPosition pos)
3047 } 3045 }
3048 } 3046 }
3049 } 3047 }
3050 LLString button_name = "btn_" + name; 3048 std::string button_name = "btn_" + name;
3051 S32 right = left+new_column->mWidth; 3049 S32 right = left+new_column->mWidth;
3052 if (new_column->mIndex != (S32)mColumns.size()-1) 3050 if (new_column->mIndex != (S32)mColumns.size()-1)
3053 { 3051 {
@@ -3108,7 +3106,7 @@ void LLScrollListCtrl::onClickColumn(void *userdata)
3108 ascending = !parent->mSortColumns.back().second; 3106 ascending = !parent->mSortColumns.back().second;
3109 } 3107 }
3110 3108
3111 parent->sortByColumn(column_index, ascending); 3109 parent->sortByColumnIndex(column_index, ascending);
3112 3110
3113 if (parent->mOnSortChangedCallback) 3111 if (parent->mOnSortChangedCallback)
3114 { 3112 {
@@ -3131,7 +3129,7 @@ BOOL LLScrollListCtrl::needsSorting()
3131 3129
3132void LLScrollListCtrl::clearColumns() 3130void LLScrollListCtrl::clearColumns()
3133{ 3131{
3134 std::map<LLString, LLScrollListColumn>::iterator itor; 3132 std::map<std::string, LLScrollListColumn>::iterator itor;
3135 for (itor = mColumns.begin(); itor != mColumns.end(); ++itor) 3133 for (itor = mColumns.begin(); itor != mColumns.end(); ++itor)
3136 { 3134 {
3137 LLColumnHeader *header = itor->second.mHeader; 3135 LLColumnHeader *header = itor->second.mHeader;
@@ -3145,9 +3143,9 @@ void LLScrollListCtrl::clearColumns()
3145 mSortColumns.clear(); 3143 mSortColumns.clear();
3146} 3144}
3147 3145
3148void LLScrollListCtrl::setColumnLabel(const LLString& column, const LLString& label) 3146void LLScrollListCtrl::setColumnLabel(const std::string& column, const std::string& label)
3149{ 3147{
3150 std::map<LLString, LLScrollListColumn>::iterator itor = mColumns.find(column); 3148 std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(column);
3151 if (itor != mColumns.end()) 3149 if (itor != mColumns.end())
3152 { 3150 {
3153 itor->second.mLabel = label; 3151 itor->second.mLabel = label;
@@ -3201,7 +3199,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3201 // skip unused columns in item passed in 3199 // skip unused columns in item passed in
3202 continue; 3200 continue;
3203 } 3201 }
3204 LLString column = (*itor)["column"].asString(); 3202 std::string column = (*itor)["column"].asString();
3205 3203
3206 LLScrollListColumn* columnp = NULL; 3204 LLScrollListColumn* columnp = NULL;
3207 3205
@@ -3213,7 +3211,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3213 column = new_name.str(); 3211 column = new_name.str();
3214 } 3212 }
3215 3213
3216 std::map<LLString, LLScrollListColumn>::iterator column_itor; 3214 std::map<std::string, LLScrollListColumn>::iterator column_itor;
3217 column_itor = mColumns.find(column); 3215 column_itor = mColumns.find(column);
3218 if (column_itor != mColumns.end()) 3216 if (column_itor != mColumns.end())
3219 { 3217 {
@@ -3244,11 +3242,19 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3244 S32 index = columnp->mIndex; 3242 S32 index = columnp->mIndex;
3245 S32 width = columnp->mWidth; 3243 S32 width = columnp->mWidth;
3246 LLFontGL::HAlign font_alignment = columnp->mFontAlignment; 3244 LLFontGL::HAlign font_alignment = columnp->mFontAlignment;
3247 3245 LLColor4 fcolor = LLColor4::black;
3246
3248 LLSD value = (*itor)["value"]; 3247 LLSD value = (*itor)["value"];
3249 LLString fontname = (*itor)["font"].asString(); 3248 std::string fontname = (*itor)["font"].asString();
3250 LLString fontstyle = (*itor)["font-style"].asString(); 3249 std::string fontstyle = (*itor)["font-style"].asString();
3251 LLString type = (*itor)["type"].asString(); 3250 std::string type = (*itor)["type"].asString();
3251
3252 if ((*itor).has("font-color"))
3253 {
3254 LLSD sd_color = (*itor)["font-color"];
3255 fcolor.setValue(sd_color);
3256 }
3257
3252 BOOL has_color = (*itor).has("color"); 3258 BOOL has_color = (*itor).has("color");
3253 LLColor4 color = ((*itor)["color"]); 3259 LLColor4 color = ((*itor)["color"]);
3254 BOOL enabled = !(*itor).has("enabled") || (*itor)["enabled"].asBoolean() == true; 3260 BOOL enabled = !(*itor).has("enabled") || (*itor)["enabled"].asBoolean() == true;
@@ -3271,8 +3277,8 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3271 } 3277 }
3272 else if (type == "checkbox") 3278 else if (type == "checkbox")
3273 { 3279 {
3274 LLCheckBoxCtrl* ctrl = new LLCheckBoxCtrl("check", 3280 LLCheckBoxCtrl* ctrl = new LLCheckBoxCtrl(std::string("check"),
3275 LLRect(0, width, width, 0), " "); 3281 LLRect(0, width, width, 0), std::string(" "));
3276 ctrl->setEnabled(enabled); 3282 ctrl->setEnabled(enabled);
3277 ctrl->setValue(value); 3283 ctrl->setValue(value);
3278 LLScrollListCheck* cell = new LLScrollListCheck(ctrl,width); 3284 LLScrollListCheck* cell = new LLScrollListCheck(ctrl,width);
@@ -3293,7 +3299,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3293 } 3299 }
3294 else 3300 else
3295 { 3301 {
3296 LLScrollListText* cell = new LLScrollListText(value.asString(), font, width, font_style, font_alignment); 3302 LLScrollListText* cell = new LLScrollListText(value.asString(), font, width, font_style, font_alignment, fcolor, TRUE);
3297 if (has_color) 3303 if (has_color)
3298 { 3304 {
3299 cell->setColor(color); 3305 cell->setColor(color);
@@ -3315,7 +3321,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3315 if (new_item->getColumn(column_idx) == NULL) 3321 if (new_item->getColumn(column_idx) == NULL)
3316 { 3322 {
3317 LLScrollListColumn* column_ptr = &column_it->second; 3323 LLScrollListColumn* column_ptr = &column_it->second;
3318 new_item->setColumn(column_idx, new LLScrollListText("", LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ), column_ptr->mWidth, LLFontGL::NORMAL)); 3324 new_item->setColumn(column_idx, new LLScrollListText(LLStringUtil::null, LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ), column_ptr->mWidth, LLFontGL::NORMAL));
3319 } 3325 }
3320 } 3326 }
3321 3327
@@ -3324,7 +3330,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3324 return new_item; 3330 return new_item;
3325} 3331}
3326 3332
3327LLScrollListItem* LLScrollListCtrl::addSimpleElement(const LLString& value, EAddPosition pos, const LLSD& id) 3333LLScrollListItem* LLScrollListCtrl::addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id)
3328{ 3334{
3329 LLSD entry_id = id; 3335 LLSD entry_id = id;
3330 3336
@@ -3441,7 +3447,7 @@ void LLScrollListCtrl::onFocusLost()
3441 LLUICtrl::onFocusLost(); 3447 LLUICtrl::onFocusLost();
3442} 3448}
3443 3449
3444LLColumnHeader::LLColumnHeader(const LLString& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL* fontp) : 3450LLColumnHeader::LLColumnHeader(const std::string& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL* fontp) :
3445 LLComboBox(label, rect, label, NULL, NULL), 3451 LLComboBox(label, rect, label, NULL, NULL),
3446 mColumn(column), 3452 mColumn(column),
3447 mOrigLabel(label), 3453 mOrigLabel(label),
@@ -3460,15 +3466,15 @@ LLColumnHeader::LLColumnHeader(const LLString& label, const LLRect &rect, LLScro
3460 3466
3461 mButton->setCallbackUserData(this); 3467 mButton->setCallbackUserData(this);
3462 3468
3463 mAscendingText = "[LOW]...[HIGH](Ascending)"; 3469 mAscendingText = std::string("[LOW]...[HIGH](Ascending)"); // *TODO: Translate
3464 mDescendingText = "[HIGH]...[LOW](Descending)"; 3470 mDescendingText = std::string("[HIGH]...[LOW](Descending)"); // *TODO: Translate
3465 3471
3466 mList->reshape(llmax(mList->getRect().getWidth(), 110, getRect().getWidth()), mList->getRect().getHeight()); 3472 mList->reshape(llmax(mList->getRect().getWidth(), 110, getRect().getWidth()), mList->getRect().getHeight());
3467 3473
3468 // resize handles on left and right 3474 // resize handles on left and right
3469 const S32 RESIZE_BAR_THICKNESS = 3; 3475 const S32 RESIZE_BAR_THICKNESS = 3;
3470 mResizeBar = new LLResizeBar( 3476 mResizeBar = new LLResizeBar(
3471 "resizebar", 3477 std::string("resizebar"),
3472 this, 3478 this,
3473 LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), 3479 LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0),
3474 MIN_COLUMN_WIDTH, S32_MAX, LLResizeBar::RIGHT ); 3480 MIN_COLUMN_WIDTH, S32_MAX, LLResizeBar::RIGHT );
@@ -3521,7 +3527,7 @@ BOOL LLColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask)
3521 return TRUE; 3527 return TRUE;
3522} 3528}
3523 3529
3524void LLColumnHeader::setImage(const LLString &image_name) 3530void LLColumnHeader::setImage(const std::string &image_name)
3525{ 3531{
3526 if (mButton) 3532 if (mButton)
3527 { 3533 {
@@ -3574,8 +3580,8 @@ void LLColumnHeader::showList()
3574 // move sort column over to this column and do initial sort 3580 // move sort column over to this column and do initial sort
3575 mColumn->mParentCtrl->sortByColumn(mColumn->mSortingColumn, mColumn->mParentCtrl->getSortAscending()); 3581 mColumn->mParentCtrl->sortByColumn(mColumn->mSortingColumn, mColumn->mParentCtrl->getSortAscending());
3576 3582
3577 LLString low_item_text; 3583 std::string low_item_text;
3578 LLString high_item_text; 3584 std::string high_item_text;
3579 3585
3580 LLScrollListItem* itemp = mColumn->mParentCtrl->getFirstData(); 3586 LLScrollListItem* itemp = mColumn->mParentCtrl->getFirstData();
3581 if (itemp) 3587 if (itemp)
@@ -3611,11 +3617,11 @@ void LLColumnHeader::showList()
3611 } 3617 }
3612 } 3618 }
3613 3619
3614 LLString::truncate(low_item_text, 3); 3620 LLStringUtil::truncate(low_item_text, 3);
3615 LLString::truncate(high_item_text, 3); 3621 LLStringUtil::truncate(high_item_text, 3);
3616 3622
3617 LLString ascending_string; 3623 std::string ascending_string;
3618 LLString descending_string; 3624 std::string descending_string;
3619 3625
3620 if (low_item_text.empty() || high_item_text.empty()) 3626 if (low_item_text.empty() || high_item_text.empty())
3621 { 3627 {