summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorygallery.cpp53
-rw-r--r--indra/newview/llinventorygallery.h1
2 files changed, 53 insertions, 1 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index f791521e3e..80bfbb8d23 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -421,8 +421,9 @@ void LLInventoryGallery::addToGallery(LLInventoryGalleryItem* item)
mHiddenItems.push_back(item);
return;
}
+ mItemIndexMap[item] = mItemsAddedCount;
+ mIndexToItemMap[mItemsAddedCount] = item;
mItemsAddedCount++;
- mItemIndexMap[item] = mItemsAddedCount - 1;
int n = mItemsAddedCount;
int row_count = (n % mItemsInRow) == 0 ? n / mItemsInRow : n / mItemsInRow + 1;
int n_prev = n - 1;
@@ -458,6 +459,7 @@ void LLInventoryGallery::removeFromGalleryLast(LLInventoryGalleryItem* item)
int row_count = (n % mItemsInRow) == 0 ? n / mItemsInRow : n / mItemsInRow + 1;
int row_count_prev = (n_prev % mItemsInRow) == 0 ? n_prev / mItemsInRow : n_prev / mItemsInRow + 1;
mItemsAddedCount--;
+ mIndexToItemMap.erase(mItemsAddedCount);
bool remove_row = row_count != row_count_prev;
removeFromLastRow(mItems[mItemsAddedCount]);
@@ -483,6 +485,7 @@ void LLInventoryGallery::removeFromGalleryMiddle(LLInventoryGalleryItem* item)
}
int n = mItemIndexMap[item];
mItemIndexMap.erase(item);
+ mIndexToItemMap.erase(n);
std::vector<LLInventoryGalleryItem*> saved;
for (int i = mItemsAddedCount - 1; i > n; i--)
{
@@ -949,6 +952,54 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask)
handled = TRUE;
break;
+ case KEY_LEFT:
+ mFilterSubString.clear();
+
+ if (mInventoryGalleryMenu && mSelectedItemID.notNull() && mItemsAddedCount > 1)
+ {
+ LLInventoryGalleryItem* item = getSelectedItem();
+ if (item)
+ {
+ // Might be better to get item from panel
+ S32 n = mItemIndexMap[item];
+ if (n == 0)
+ {
+ n = mItemsAddedCount - 1;
+ }
+ n--;
+ item = mIndexToItemMap[n];
+ LLUUID item_id = item->getUUID();
+ changeItemSelection(item_id, true);
+ item->setFocus(TRUE);
+
+ }
+ }
+ handled = TRUE;
+ break;
+
+ case KEY_RIGHT:
+ mFilterSubString.clear();
+
+ if (mInventoryGalleryMenu && mSelectedItemID.notNull() && mItemsAddedCount > 1)
+ {
+ LLInventoryGalleryItem* item = getSelectedItem();
+ if (item)
+ {
+ S32 n = mItemIndexMap[item];
+ n++;
+ if (n == mItemsAddedCount)
+ {
+ n = 0;
+ }
+ item = mIndexToItemMap[n];
+ LLUUID item_id = item->getUUID();
+ changeItemSelection(item_id, true);
+ item->setFocus(TRUE);
+ }
+ }
+ handled = TRUE;
+ break;
+
default:
break;
}
diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h
index de0cba6e63..7d4431dbfb 100644
--- a/indra/newview/llinventorygallery.h
+++ b/indra/newview/llinventorygallery.h
@@ -215,6 +215,7 @@ private:
uuid_vec_t mCOFLinkedItems;
uuid_vec_t mActiveGestures;
std::map<LLInventoryGalleryItem*, S32> mItemIndexMap;
+ std::map<S32, LLInventoryGalleryItem*> mIndexToItemMap;
LLInventoryFilter::ESearchType mSearchType;
std::string mUsername;