summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturectrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltexturectrl.cpp')
-rw-r--r--indra/newview/lltexturectrl.cpp103
1 files changed, 64 insertions, 39 deletions
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 794281965e..39feb40109 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -95,6 +95,7 @@ public:
EAcceptance *accept,
LLString& tooltip_msg);
virtual void draw();
+ virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
// LLFloater overrides
virtual void onClose(bool app_quitting);
@@ -156,6 +157,7 @@ protected:
BOOL mCanApplyImmediately;
BOOL mNoCopyTextureSelected;
F32 mContextConeOpacity;
+ LLSaveFolderState mSavedFolderState;
};
LLFloaterTexturePicker::LLFloaterTexturePicker(
@@ -210,13 +212,16 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
- mInventoryPanel->setAutoSelectOverride(true);
mInventoryPanel->setFilterTypes(filter_types);
//mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss.
mInventoryPanel->setFilterPermMask(immediate_filter_perm_mask);
mInventoryPanel->setSelectCallback(onSelectionChange, this);
mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
mInventoryPanel->setAllowMultiSelect(FALSE);
+
+ // store this filter as the default one
+ mInventoryPanel->getRootFolder()->getFilter()->markDefault();
+
// Commented out to stop opening all folders with textures
// mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE);
@@ -244,6 +249,8 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
updateFilterPermMask();
setCanMinimize(FALSE);
+
+ mSavedFolderState.setApply(FALSE);
}
LLFloaterTexturePicker::~LLFloaterTexturePicker()
@@ -379,6 +386,41 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
return handled;
}
+BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
+{
+ LLFolderView* root_folder = mInventoryPanel->getRootFolder();
+
+ if (!called_from_parent && root_folder &&
+ mSearchEdit && mSearchEdit->hasFocus() &&
+ (key == KEY_RETURN || key == KEY_DOWN) && mask == MASK_NONE)
+ {
+ if (!root_folder->getCurSelectedItem())
+ {
+ LLFolderViewItem* itemp = root_folder->getItemByID(gAgent.getInventoryRootID());
+ if (itemp)
+ {
+ root_folder->setSelection(itemp, FALSE, FALSE);
+ }
+ }
+ root_folder->scrollToShowSelection();
+
+ // move focus to inventory proper
+ root_folder->setFocus(TRUE);
+
+ // treat this as a user selection of the first filtered result
+ commitIfImmediateSet();
+
+ return TRUE;
+ }
+
+ if (root_folder->hasFocus() && key == KEY_UP)
+ {
+ mSearchEdit->focusFirstItem(TRUE);
+ }
+
+ return LLFloater::handleKeyHere(key, mask, called_from_parent);
+}
+
// virtual
void LLFloaterTexturePicker::onClose(bool app_quitting)
{
@@ -738,53 +780,36 @@ void LLFloaterTexturePicker::onSearchEdit(const LLString& search_string, void* u
{
LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data;
- std::string filter_text = search_string;
-
- if (filter_text.empty()&& picker->mInventoryPanel->getFilterSubString().empty())
- {
- // current filter and new filter empty, do nothing
- return;
- }
- std::string upper_case_search_string = filter_text;
+ std::string upper_case_search_string = search_string;
LLString::toUpper(upper_case_search_string);
- picker->mInventoryPanel->setFilterSubString(upper_case_search_string);
-
- LLFolderView* root_folder = picker->mInventoryPanel->getRootFolder();
-
- //if (search_string.size())
- //{
- // LLSelectFirstFilteredItem filter;
- // root_folder->applyFunctorRecursively(filter);
- // //...and scroll to show it
- // root_folder->scrollToShowSelection();
- //}
-
- KEY key = gKeyboard->currentKey();
-
- if ((key == KEY_RETURN || key == KEY_DOWN) && gKeyboard->currentMask(FALSE) == MASK_NONE)
+ if (upper_case_search_string.empty())
{
- if (search_string.size())
+ if (picker->mInventoryPanel->getFilterSubString().empty())
{
- LLSelectFirstFilteredItem filter;
- root_folder->applyFunctorRecursively(filter);
- //...and scroll to show it
- root_folder->scrollToShowSelection();
+ // current filter and new filter empty, do nothing
+ return;
}
- if (!root_folder->getCurSelectedItem())
+ picker->mSavedFolderState.setApply(TRUE);
+ picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(picker->mSavedFolderState);
+ // add folder with current item to list of previously opened folders
+ LLOpenFoldersWithSelection opener;
+ picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener);
+ picker->mInventoryPanel->getRootFolder()->scrollToShowSelection();
+
+ }
+ else if (picker->mInventoryPanel->getFilterSubString().empty())
+ {
+ // first letter in search term, save existing folder open state
+ if (!picker->mInventoryPanel->getRootFolder()->isFilterActive())
{
- LLFolderViewItem* itemp = root_folder->getItemByID(gAgent.getInventoryRootID());
- if (itemp)
- {
- root_folder->setSelection(itemp, FALSE, FALSE);
- }
+ picker->mSavedFolderState.setApply(FALSE);
+ picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(picker->mSavedFolderState);
}
-
- // move focus to inventory proper
- root_folder->setFocus(TRUE);
- root_folder->scrollToShowSelection();
}
+
+ picker->mInventoryPanel->setFilterSubString(upper_case_search_string);
}
//static