aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltexturectrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/lltexturectrl.cpp')
-rw-r--r--linden/indra/newview/lltexturectrl.cpp127
1 files changed, 78 insertions, 49 deletions
diff --git a/linden/indra/newview/lltexturectrl.cpp b/linden/indra/newview/lltexturectrl.cpp
index 9edd0ad..666b5d2 100644
--- a/linden/indra/newview/lltexturectrl.cpp
+++ b/linden/indra/newview/lltexturectrl.cpp
@@ -114,6 +114,7 @@ public:
114 EAcceptance *accept, 114 EAcceptance *accept,
115 LLString& tooltip_msg); 115 LLString& tooltip_msg);
116 virtual void draw(); 116 virtual void draw();
117 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
117 118
118 // LLFloater overrides 119 // LLFloater overrides
119 virtual void onClose(bool app_quitting); 120 virtual void onClose(bool app_quitting);
@@ -175,6 +176,7 @@ protected:
175 BOOL mCanApplyImmediately; 176 BOOL mCanApplyImmediately;
176 BOOL mNoCopyTextureSelected; 177 BOOL mNoCopyTextureSelected;
177 F32 mContextConeOpacity; 178 F32 mContextConeOpacity;
179 LLSaveFolderState mSavedFolderState;
178}; 180};
179 181
180LLFloaterTexturePicker::LLFloaterTexturePicker( 182LLFloaterTexturePicker::LLFloaterTexturePicker(
@@ -229,12 +231,16 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
229 filter_types |= 0x1 << LLInventoryType::IT_TEXTURE; 231 filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
230 filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT; 232 filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
231 233
232 mInventoryPanel->setAutoSelectOverride(true);
233 mInventoryPanel->setFilterTypes(filter_types); 234 mInventoryPanel->setFilterTypes(filter_types);
234 mInventoryPanel->setFilterPermMask(getFilterPermMask()); 235 //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss.
236 mInventoryPanel->setFilterPermMask(immediate_filter_perm_mask);
235 mInventoryPanel->setSelectCallback(onSelectionChange, this); 237 mInventoryPanel->setSelectCallback(onSelectionChange, this);
236 mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); 238 mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
237 mInventoryPanel->setAllowMultiSelect(FALSE); 239 mInventoryPanel->setAllowMultiSelect(FALSE);
240
241 // store this filter as the default one
242 mInventoryPanel->getRootFolder()->getFilter()->markDefault();
243
238 // Commented out to stop opening all folders with textures 244 // Commented out to stop opening all folders with textures
239 // mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE); 245 // mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE);
240 246
@@ -262,6 +268,8 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
262 updateFilterPermMask(); 268 updateFilterPermMask();
263 269
264 setCanMinimize(FALSE); 270 setCanMinimize(FALSE);
271
272 mSavedFolderState.setApply(FALSE);
265} 273}
266 274
267LLFloaterTexturePicker::~LLFloaterTexturePicker() 275LLFloaterTexturePicker::~LLFloaterTexturePicker()
@@ -315,7 +323,7 @@ void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b)
315 323
316void LLFloaterTexturePicker::stopUsingPipette() 324void LLFloaterTexturePicker::stopUsingPipette()
317{ 325{
318 if (gToolMgr && gToolMgr->getCurrentTool(gKeyboard->currentMask(TRUE)) == gToolPipette) 326 if (gToolMgr && gToolMgr->getCurrentTool() == gToolPipette)
319 { 327 {
320 gToolMgr->clearTransientTool(); 328 gToolMgr->clearTransientTool();
321 } 329 }
@@ -338,7 +346,8 @@ void LLFloaterTexturePicker::updateImageStats()
338 } 346 }
339 if (gAgent.isGodlike()) 347 if (gAgent.isGodlike())
340 { 348 {
341 LLString tstring = "Pick: " + mTexturep->getID().getString(); 349 LLString tstring = "Pick: ";
350 tstring.append(mTexturep->getID().asString());
342 setTitle(tstring); 351 setTitle(tstring);
343 } 352 }
344 } 353 }
@@ -368,7 +377,8 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
368 if (mod) item_perm_mask |= PERM_MODIFY; 377 if (mod) item_perm_mask |= PERM_MODIFY;
369 if (xfer) item_perm_mask |= PERM_TRANSFER; 378 if (xfer) item_perm_mask |= PERM_TRANSFER;
370 379
371 PermissionMask filter_perm_mask = getFilterPermMask(); 380 //PermissionMask filter_perm_mask = getFilterPermMask(); Commented out due to no-copy texture loss.
381 PermissionMask filter_perm_mask = mImmediateFilterPermMask;
372 if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask ) 382 if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
373 { 383 {
374 if (drop) 384 if (drop)
@@ -395,6 +405,41 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
395 return handled; 405 return handled;
396} 406}
397 407
408BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
409{
410 LLFolderView* root_folder = mInventoryPanel->getRootFolder();
411
412 if (!called_from_parent && root_folder &&
413 mSearchEdit && mSearchEdit->hasFocus() &&
414 (key == KEY_RETURN || key == KEY_DOWN) && mask == MASK_NONE)
415 {
416 if (!root_folder->getCurSelectedItem())
417 {
418 LLFolderViewItem* itemp = root_folder->getItemByID(gAgent.getInventoryRootID());
419 if (itemp)
420 {
421 root_folder->setSelection(itemp, FALSE, FALSE);
422 }
423 }
424 root_folder->scrollToShowSelection();
425
426 // move focus to inventory proper
427 root_folder->setFocus(TRUE);
428
429 // treat this as a user selection of the first filtered result
430 commitIfImmediateSet();
431
432 return TRUE;
433 }
434
435 if (root_folder->hasFocus() && key == KEY_UP)
436 {
437 mSearchEdit->focusFirstItem(TRUE);
438 }
439
440 return LLFloater::handleKeyHere(key, mask, called_from_parent);
441}
442
398// virtual 443// virtual
399void LLFloaterTexturePicker::onClose(bool app_quitting) 444void LLFloaterTexturePicker::onClose(bool app_quitting)
400{ 445{
@@ -469,7 +514,7 @@ void LLFloaterTexturePicker::draw()
469 childSetEnabled("show_folders_check", mActive && mCanApplyImmediately && !mNoCopyTextureSelected); 514 childSetEnabled("show_folders_check", mActive && mCanApplyImmediately && !mNoCopyTextureSelected);
470 childSetEnabled("Select", mActive); 515 childSetEnabled("Select", mActive);
471 childSetEnabled("Pipette", gToolMgr != NULL && mActive); 516 childSetEnabled("Pipette", gToolMgr != NULL && mActive);
472 childSetValue("Pipette", gToolMgr && gToolMgr->getCurrentTool(gKeyboard->currentMask(TRUE)) == gToolPipette); 517 childSetValue("Pipette", gToolMgr && gToolMgr->getCurrentTool() == gToolPipette);
473 518
474 //RN: reset search bar to reflect actual search query (all caps, for example) 519 //RN: reset search bar to reflect actual search query (all caps, for example)
475 mSearchEdit->setText(mInventoryPanel->getFilterSubString()); 520 mSearchEdit->setText(mInventoryPanel->getFilterSubString());
@@ -747,60 +792,43 @@ void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_da
747 792
748void LLFloaterTexturePicker::updateFilterPermMask() 793void LLFloaterTexturePicker::updateFilterPermMask()
749{ 794{
750 mInventoryPanel->setFilterPermMask( getFilterPermMask() ); 795 //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss.
751} 796}
752 797
753void LLFloaterTexturePicker::onSearchEdit(const LLString& search_string, void* user_data ) 798void LLFloaterTexturePicker::onSearchEdit(const LLString& search_string, void* user_data )
754{ 799{
755 LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data; 800 LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data;
756 801
757 std::string filter_text = search_string; 802 std::string upper_case_search_string = search_string;
758
759 if (filter_text.empty()&& picker->mInventoryPanel->getFilterSubString().empty())
760 {
761 // current filter and new filter empty, do nothing
762 return;
763 }
764 std::string upper_case_search_string = filter_text;
765 LLString::toUpper(upper_case_search_string); 803 LLString::toUpper(upper_case_search_string);
766 804
767 picker->mInventoryPanel->setFilterSubString(upper_case_search_string); 805 if (upper_case_search_string.empty())
768
769 LLFolderView* root_folder = picker->mInventoryPanel->getRootFolder();
770
771 //if (search_string.size())
772 //{
773 // LLSelectFirstFilteredItem filter;
774 // root_folder->applyFunctorRecursively(filter);
775 // //...and scroll to show it
776 // root_folder->scrollToShowSelection();
777 //}
778
779 KEY key = gKeyboard->currentKey();
780
781 if ((key == KEY_RETURN || key == KEY_DOWN) && gKeyboard->currentMask(FALSE) == MASK_NONE)
782 { 806 {
783 if (search_string.size()) 807 if (picker->mInventoryPanel->getFilterSubString().empty())
784 { 808 {
785 LLSelectFirstFilteredItem filter; 809 // current filter and new filter empty, do nothing
786 root_folder->applyFunctorRecursively(filter); 810 return;
787 //...and scroll to show it
788 root_folder->scrollToShowSelection();
789 } 811 }
790 812
791 if (!root_folder->getCurSelectedItem()) 813 picker->mSavedFolderState.setApply(TRUE);
814 picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(picker->mSavedFolderState);
815 // add folder with current item to list of previously opened folders
816 LLOpenFoldersWithSelection opener;
817 picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener);
818 picker->mInventoryPanel->getRootFolder()->scrollToShowSelection();
819
820 }
821 else if (picker->mInventoryPanel->getFilterSubString().empty())
822 {
823 // first letter in search term, save existing folder open state
824 if (!picker->mInventoryPanel->getRootFolder()->isFilterActive())
792 { 825 {
793 LLFolderViewItem* itemp = root_folder->getItemByID(gAgent.getInventoryRootID()); 826 picker->mSavedFolderState.setApply(FALSE);
794 if (itemp) 827 picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(picker->mSavedFolderState);
795 {
796 root_folder->setSelection(itemp, FALSE, FALSE);
797 }
798 } 828 }
799
800 // move focus to inventory proper
801 root_folder->setFocus(TRUE);
802 root_folder->scrollToShowSelection();
803 } 829 }
830
831 picker->mInventoryPanel->setFilterSubString(upper_case_search_string);
804} 832}
805 833
806//static 834//static
@@ -1039,7 +1067,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
1039 // Show the dialog 1067 // Show the dialog
1040 if( floaterp ) 1068 if( floaterp )
1041 { 1069 {
1042 floaterp->open( ); 1070 floaterp->open( ); /* Flawfinder: ignore */
1043 } 1071 }
1044 else 1072 else
1045 { 1073 {
@@ -1060,7 +1088,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
1060 mFloaterHandle = floaterp->getHandle(); 1088 mFloaterHandle = floaterp->getHandle();
1061 1089
1062 gFloaterView->getParentFloater(this)->addDependentFloater(floaterp); 1090 gFloaterView->getParentFloater(this)->addDependentFloater(floaterp);
1063 floaterp->open(); 1091 floaterp->open(); /* Flawfinder: ignore */
1064 } 1092 }
1065 1093
1066 if (take_focus) 1094 if (take_focus)
@@ -1270,8 +1298,9 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item)
1270 if (mod) item_perm_mask |= PERM_MODIFY; 1298 if (mod) item_perm_mask |= PERM_MODIFY;
1271 if (xfer) item_perm_mask |= PERM_TRANSFER; 1299 if (xfer) item_perm_mask |= PERM_TRANSFER;
1272 1300
1273 PermissionMask filter_perm_mask = mCanApplyImmediately ? 1301// PermissionMask filter_perm_mask = mCanApplyImmediately ? commented out due to no-copy texture loss.
1274 mImmediateFilterPermMask : mNonImmediateFilterPermMask; 1302// mImmediateFilterPermMask : mNonImmediateFilterPermMask;
1303 PermissionMask filter_perm_mask = mImmediateFilterPermMask;
1275 if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask ) 1304 if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
1276 { 1305 {
1277 if(mDragCallback) 1306 if(mDragCallback)