diff options
Diffstat (limited to 'linden/indra/llui/llscrolllistctrl.cpp')
-rw-r--r-- | linden/indra/llui/llscrolllistctrl.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp index 6561bb5..d342378 100644 --- a/linden/indra/llui/llscrolllistctrl.cpp +++ b/linden/indra/llui/llscrolllistctrl.cpp | |||
@@ -67,9 +67,6 @@ struct SortScrollListItem | |||
67 | 67 | ||
68 | bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) | 68 | bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) |
69 | { | 69 | { |
70 | if ( mSortOrders.empty() ) | ||
71 | return i1 < i2; | ||
72 | |||
73 | // sort over all columns in order specified by mSortOrders | 70 | // sort over all columns in order specified by mSortOrders |
74 | S32 sort_result = 0; | 71 | S32 sort_result = 0; |
75 | for (sort_order_t::const_reverse_iterator it = mSortOrders.rbegin(); | 72 | for (sort_order_t::const_reverse_iterator it = mSortOrders.rbegin(); |
@@ -2539,12 +2536,6 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void | |||
2539 | 2536 | ||
2540 | void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) | 2537 | void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) |
2541 | { | 2538 | { |
2542 | if (name.empty()) | ||
2543 | { | ||
2544 | sortItems(); | ||
2545 | return; | ||
2546 | } | ||
2547 | |||
2548 | std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name); | 2539 | std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name); |
2549 | if (itor != mColumns.end()) | 2540 | if (itor != mColumns.end()) |
2550 | { | 2541 | { |
@@ -2572,6 +2563,19 @@ void LLScrollListCtrl::sortItems() | |||
2572 | setSorted(TRUE); | 2563 | setSorted(TRUE); |
2573 | } | 2564 | } |
2574 | 2565 | ||
2566 | // for one-shot sorts, does not save sort column/order | ||
2567 | void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) | ||
2568 | { | ||
2569 | std::vector<std::pair<S32, BOOL> > sort_column; | ||
2570 | sort_column.push_back(std::make_pair(column, ascending)); | ||
2571 | |||
2572 | // do stable sort to preserve any previous sorts | ||
2573 | std::stable_sort( | ||
2574 | mItemList.begin(), | ||
2575 | mItemList.end(), | ||
2576 | SortScrollListItem(sort_column)); | ||
2577 | } | ||
2578 | |||
2575 | void LLScrollListCtrl::dirtyColumns() | 2579 | void LLScrollListCtrl::dirtyColumns() |
2576 | { | 2580 | { |
2577 | mColumnsDirty = TRUE; | 2581 | mColumnsDirty = TRUE; |