From 5d85dad85f07ea23b3a2892276d8ac591a966864 Mon Sep 17 00:00:00 2001 From: Dessie Linden Date: Thu, 15 Jul 2010 12:31:08 -0700 Subject: Reverted changeset 2bb10eae42bf --- indra/llui/llflatlistview.cpp | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'indra/llui/llflatlistview.cpp') diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 3c79da64f9..6eb214cb93 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -157,7 +157,7 @@ bool LLFlatListView::insertItemAfter(LLPanel* after_item, LLPanel* item_to_add, } -bool LLFlatListView::removeItem(LLPanel* item, bool rearrange) +bool LLFlatListView::removeItem(LLPanel* item) { if (!item) return false; if (item->getParent() != mItemsPanel) return false; @@ -165,22 +165,22 @@ bool LLFlatListView::removeItem(LLPanel* item, bool rearrange) item_pair_t* item_pair = getItemPair(item); if (!item_pair) return false; - return removeItemPair(item_pair, rearrange); + return removeItemPair(item_pair); } -bool LLFlatListView::removeItemByValue(const LLSD& value, bool rearrange) +bool LLFlatListView::removeItemByValue(const LLSD& value) { if (value.isUndefined()) return false; item_pair_t* item_pair = getItemPair(value); if (!item_pair) return false; - return removeItemPair(item_pair, rearrange); + return removeItemPair(item_pair); } -bool LLFlatListView::removeItemByUUID(const LLUUID& uuid, bool rearrange) +bool LLFlatListView::removeItemByUUID(const LLUUID& uuid) { - return removeItemByValue(LLSD(uuid), rearrange); + return removeItemByValue(LLSD(uuid)); } LLPanel* LLFlatListView::getItemByValue(const LLSD& value) const @@ -327,9 +327,6 @@ U32 LLFlatListView::size(const bool only_visible_items) const void LLFlatListView::clear() { - // This will clear mSelectedItemPairs, calling all appropriate callbacks. - resetSelection(); - // do not use LLView::deleteAllChildren to avoid removing nonvisible items. drag-n-drop for ex. for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it) { @@ -338,6 +335,7 @@ void LLFlatListView::clear() delete *it; } mItemPairs.clear(); + mSelectedItemPairs.clear(); // also set items panel height to zero. Reshape it to allow reshaping of non-item children LLRect rc = mItemsPanel->getRect(); @@ -972,12 +970,11 @@ bool LLFlatListView::isSelected(item_pair_t* item_pair) const return std::find(mSelectedItemPairs.begin(), it_end, item_pair) != it_end; } -bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange) +bool LLFlatListView::removeItemPair(item_pair_t* item_pair) { llassert(item_pair); bool deleted = false; - bool selection_changed = false; for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it) { item_pair_t* _item_pair = *it; @@ -997,7 +994,6 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange) if (selected_item_pair == item_pair) { it = mSelectedItemPairs.erase(it); - selection_changed = true; break; } } @@ -1006,16 +1002,8 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange) item_pair->first->die(); delete item_pair; - if (rearrange) - { rearrangeItems(); notifyParentItemsRectChanged(); - } - - if (selection_changed && mCommitOnSelectionChange) - { - onCommit(); - } return true; } @@ -1111,7 +1099,7 @@ void LLFlatListView::onFocusReceived() { if (size()) { - mSelectedItemsBorder->setVisible(TRUE); + mSelectedItemsBorder->setVisible(TRUE); } gEditMenuHandler = this; } -- cgit v1.2.3 From 15247f086989a43881d79c1ee5416bb00721eb68 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Jul 2010 14:22:14 -0700 Subject: Backed out changeset: 58571b4e704b --- indra/llui/llflatlistview.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'indra/llui/llflatlistview.cpp') diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 6eb214cb93..3c79da64f9 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -157,7 +157,7 @@ bool LLFlatListView::insertItemAfter(LLPanel* after_item, LLPanel* item_to_add, } -bool LLFlatListView::removeItem(LLPanel* item) +bool LLFlatListView::removeItem(LLPanel* item, bool rearrange) { if (!item) return false; if (item->getParent() != mItemsPanel) return false; @@ -165,22 +165,22 @@ bool LLFlatListView::removeItem(LLPanel* item) item_pair_t* item_pair = getItemPair(item); if (!item_pair) return false; - return removeItemPair(item_pair); + return removeItemPair(item_pair, rearrange); } -bool LLFlatListView::removeItemByValue(const LLSD& value) +bool LLFlatListView::removeItemByValue(const LLSD& value, bool rearrange) { if (value.isUndefined()) return false; item_pair_t* item_pair = getItemPair(value); if (!item_pair) return false; - return removeItemPair(item_pair); + return removeItemPair(item_pair, rearrange); } -bool LLFlatListView::removeItemByUUID(const LLUUID& uuid) +bool LLFlatListView::removeItemByUUID(const LLUUID& uuid, bool rearrange) { - return removeItemByValue(LLSD(uuid)); + return removeItemByValue(LLSD(uuid), rearrange); } LLPanel* LLFlatListView::getItemByValue(const LLSD& value) const @@ -327,6 +327,9 @@ U32 LLFlatListView::size(const bool only_visible_items) const void LLFlatListView::clear() { + // This will clear mSelectedItemPairs, calling all appropriate callbacks. + resetSelection(); + // do not use LLView::deleteAllChildren to avoid removing nonvisible items. drag-n-drop for ex. for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it) { @@ -335,7 +338,6 @@ void LLFlatListView::clear() delete *it; } mItemPairs.clear(); - mSelectedItemPairs.clear(); // also set items panel height to zero. Reshape it to allow reshaping of non-item children LLRect rc = mItemsPanel->getRect(); @@ -970,11 +972,12 @@ bool LLFlatListView::isSelected(item_pair_t* item_pair) const return std::find(mSelectedItemPairs.begin(), it_end, item_pair) != it_end; } -bool LLFlatListView::removeItemPair(item_pair_t* item_pair) +bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange) { llassert(item_pair); bool deleted = false; + bool selection_changed = false; for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it) { item_pair_t* _item_pair = *it; @@ -994,6 +997,7 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair) if (selected_item_pair == item_pair) { it = mSelectedItemPairs.erase(it); + selection_changed = true; break; } } @@ -1002,8 +1006,16 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair) item_pair->first->die(); delete item_pair; + if (rearrange) + { rearrangeItems(); notifyParentItemsRectChanged(); + } + + if (selection_changed && mCommitOnSelectionChange) + { + onCommit(); + } return true; } @@ -1099,7 +1111,7 @@ void LLFlatListView::onFocusReceived() { if (size()) { - mSelectedItemsBorder->setVisible(TRUE); + mSelectedItemsBorder->setVisible(TRUE); } gEditMenuHandler = this; } -- cgit v1.2.3