diff options
author | Jacek Antonelli | 2008-09-28 17:21:23 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-28 17:21:46 -0500 |
commit | 31e7c77a411d94bc87f0232588b339149bb29a49 (patch) | |
tree | 49e487700e91713e620e4d33f20b7f7afb5a2fa9 /linden/indra/llui/llscrolllistctrl.cpp | |
parent | Second Life viewer sources 1.21.2-RC (diff) | |
download | meta-impy-31e7c77a411d94bc87f0232588b339149bb29a49.zip meta-impy-31e7c77a411d94bc87f0232588b339149bb29a49.tar.gz meta-impy-31e7c77a411d94bc87f0232588b339149bb29a49.tar.bz2 meta-impy-31e7c77a411d94bc87f0232588b339149bb29a49.tar.xz |
Second Life viewer sources 1.21.3-RC
Diffstat (limited to 'linden/indra/llui/llscrolllistctrl.cpp')
-rw-r--r-- | linden/indra/llui/llscrolllistctrl.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp index 6561bb5..e2623fb 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(); |
@@ -91,7 +88,8 @@ struct SortScrollListItem | |||
91 | } | 88 | } |
92 | } | 89 | } |
93 | 90 | ||
94 | return sort_result < 0; | 91 | // make sure to keep order when sort_result == 0 |
92 | return sort_result <= 0; | ||
95 | } | 93 | } |
96 | 94 | ||
97 | typedef std::vector<std::pair<S32, BOOL> > sort_order_t; | 95 | typedef std::vector<std::pair<S32, BOOL> > sort_order_t; |
@@ -2539,12 +2537,6 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void | |||
2539 | 2537 | ||
2540 | void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) | 2538 | void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) |
2541 | { | 2539 | { |
2542 | if (name.empty()) | ||
2543 | { | ||
2544 | sortItems(); | ||
2545 | return; | ||
2546 | } | ||
2547 | |||
2548 | std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name); | 2540 | std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name); |
2549 | if (itor != mColumns.end()) | 2541 | if (itor != mColumns.end()) |
2550 | { | 2542 | { |
@@ -2572,6 +2564,19 @@ void LLScrollListCtrl::sortItems() | |||
2572 | setSorted(TRUE); | 2564 | setSorted(TRUE); |
2573 | } | 2565 | } |
2574 | 2566 | ||
2567 | // for one-shot sorts, does not save sort column/order | ||
2568 | void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) | ||
2569 | { | ||
2570 | std::vector<std::pair<S32, BOOL> > sort_column; | ||
2571 | sort_column.push_back(std::make_pair(column, ascending)); | ||
2572 | |||
2573 | // do stable sort to preserve any previous sorts | ||
2574 | std::stable_sort( | ||
2575 | mItemList.begin(), | ||
2576 | mItemList.end(), | ||
2577 | SortScrollListItem(sort_column)); | ||
2578 | } | ||
2579 | |||
2575 | void LLScrollListCtrl::dirtyColumns() | 2580 | void LLScrollListCtrl::dirtyColumns() |
2576 | { | 2581 | { |
2577 | mColumnsDirty = TRUE; | 2582 | mColumnsDirty = TRUE; |