summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorEugene Mutavchi <emutavchi@productengine.com>2010-04-16 13:18:11 +0300
committerEugene Mutavchi <emutavchi@productengine.com>2010-04-16 13:18:11 +0300
commit4e4dd52753523afcedc4af357a280defd1cb9070 (patch)
treeb73c45887e300cd45e7c4d3acded80eca0a30129 /indra
parent960eb2c65fe5618bf977b80a3485a4346d5d85c6 (diff)
Fixed low bug EXT-6823 (Implement a possibility to select several residents by "Shift" button) - improved the selection of list items by mouse.
Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/238/ --HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llflatlistview.cpp63
1 files changed, 62 insertions, 1 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 35f5a6bbb9..82f054c4b7 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -504,7 +504,68 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
//*TODO find a better place for that enforcing stuff
if (mKeepOneItemSelected && numSelected() == 1 && !select_item) return;
-
+
+ if ( (mask & MASK_SHIFT) && !(mask & MASK_CONTROL)
+ && mMultipleSelection && !mSelectedItemPairs.empty() )
+ {
+ item_pair_t* last_selected_pair = mSelectedItemPairs.back();
+
+ // If item_pair is already selected - do nothing
+ if (last_selected_pair == item_pair)
+ return;
+
+ bool grab_items = false;
+ pairs_list_t pairs_to_select;
+
+ // Pick out items from list between last selected and current clicked item_pair.
+ for (pairs_iterator_t
+ iter = mItemPairs.begin(),
+ iter_end = mItemPairs.end();
+ iter != iter_end; ++iter)
+ {
+ item_pair_t* cur = *iter;
+ if (cur == last_selected_pair || cur == item_pair)
+ {
+ grab_items = !grab_items;
+ // Skip last selected and current clicked item pairs.
+ continue;
+ }
+ if (!cur->first->getVisible())
+ {
+ // Skip invisible item pairs.
+ continue;
+ }
+ if (grab_items)
+ {
+ pairs_to_select.push_back(cur);
+ }
+ }
+
+ if (select_item)
+ {
+ pairs_to_select.push_back(item_pair);
+ }
+
+ for (pairs_iterator_t
+ iter = pairs_to_select.begin(),
+ iter_end = pairs_to_select.end();
+ iter != iter_end; ++iter)
+ {
+ item_pair_t* pair_to_select = *iter;
+ selectItemPair(pair_to_select, true);
+ }
+
+ if (!select_item)
+ {
+ // Item was already selected but there is a need to update last selected item and its border.
+ // Do it here to prevent extra mCommitOnSelectionChange in selectItemPair().
+ mSelectedItemPairs.remove(item_pair);
+ mSelectedItemPairs.push_back(item_pair);
+ mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1));
+ }
+ return;
+ }
+
if (!(mask & MASK_CONTROL) || !mMultipleSelection) resetSelection();
selectItemPair(item_pair, select_item);
}