diff options
author | Richard Linden <none@none> | 2012-08-02 20:47:02 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-08-02 20:47:02 -0700 |
commit | c43eedd43471fcbbbda91cc5f30674ba2485659a (patch) | |
tree | 4bf3a519dde06c37088644346179077a1beb3965 | |
parent | ae2de6bdcfa5ed40f820652193753b29bceaef80 (diff) | |
parent | faac868b682360df1bf461624667cc6e0bbdd8c6 (diff) |
Automated merge with ssh://hg.lindenlab.com/richard/viewer-chui
-rw-r--r-- | indra/llui/llfolderview.cpp | 95 | ||||
-rw-r--r-- | indra/llui/llfolderview.h | 10 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 22 |
3 files changed, 56 insertions, 71 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 5c421976b5..fedb8bc014 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -749,28 +749,18 @@ void LLFolderView::removeSelectedItems() // iterate through the new container. count = items.size(); LLUUID new_selection_id; + LLFolderViewItem* item_to_select = getNextUnselectedItem(); + if(count == 1) { LLFolderViewItem* item_to_delete = items[0]; LLFolderViewFolder* parent = item_to_delete->getParentFolder(); - LLFolderViewItem* new_selection = item_to_delete->getNextOpenNode(FALSE); - if (!new_selection) - { - new_selection = item_to_delete->getPreviousOpenNode(FALSE); - } if(parent) { if (item_to_delete->remove()) { // change selection on successful delete - if (new_selection) - { - getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); - } - else - { - getRoot()->setSelection(NULL, mParentPanel->hasFocus()); - } + setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus()); } } arrangeAll(); @@ -779,28 +769,8 @@ void LLFolderView::removeSelectedItems() { LLDynamicArray<LLFolderViewModelItem*> listeners; LLFolderViewModelItem* listener; - LLFolderViewItem* last_item = items[count - 1]; - LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE); - while(new_selection && new_selection->isSelected()) - { - new_selection = new_selection->getNextOpenNode(FALSE); - } - if (!new_selection) - { - new_selection = last_item->getPreviousOpenNode(FALSE); - while (new_selection && (new_selection->isInSelection())) - { - new_selection = new_selection->getPreviousOpenNode(FALSE); - } - } - if (new_selection) - { - getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); - } - else - { - getRoot()->setSelection(NULL, mParentPanel->hasFocus()); - } + + setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus()); for(S32 i = 0; i < count; ++i) { @@ -1032,28 +1002,13 @@ void LLFolderView::cut() S32 count = mSelectedItems.size(); if(getVisible() && getEnabled() && (count > 0)) { - LLFolderViewModelItem* listener = NULL; - - LLFolderViewItem* last_item = *mSelectedItems.rbegin();; - LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE); - while(new_selection && new_selection->isSelected()) - { - new_selection = new_selection->getNextOpenNode(FALSE); - } - if (!new_selection) - { - new_selection = last_item->getPreviousOpenNode(FALSE); - while (new_selection && (new_selection->isInSelection())) - { - new_selection = new_selection->getPreviousOpenNode(FALSE); - } - } + LLFolderViewItem* item_to_select = getNextUnselectedItem(); selected_items_t::iterator item_it; for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) { LLFolderViewItem* item_to_cut = *item_it; - listener = item_to_cut->getViewModelItem(); + LLFolderViewModelItem* listener = item_to_cut->getViewModelItem(); if(listener) { listener->cutToClipboard(); @@ -1061,14 +1016,7 @@ void LLFolderView::cut() } } - if (new_selection) - { - setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); - } - else - { - setSelection(NULL, mParentPanel->hasFocus()); - } + setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus()); } mSearchString.clear(); } @@ -1274,12 +1222,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if (next->isSelected()) { // shrink selection - getRoot()->changeSelection(last_selected, FALSE); + changeSelection(last_selected, FALSE); } else if (last_selected->getParentFolder() == next->getParentFolder()) { // grow selection - getRoot()->changeSelection(next, TRUE); + changeSelection(next, TRUE); } } } @@ -1338,12 +1286,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if (prev->isSelected()) { // shrink selection - getRoot()->changeSelection(last_selected, FALSE); + changeSelection(last_selected, FALSE); } else if (last_selected->getParentFolder() == prev->getParentFolder()) { // grow selection - getRoot()->changeSelection(prev, TRUE); + changeSelection(prev, TRUE); } } } @@ -2088,3 +2036,22 @@ S32 LLFolderView::getItemHeight() } return 0; } + +LLFolderViewItem* LLFolderView::getNextUnselectedItem() +{ + LLFolderViewItem* last_item = *mSelectedItems.rbegin(); + LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE); + while(new_selection && new_selection->isSelected()) + { + new_selection = new_selection->getNextOpenNode(FALSE); + } + if (!new_selection) + { + new_selection = last_item->getPreviousOpenNode(FALSE); + while (new_selection && (new_selection->isInSelection())) + { + new_selection = new_selection->getPreviousOpenNode(FALSE); + } + } + return new_selection; +} diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 05beff9bd8..81b0f087e8 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -172,17 +172,19 @@ public: BOOL isOpen() const { return TRUE; } // root folder always open // Copy & paste - virtual void copy(); virtual BOOL canCopy() const; + virtual void copy(); - virtual void cut(); virtual BOOL canCut() const; + virtual void cut(); - virtual void paste(); virtual BOOL canPaste() const; + virtual void paste(); - virtual void doDelete(); virtual BOOL canDoDelete() const; + virtual void doDelete(); + + LLFolderViewItem* getNextUnselectedItem(); // Public rename functionality - can only start the process void startRenamingSelectedItem( void ); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index e67b59ddcc..d6a685541f 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -607,9 +607,25 @@ void LLInventoryPanel::idle(void* user_data) if (panel->mClipboardState != LLClipboard::instance().getGeneration()) { panel->mClipboardState = LLClipboard::instance().getGeneration(); - panel->getFilter().setModified(LLClipboard::instance().isCutMode() - ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE - : LLInventoryFilter::FILTER_LESS_RESTRICTIVE); + if (LLClipboard::instance().isCutMode()) + { + LLDynamicArray<LLUUID> objects; + LLClipboard::instance().pasteFromClipboard(objects); + + for (LLDynamicArray<LLUUID>::iterator it = objects.begin(), end_it = objects.end(); + it != end_it; + ++it) + { + LLFolderViewItem* item = panel->getItemByID(*it); + if (item) + { + item->getViewModelItem()->dirtyFilter(); + } + } + /*panel->getFilter().setModified(LLClipboard::instance().isCutMode() + ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE + : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);*/ + } } panel->mFolderRoot->update(); |