summaryrefslogtreecommitdiff
path: root/indra/llui/llscrolllistctrl.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-09-29 19:14:50 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-09-29 19:14:50 +0000
commitd725e5b24075b2171f8a5b263969991e9b475078 (patch)
treef1422064fd0ab676dfa66d39b5d0f0b9e8ff1086 /indra/llui/llscrolllistctrl.cpp
parent66739da16407a8e56accc236bd3996c1963a6bcf (diff)
QAR-872 Viewer 1.21 RC 3
merge viewer_1-21 96116-97380 -> release
Diffstat (limited to 'indra/llui/llscrolllistctrl.cpp')
-rw-r--r--indra/llui/llscrolllistctrl.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 3c29795cb4..275cc65976 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -67,9 +67,6 @@ struct SortScrollListItem
bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2)
{
- if ( mSortOrders.empty() )
- return i1 < i2;
-
// sort over all columns in order specified by mSortOrders
S32 sort_result = 0;
for (sort_order_t::const_reverse_iterator it = mSortOrders.rbegin();
@@ -91,7 +88,8 @@ struct SortScrollListItem
}
}
- return sort_result < 0;
+ // make sure to keep order when sort_result == 0
+ return sort_result <= 0;
}
typedef std::vector<std::pair<S32, BOOL> > sort_order_t;
@@ -2539,12 +2537,6 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void
void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending)
{
- if (name.empty())
- {
- sortItems();
- return;
- }
-
std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name);
if (itor != mColumns.end())
{
@@ -2572,6 +2564,19 @@ void LLScrollListCtrl::sortItems()
setSorted(TRUE);
}
+// for one-shot sorts, does not save sort column/order
+void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending)
+{
+ std::vector<std::pair<S32, BOOL> > sort_column;
+ sort_column.push_back(std::make_pair(column, ascending));
+
+ // do stable sort to preserve any previous sorts
+ std::stable_sort(
+ mItemList.begin(),
+ mItemList.end(),
+ SortScrollListItem(sort_column));
+}
+
void LLScrollListCtrl::dirtyColumns()
{
mColumnsDirty = TRUE;