aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfolderview.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llfolderview.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llfolderview.cpp190
1 files changed, 91 insertions, 99 deletions
diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp
index 4833c12..4b487ce 100644
--- a/linden/indra/newview/llfolderview.cpp
+++ b/linden/indra/newview/llfolderview.cpp
@@ -118,7 +118,7 @@ LLColor4 LLFolderViewItem::sSuffixColor;
118LLColor4 LLFolderViewItem::sSearchStatusColor; 118LLColor4 LLFolderViewItem::sSearchStatusColor;
119 119
120// Default constructor 120// Default constructor
121LLFolderViewItem::LLFolderViewItem( const LLString& name, LLUIImagePtr icon, 121LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon,
122 S32 creation_date, 122 S32 creation_date,
123 LLFolderView* root, 123 LLFolderView* root,
124 LLFolderViewEventListener* listener ) : 124 LLFolderViewEventListener* listener ) :
@@ -137,7 +137,7 @@ LLFolderViewItem::LLFolderViewItem( const LLString& name, LLUIImagePtr icon,
137 mNumDescendantsSelected(0), 137 mNumDescendantsSelected(0),
138 mFiltered(FALSE), 138 mFiltered(FALSE),
139 mLastFilterGeneration(-1), 139 mLastFilterGeneration(-1),
140 mStringMatchOffset(LLString::npos), 140 mStringMatchOffset(std::string::npos),
141 mControlLabelRotation(0.f), 141 mControlLabelRotation(0.f),
142 mRoot( root ), 142 mRoot( root ),
143 mDragAndDropTarget(FALSE), 143 mDragAndDropTarget(FALSE),
@@ -280,10 +280,9 @@ void LLFolderViewItem::refresh()
280{ 280{
281 if(mListener) 281 if(mListener)
282 { 282 {
283 const char* label = mListener->getDisplayName().c_str(); 283 mLabel = mListener->getDisplayName();
284 mLabel = label ? label : "";
285 setIcon(mListener->getIcon()); 284 setIcon(mListener->getIcon());
286 U32 creation_date = mListener->getCreationDate(); 285 time_t creation_date = mListener->getCreationDate();
287 if (mCreationDate != creation_date) 286 if (mCreationDate != creation_date)
288 { 287 {
289 mCreationDate = mListener->getCreationDate(); 288 mCreationDate = mListener->getCreationDate();
@@ -292,9 +291,9 @@ void LLFolderViewItem::refresh()
292 mLabelStyle = mListener->getLabelStyle(); 291 mLabelStyle = mListener->getLabelStyle();
293 mLabelSuffix = mListener->getLabelSuffix(); 292 mLabelSuffix = mListener->getLabelSuffix();
294 293
295 LLString searchable_label(mLabel); 294 std::string searchable_label(mLabel);
296 searchable_label.append(mLabelSuffix); 295 searchable_label.append(mLabelSuffix);
297 LLString::toUpper(searchable_label); 296 LLStringUtil::toUpper(searchable_label);
298 297
299 if (mSearchableLabel.compare(searchable_label)) 298 if (mSearchableLabel.compare(searchable_label))
300 { 299 {
@@ -564,11 +563,11 @@ void LLFolderViewItem::preview( void )
564 } 563 }
565} 564}
566 565
567void LLFolderViewItem::rename(const LLString& new_name) 566void LLFolderViewItem::rename(const std::string& new_name)
568{ 567{
569 if( !new_name.empty() ) 568 if( !new_name.empty() )
570 { 569 {
571 mLabel = new_name.c_str(); 570 mLabel = new_name;
572 if( mListener ) 571 if( mListener )
573 { 572 {
574 mListener->renameItem(new_name); 573 mListener->renameItem(new_name);
@@ -581,12 +580,12 @@ void LLFolderViewItem::rename(const LLString& new_name)
581 } 580 }
582} 581}
583 582
584const LLString& LLFolderViewItem::getSearchableLabel() const 583const std::string& LLFolderViewItem::getSearchableLabel() const
585{ 584{
586 return mSearchableLabel; 585 return mSearchableLabel;
587} 586}
588 587
589const LLString& LLFolderViewItem::getName( void ) const 588const std::string& LLFolderViewItem::getName( void ) const
590{ 589{
591 if(mListener) 590 if(mListener)
592 { 591 {
@@ -610,7 +609,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
610{ 609{
611 // No handler needed for focus lost since this class has no 610 // No handler needed for focus lost since this class has no
612 // state that depends on it. 611 // state that depends on it.
613 gViewerWindow->setMouseCapture( this ); 612 gFocusMgr.setMouseCapture( this );
614 613
615 if (!mIsSelected) 614 if (!mIsSelected)
616 { 615 {
@@ -681,7 +680,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
681 // Release keyboard focus, so that if stuff is dropped into the 680 // Release keyboard focus, so that if stuff is dropped into the
682 // world, pressing the delete key won't blow away the inventory 681 // world, pressing the delete key won't blow away the inventory
683 // item. 682 // item.
684 gViewerWindow->setKeyboardFocus(NULL); 683 gFocusMgr.setKeyboardFocus(NULL);
685 684
686 return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); 685 return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask );
687 } 686 }
@@ -748,7 +747,7 @@ BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask )
748 if( hasMouseCapture() ) 747 if( hasMouseCapture() )
749 { 748 {
750 getRoot()->setShowSelectionContext(FALSE); 749 getRoot()->setShowSelectionContext(FALSE);
751 gViewerWindow->setMouseCapture( NULL ); 750 gFocusMgr.setMouseCapture( NULL );
752 } 751 }
753 return TRUE; 752 return TRUE;
754} 753}
@@ -757,7 +756,7 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
757 EDragAndDropType cargo_type, 756 EDragAndDropType cargo_type,
758 void* cargo_data, 757 void* cargo_data,
759 EAcceptance* accept, 758 EAcceptance* accept,
760 LLString& tooltip_msg) 759 std::string& tooltip_msg)
761{ 760{
762 BOOL accepted = FALSE; 761 BOOL accepted = FALSE;
763 BOOL handled = FALSE; 762 BOOL handled = FALSE;
@@ -922,7 +921,8 @@ void LLFolderViewItem::draw()
922 921
923 if ( mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime") ) 922 if ( mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime") )
924 { 923 {
925 sFont->renderUTF8( "Loading... ", 0, text_left, y, sSearchStatusColor, 924 // *TODO: Translate
925 sFont->renderUTF8( std::string("Loading... "), 0, text_left, y, sSearchStatusColor,
926 LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, S32_MAX, S32_MAX, &right_x, FALSE); 926 LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, S32_MAX, S32_MAX, &right_x, FALSE);
927 text_left = right_x; 927 text_left = right_x;
928 } 928 }
@@ -937,13 +937,13 @@ void LLFolderViewItem::draw()
937 S32_MAX, S32_MAX, &right_x, FALSE ); 937 S32_MAX, S32_MAX, &right_x, FALSE );
938 } 938 }
939 939
940 if (mBoxImage.notNull() && mStringMatchOffset != LLString::npos) 940 if (mBoxImage.notNull() && mStringMatchOffset != std::string::npos)
941 { 941 {
942 // don't draw backgrounds for zero-length strings 942 // don't draw backgrounds for zero-length strings
943 S32 filter_string_length = mRoot->getFilterSubString().size(); 943 S32 filter_string_length = mRoot->getFilterSubString().size();
944 if (filter_string_length > 0) 944 if (filter_string_length > 0)
945 { 945 {
946 LLString combined_string = mLabel + mLabelSuffix; 946 std::string combined_string = mLabel + mLabelSuffix;
947 S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1; 947 S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1;
948 S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; 948 S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2;
949 S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3); 949 S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3);
@@ -972,7 +972,7 @@ void LLFolderViewItem::draw()
972///---------------------------------------------------------------------------- 972///----------------------------------------------------------------------------
973 973
974// Default constructor 974// Default constructor
975LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLUIImagePtr icon, 975LLFolderViewFolder::LLFolderViewFolder( const std::string& name, LLUIImagePtr icon,
976 LLFolderView* root, 976 LLFolderView* root,
977 LLFolderViewEventListener* listener ): 977 LLFolderViewEventListener* listener ):
978 LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time 978 LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time
@@ -988,7 +988,7 @@ LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLUIImagePtr icon,
988 mCompletedFilterGeneration(-1), 988 mCompletedFilterGeneration(-1),
989 mMostFilteredDescendantGeneration(-1) 989 mMostFilteredDescendantGeneration(-1)
990{ 990{
991 mType = "(folder)"; 991 mType = std::string("(folder)");
992} 992}
993 993
994// Destroys the object 994// Destroys the object
@@ -1733,7 +1733,7 @@ void LLFolderViewFolder::sortBy(U32 order)
1733 1733
1734 if (order & LLInventoryFilter::SO_DATE) 1734 if (order & LLInventoryFilter::SO_DATE)
1735 { 1735 {
1736 U32 latest = 0; 1736 time_t latest = 0;
1737 1737
1738 if (!mItems.empty()) 1738 if (!mItems.empty())
1739 { 1739 {
@@ -1958,7 +1958,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask,
1958 EDragAndDropType c_type, 1958 EDragAndDropType c_type,
1959 void* cargo_data, 1959 void* cargo_data,
1960 EAcceptance* accept, 1960 EAcceptance* accept,
1961 LLString& tooltip_msg) 1961 std::string& tooltip_msg)
1962{ 1962{
1963 BOOL accepted = mListener && mListener->dragOrDrop(mask,drop,c_type,cargo_data); 1963 BOOL accepted = mListener && mListener->dragOrDrop(mask,drop,c_type,cargo_data);
1964 if (accepted) 1964 if (accepted)
@@ -2023,7 +2023,7 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask,
2023 EDragAndDropType cargo_type, 2023 EDragAndDropType cargo_type,
2024 void* cargo_data, 2024 void* cargo_data,
2025 EAcceptance* accept, 2025 EAcceptance* accept,
2026 LLString& tooltip_msg) 2026 std::string& tooltip_msg)
2027{ 2027{
2028 LLFolderView* root_view = getRoot(); 2028 LLFolderView* root_view = getRoot();
2029 2029
@@ -2191,9 +2191,9 @@ void LLFolderViewFolder::draw()
2191 mExpanderHighlighted = FALSE; 2191 mExpanderHighlighted = FALSE;
2192} 2192}
2193 2193
2194U32 LLFolderViewFolder::getCreationDate() const 2194time_t LLFolderViewFolder::getCreationDate() const
2195{ 2195{
2196 return llmax<U32>(mCreationDate, mSubtreeCreationDate); 2196 return llmax<time_t>(mCreationDate, mSubtreeCreationDate);
2197} 2197}
2198 2198
2199 2199
@@ -2487,7 +2487,7 @@ void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item)
2487///---------------------------------------------------------------------------- 2487///----------------------------------------------------------------------------
2488 2488
2489// Default constructor 2489// Default constructor
2490LLFolderView::LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon, 2490LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_icon,
2491 const LLRect& rect, const LLUUID& source_id, LLView *parent_view ) : 2491 const LLRect& rect, const LLUUID& source_id, LLView *parent_view ) :
2492#if LL_WINDOWS 2492#if LL_WINDOWS
2493#pragma warning( push ) 2493#pragma warning( push )
@@ -2534,9 +2534,9 @@ LLFolderView::LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon,
2534 //clear label 2534 //clear label
2535 // go ahead and render root folder as usual 2535 // go ahead and render root folder as usual
2536 // just make sure the label ("Inventory Folder") never shows up 2536 // just make sure the label ("Inventory Folder") never shows up
2537 mLabel = LLString::null; 2537 mLabel = LLStringUtil::null;
2538 2538
2539 mRenamer = new LLLineEditor("ren", getRect(), "", sFont, 2539 mRenamer = new LLLineEditor(std::string("ren"), getRect(), LLStringUtil::null, sFont,
2540 DB_INV_ITEM_NAME_STR_LEN, 2540 DB_INV_ITEM_NAME_STR_LEN,
2541 &LLFolderView::commitRename, 2541 &LLFolderView::commitRename,
2542 NULL, 2542 NULL,
@@ -2553,7 +2553,7 @@ LLFolderView::LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon,
2553 LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_inventory.xml", parent_view); 2553 LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_inventory.xml", parent_view);
2554 if (!menu) 2554 if (!menu)
2555 { 2555 {
2556 menu = new LLMenuGL(""); 2556 menu = new LLMenuGL(LLStringUtil::null);
2557 } 2557 }
2558 menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); 2558 menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor"));
2559 menu->setVisible(FALSE); 2559 menu->setVisible(FALSE);
@@ -2585,9 +2585,9 @@ LLFolderView::~LLFolderView( void )
2585 2585
2586 LLView::deleteViewByHandle(mPopupMenuHandle); 2586 LLView::deleteViewByHandle(mPopupMenuHandle);
2587 2587
2588 if(gViewerWindow->hasTopCtrl(mRenamer)) 2588 if(mRenamer == gFocusMgr.getTopCtrl())
2589 { 2589 {
2590 gViewerWindow->setTopCtrl(NULL); 2590 gFocusMgr.setTopCtrl(NULL);
2591 } 2591 }
2592 2592
2593 mAutoOpenItems.removeAllNodes(); 2593 mAutoOpenItems.removeAllNodes();
@@ -2665,7 +2665,7 @@ void LLFolderView::closeAllFolders()
2665 setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); 2665 setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN);
2666} 2666}
2667 2667
2668void LLFolderView::openFolder(const LLString& foldername) 2668void LLFolderView::openFolder(const std::string& foldername)
2669{ 2669{
2670 LLFolderViewFolder* inv = getChild<LLFolderViewFolder>(foldername); 2670 LLFolderViewFolder* inv = getChild<LLFolderViewFolder>(foldername);
2671 if (inv) 2671 if (inv)
@@ -2771,7 +2771,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen
2771 return llround(mTargetHeight); 2771 return llround(mTargetHeight);
2772} 2772}
2773 2773
2774const LLString LLFolderView::getFilterSubString(BOOL trim) 2774const std::string LLFolderView::getFilterSubString(BOOL trim)
2775{ 2775{
2776 return mFilter.getFilterSubString(trim); 2776 return mFilter.getFilterSubString(trim);
2777} 2777}
@@ -3119,7 +3119,7 @@ void LLFolderView::draw()
3119{ 3119{
3120 if (mDebugFilters) 3120 if (mDebugFilters)
3121 { 3121 {
3122 LLString current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", 3122 std::string current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d",
3123 mFilter.getCurrentGeneration(), mFilter.getMinRequiredGeneration(), mFilter.getMustPassGeneration()); 3123 mFilter.getCurrentGeneration(), mFilter.getMinRequiredGeneration(), mFilter.getMustPassGeneration());
3124 sSmallFont->renderUTF8(current_filter_string, 0, 2, 3124 sSmallFont->renderUTF8(current_filter_string, 0, 2,
3125 getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), 3125 getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f),
@@ -3132,9 +3132,9 @@ void LLFolderView::draw()
3132 { 3132 {
3133 closeAutoOpenedFolders(); 3133 closeAutoOpenedFolders();
3134 } 3134 }
3135 if(gViewerWindow->hasKeyboardFocus(this) && !getVisible()) 3135 if(this == gFocusMgr.getKeyboardFocus() && !getVisible())
3136 { 3136 {
3137 gViewerWindow->setKeyboardFocus( NULL ); 3137 gFocusMgr.setKeyboardFocus( NULL );
3138 } 3138 }
3139 3139
3140 // while dragging, update selection rendering to reflect single/multi drag status 3140 // while dragging, update selection rendering to reflect single/multi drag status
@@ -3169,12 +3169,12 @@ void LLFolderView::draw()
3169 { 3169 {
3170 if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter.getMinRequiredGeneration()) 3170 if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter.getMinRequiredGeneration())
3171 { 3171 {
3172 mStatusText = "Searching..."; // *TODO:translate 3172 mStatusText = std::string("Searching..."); // *TODO:translate
3173 sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); 3173 sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE );
3174 } 3174 }
3175 else 3175 else
3176 { 3176 {
3177 mStatusText = "No matching items found in inventory."; // *TODO:translate 3177 mStatusText = std::string("No matching items found in inventory."); // *TODO:translate
3178 sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); 3178 sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE );
3179 } 3179 }
3180 } 3180 }
@@ -3192,14 +3192,14 @@ void LLFolderView::finishRenamingItem( void )
3192 } 3192 }
3193 if( mRenameItem ) 3193 if( mRenameItem )
3194 { 3194 {
3195 mRenameItem->rename( mRenamer->getText().c_str() ); 3195 mRenameItem->rename( mRenamer->getText() );
3196 } 3196 }
3197 3197
3198 mRenamer->setCommitOnFocusLost( FALSE ); 3198 mRenamer->setCommitOnFocusLost( FALSE );
3199 mRenamer->setFocus( FALSE ); 3199 mRenamer->setFocus( FALSE );
3200 mRenamer->setVisible( FALSE ); 3200 mRenamer->setVisible( FALSE );
3201 mRenamer->setCommitOnFocusLost( TRUE ); 3201 mRenamer->setCommitOnFocusLost( TRUE );
3202 gViewerWindow->setTopCtrl( NULL ); 3202 gFocusMgr.setTopCtrl( NULL );
3203 3203
3204 if( mRenameItem ) 3204 if( mRenameItem )
3205 { 3205 {
@@ -3211,13 +3211,12 @@ void LLFolderView::finishRenamingItem( void )
3211 scrollToShowSelection(); 3211 scrollToShowSelection();
3212} 3212}
3213 3213
3214void LLFolderView::revertRenamingItem( void ) 3214void LLFolderView::closeRenamer( void )
3215{ 3215{
3216 mRenamer->setCommitOnFocusLost( FALSE ); 3216 // will commit current name (which could be same as original name)
3217 mRenamer->setFocus( FALSE ); 3217 mRenamer->setFocus( FALSE );
3218 mRenamer->setVisible( FALSE ); 3218 mRenamer->setVisible( FALSE );
3219 mRenamer->setCommitOnFocusLost( TRUE ); 3219 gFocusMgr.setTopCtrl( NULL );
3220 gViewerWindow->setTopCtrl( NULL );
3221 3220
3222 if( mRenameItem ) 3221 if( mRenameItem )
3223 { 3222 {
@@ -3274,11 +3273,11 @@ void LLFolderView::removeSelectedItems( void )
3274 // change selection on successful delete 3273 // change selection on successful delete
3275 if (new_selection) 3274 if (new_selection)
3276 { 3275 {
3277 setSelectionFromRoot(new_selection, new_selection->isOpen(), gViewerWindow->childHasKeyboardFocus(this)); 3276 setSelectionFromRoot(new_selection, new_selection->isOpen(), gFocusMgr.childHasKeyboardFocus(this));
3278 } 3277 }
3279 else 3278 else
3280 { 3279 {
3281 setSelectionFromRoot(NULL, gViewerWindow->childHasKeyboardFocus(this)); 3280 setSelectionFromRoot(NULL, gFocusMgr.childHasKeyboardFocus(this));
3282 } 3281 }
3283 } 3282 }
3284 } 3283 }
@@ -3304,11 +3303,11 @@ void LLFolderView::removeSelectedItems( void )
3304 } 3303 }
3305 if (new_selection) 3304 if (new_selection)
3306 { 3305 {
3307 setSelectionFromRoot(new_selection, new_selection->isOpen(), gViewerWindow->childHasKeyboardFocus(this)); 3306 setSelectionFromRoot(new_selection, new_selection->isOpen(), gFocusMgr.childHasKeyboardFocus(this));
3308 } 3307 }
3309 else 3308 else
3310 { 3309 {
3311 setSelectionFromRoot(NULL, gViewerWindow->childHasKeyboardFocus(this)); 3310 setSelectionFromRoot(NULL, gFocusMgr.childHasKeyboardFocus(this));
3312 } 3311 }
3313 3312
3314 for(S32 i = 0; i < count; ++i) 3313 for(S32 i = 0; i < count; ++i)
@@ -3626,7 +3625,7 @@ void LLFolderView::startRenamingSelectedItem( void )
3626 // set focus will fail unless item is visible 3625 // set focus will fail unless item is visible
3627 mRenamer->setFocus( TRUE ); 3626 mRenamer->setFocus( TRUE );
3628 mRenamer->setLostTopCallback(onRenamerLost); 3627 mRenamer->setLostTopCallback(onRenamerLost);
3629 gViewerWindow->setTopCtrl( mRenamer ); 3628 gFocusMgr.setTopCtrl( mRenamer );
3630 } 3629 }
3631} 3630}
3632 3631
@@ -3687,19 +3686,11 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
3687 break; 3686 break;
3688 3687
3689 case KEY_ESCAPE: 3688 case KEY_ESCAPE:
3690 // mark flag don't commit
3691 if( mRenameItem && mRenamer->getVisible() ) 3689 if( mRenameItem && mRenamer->getVisible() )
3692 { 3690 {
3693 revertRenamingItem(); 3691 closeRenamer();
3694 handled = TRUE; 3692 handled = TRUE;
3695 } 3693 }
3696 else
3697 {
3698 if( gViewerWindow->childHasKeyboardFocus( this ) )
3699 {
3700 gViewerWindow->setKeyboardFocus( NULL );
3701 }
3702 }
3703 mSearchString.clear(); 3694 mSearchString.clear();
3704 break; 3695 break;
3705 3696
@@ -3862,7 +3853,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
3862 { 3853 {
3863 mSearchString.erase(mSearchString.size() - 1, 1); 3854 mSearchString.erase(mSearchString.size() - 1, 1);
3864 } 3855 }
3865 search(getCurSelectedItem(), mSearchString.c_str(), FALSE); 3856 search(getCurSelectedItem(), mSearchString, FALSE);
3866 handled = TRUE; 3857 handled = TRUE;
3867 } 3858 }
3868 } 3859 }
@@ -3905,7 +3896,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char)
3905 { 3896 {
3906 mSearchString += uni_char; 3897 mSearchString += uni_char;
3907 } 3898 }
3908 search(getCurSelectedItem(), mSearchString.c_str(), FALSE); 3899 search(getCurSelectedItem(), mSearchString, FALSE);
3909 3900
3910 handled = TRUE; 3901 handled = TRUE;
3911 } 3902 }
@@ -3956,14 +3947,14 @@ void LLFolderView::onFocusLost( )
3956 LLUICtrl::onFocusLost(); 3947 LLUICtrl::onFocusLost();
3957} 3948}
3958 3949
3959BOOL LLFolderView::search(LLFolderViewItem* first_item, const LLString &search_string, BOOL backward) 3950BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward)
3960{ 3951{
3961 // get first selected item 3952 // get first selected item
3962 LLFolderViewItem* search_item = first_item; 3953 LLFolderViewItem* search_item = first_item;
3963 3954
3964 // make sure search string is upper case 3955 // make sure search string is upper case
3965 LLString upper_case_string = search_string; 3956 std::string upper_case_string = search_string;
3966 LLString::toUpper(upper_case_string); 3957 LLStringUtil::toUpper(upper_case_string);
3967 3958
3968 // if nothing selected, select first item in folder 3959 // if nothing selected, select first item in folder
3969 if (!search_item) 3960 if (!search_item)
@@ -3994,7 +3985,7 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const LLString &search_s
3994 } 3985 }
3995 } 3986 }
3996 3987
3997 const LLString current_item_label(search_item->getSearchableLabel()); 3988 const std::string current_item_label(search_item->getSearchableLabel());
3998 S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); 3989 S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size());
3999 if (!current_item_label.compare(0, search_string_length, upper_case_string)) 3990 if (!current_item_label.compare(0, search_string_length, upper_case_string))
4000 { 3991 {
@@ -4082,7 +4073,7 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
4082 EDragAndDropType cargo_type, 4073 EDragAndDropType cargo_type,
4083 void* cargo_data, 4074 void* cargo_data,
4084 EAcceptance* accept, 4075 EAcceptance* accept,
4085 LLString& tooltip_msg) 4076 std::string& tooltip_msg)
4086{ 4077{
4087 mDragAndDropThisFrame = TRUE; 4078 mDragAndDropThisFrame = TRUE;
4088 BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, 4079 BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data,
@@ -4107,9 +4098,9 @@ BOOL LLFolderView::handleScrollWheel(S32 x, S32 y, S32 clicks)
4107 4098
4108void LLFolderView::deleteAllChildren() 4099void LLFolderView::deleteAllChildren()
4109{ 4100{
4110 if(gViewerWindow->hasTopCtrl(mRenamer)) 4101 if(mRenamer == gFocusMgr.getTopCtrl())
4111 { 4102 {
4112 gViewerWindow->setTopCtrl(NULL); 4103 gFocusMgr.setTopCtrl(NULL);
4113 } 4104 }
4114 LLView::deleteViewByHandle(mPopupMenuHandle); 4105 LLView::deleteViewByHandle(mPopupMenuHandle);
4115 mPopupMenuHandle = LLHandle<LLView>(); 4106 mPopupMenuHandle = LLHandle<LLView>();
@@ -4374,7 +4365,7 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde
4374 4365
4375 if (by_name) 4366 if (by_name)
4376 { 4367 {
4377 S32 compare = LLString::compareDict(a->getLabel(), b->getLabel()); 4368 S32 compare = LLStringUtil::compareDict(a->getLabel(), b->getLabel());
4378 if (0 == compare) 4369 if (0 == compare)
4379 { 4370 {
4380 return (a->getCreationDate() > b->getCreationDate()); 4371 return (a->getCreationDate() > b->getCreationDate());
@@ -4388,11 +4379,11 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde
4388 { 4379 {
4389 // BUG: This is very very slow. The getCreationDate() is log n in number 4380 // BUG: This is very very slow. The getCreationDate() is log n in number
4390 // of inventory items. 4381 // of inventory items.
4391 U32 first_create = a->getCreationDate(); 4382 time_t first_create = a->getCreationDate();
4392 U32 second_create = b->getCreationDate(); 4383 time_t second_create = b->getCreationDate();
4393 if (first_create == second_create) 4384 if (first_create == second_create)
4394 { 4385 {
4395 return (LLString::compareDict(a->getLabel(), b->getLabel()) < 0); 4386 return (LLStringUtil::compareDict(a->getLabel(), b->getLabel()) < 0);
4396 } 4387 }
4397 else 4388 else
4398 { 4389 {
@@ -4477,14 +4468,14 @@ void LLFolderViewEventListener::arrangeAndSet(LLFolderViewItem* focus,
4477///---------------------------------------------------------------------------- 4468///----------------------------------------------------------------------------
4478/// Class LLInventoryFilter 4469/// Class LLInventoryFilter
4479///---------------------------------------------------------------------------- 4470///----------------------------------------------------------------------------
4480LLInventoryFilter::LLInventoryFilter(const LLString& name) : 4471LLInventoryFilter::LLInventoryFilter(const std::string& name) :
4481 mName(name), 4472 mName(name),
4482 mModified(FALSE), 4473 mModified(FALSE),
4483 mNeedTextRebuild(TRUE) 4474 mNeedTextRebuild(TRUE)
4484{ 4475{
4485 mFilterOps.mFilterTypes = 0xffffffff; 4476 mFilterOps.mFilterTypes = 0xffffffff;
4486 mFilterOps.mMinDate = 0; 4477 mFilterOps.mMinDate = time_min();
4487 mFilterOps.mMaxDate = U32_MAX; 4478 mFilterOps.mMaxDate = time_max();
4488 mFilterOps.mHoursAgo = 0; 4479 mFilterOps.mHoursAgo = 0;
4489 mFilterOps.mShowFolderState = SHOW_NON_EMPTY_FOLDERS; 4480 mFilterOps.mShowFolderState = SHOW_NON_EMPTY_FOLDERS;
4490 mFilterOps.mPermissions = PERM_NONE; 4481 mFilterOps.mPermissions = PERM_NONE;
@@ -4492,7 +4483,7 @@ LLInventoryFilter::LLInventoryFilter(const LLString& name) :
4492 mOrder = SO_FOLDERS_BY_NAME; // This gets overridden by a pref immediately 4483 mOrder = SO_FOLDERS_BY_NAME; // This gets overridden by a pref immediately
4493 4484
4494 mSubStringMatchOffset = 0; 4485 mSubStringMatchOffset = 0;
4495 mFilterSubString = ""; 4486 mFilterSubString.clear();
4496 mFilterGeneration = 0; 4487 mFilterGeneration = 0;
4497 mMustPassGeneration = S32_MAX; 4488 mMustPassGeneration = S32_MAX;
4498 mMinRequiredGeneration = 0; 4489 mMinRequiredGeneration = 0;
@@ -4512,10 +4503,10 @@ LLInventoryFilter::~LLInventoryFilter()
4512 4503
4513BOOL LLInventoryFilter::check(LLFolderViewItem* item) 4504BOOL LLInventoryFilter::check(LLFolderViewItem* item)
4514{ 4505{
4515 U32 earliest; 4506 time_t earliest;
4516 4507
4517 earliest = time_corrected() - mFilterOps.mHoursAgo * 3600; 4508 earliest = time_corrected() - mFilterOps.mHoursAgo * 3600;
4518 if (mFilterOps.mMinDate && mFilterOps.mMinDate < earliest) 4509 if (mFilterOps.mMinDate > time_min() && mFilterOps.mMinDate < earliest)
4519 { 4510 {
4520 earliest = mFilterOps.mMinDate; 4511 earliest = mFilterOps.mMinDate;
4521 } 4512 }
@@ -4524,15 +4515,15 @@ BOOL LLInventoryFilter::check(LLFolderViewItem* item)
4524 earliest = 0; 4515 earliest = 0;
4525 } 4516 }
4526 LLFolderViewEventListener* listener = item->getListener(); 4517 LLFolderViewEventListener* listener = item->getListener();
4527 mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : LLString::npos; 4518 mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos;
4528 BOOL passed = (0x1 << listener->getInventoryType() & mFilterOps.mFilterTypes || listener->getInventoryType() == LLInventoryType::IT_NONE) 4519 BOOL passed = (0x1 << listener->getInventoryType() & mFilterOps.mFilterTypes || listener->getInventoryType() == LLInventoryType::IT_NONE)
4529 && (mFilterSubString.size() == 0 || mSubStringMatchOffset != LLString::npos) 4520 && (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos)
4530 && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions) 4521 && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions)
4531 && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate); 4522 && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate);
4532 return passed; 4523 return passed;
4533} 4524}
4534 4525
4535const LLString LLInventoryFilter::getFilterSubString(BOOL trim) 4526const std::string LLInventoryFilter::getFilterSubString(BOOL trim)
4536{ 4527{
4537 return mFilterSubString; 4528 return mFilterSubString;
4538} 4529}
@@ -4558,8 +4549,8 @@ BOOL LLInventoryFilter::isActive()
4558 return mFilterOps.mFilterTypes != 0xffffffff 4549 return mFilterOps.mFilterTypes != 0xffffffff
4559 || mFilterSubString.size() 4550 || mFilterSubString.size()
4560 || mFilterOps.mPermissions != PERM_NONE 4551 || mFilterOps.mPermissions != PERM_NONE
4561 || mFilterOps.mMinDate != 0 4552 || mFilterOps.mMinDate != time_min()
4562 || mFilterOps.mMaxDate != U32_MAX 4553 || mFilterOps.mMaxDate != time_max()
4563 || mFilterOps.mHoursAgo != 0; 4554 || mFilterOps.mHoursAgo != 0;
4564} 4555}
4565 4556
@@ -4603,7 +4594,7 @@ void LLInventoryFilter::setFilterTypes(U32 types)
4603 } 4594 }
4604} 4595}
4605 4596
4606void LLInventoryFilter::setFilterSubString(const LLString& string) 4597void LLInventoryFilter::setFilterSubString(const std::string& string)
4607{ 4598{
4608 if (mFilterSubString != string) 4599 if (mFilterSubString != string)
4609 { 4600 {
@@ -4612,8 +4603,8 @@ void LLInventoryFilter::setFilterSubString(const LLString& string)
4612 // appending new characters 4603 // appending new characters
4613 BOOL more_restrictive = mFilterSubString.size() < string.size() && !string.substr(0, mFilterSubString.size()).compare(mFilterSubString); 4604 BOOL more_restrictive = mFilterSubString.size() < string.size() && !string.substr(0, mFilterSubString.size()).compare(mFilterSubString);
4614 mFilterSubString = string; 4605 mFilterSubString = string;
4615 LLString::toUpper(mFilterSubString); 4606 LLStringUtil::toUpper(mFilterSubString);
4616 LLString::trimHead(mFilterSubString); 4607 LLStringUtil::trimHead(mFilterSubString);
4617 4608
4618 if (less_restrictive) 4609 if (less_restrictive)
4619 { 4610 {
@@ -4655,7 +4646,7 @@ void LLInventoryFilter::setFilterPermissions(PermissionMask perms)
4655 } 4646 }
4656} 4647}
4657 4648
4658void LLInventoryFilter::setDateRange(U32 min_date, U32 max_date) 4649void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date)
4659{ 4650{
4660 mFilterOps.mHoursAgo = 0; 4651 mFilterOps.mHoursAgo = 0;
4661 if (mFilterOps.mMinDate != min_date) 4652 if (mFilterOps.mMinDate != min_date)
@@ -4674,19 +4665,20 @@ void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl)
4674{ 4665{
4675 if (sl && !isSinceLogoff()) 4666 if (sl && !isSinceLogoff())
4676 { 4667 {
4677 setDateRange(mLastLogoff, U32_MAX); 4668 setDateRange(mLastLogoff, time_max());
4678 setModified(); 4669 setModified();
4679 } 4670 }
4680 if (!sl && isSinceLogoff()) 4671 if (!sl && isSinceLogoff())
4681 { 4672 {
4682 setDateRange(0, U32_MAX); 4673 setDateRange(0, time_max());
4683 setModified(); 4674 setModified();
4684 } 4675 }
4685} 4676}
4686 4677
4687BOOL LLInventoryFilter::isSinceLogoff() 4678BOOL LLInventoryFilter::isSinceLogoff()
4688{ 4679{
4689 return (mFilterOps.mMinDate == mLastLogoff) && (mFilterOps.mMaxDate == U32_MAX); 4680 return (mFilterOps.mMinDate == mLastLogoff) &&
4681 (mFilterOps.mMaxDate == time_max());
4690} 4682}
4691 4683
4692void LLInventoryFilter::setHoursAgo(U32 hours) 4684void LLInventoryFilter::setHoursAgo(U32 hours)
@@ -4694,11 +4686,11 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
4694 if (mFilterOps.mHoursAgo != hours) 4686 if (mFilterOps.mHoursAgo != hours)
4695 { 4687 {
4696 // *NOTE: need to cache last filter time, in case filter goes stale 4688 // *NOTE: need to cache last filter time, in case filter goes stale
4697 BOOL less_restrictive = (mFilterOps.mMinDate == 0 && mFilterOps.mMaxDate == U32_MAX && hours > mFilterOps.mHoursAgo); 4689 BOOL less_restrictive = (mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max() && hours > mFilterOps.mHoursAgo);
4698 BOOL more_restrictive = (mFilterOps.mMinDate == 0 && mFilterOps.mMaxDate == U32_MAX && hours <= mFilterOps.mHoursAgo); 4690 BOOL more_restrictive = (mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max() && hours <= mFilterOps.mHoursAgo);
4699 mFilterOps.mHoursAgo = hours; 4691 mFilterOps.mHoursAgo = hours;
4700 mFilterOps.mMinDate = 0; 4692 mFilterOps.mMinDate = time_min();
4701 mFilterOps.mMaxDate = U32_MAX; 4693 mFilterOps.mMaxDate = time_max();
4702 if (less_restrictive) 4694 if (less_restrictive)
4703 { 4695 {
4704 setModified(FILTER_LESS_RESTRICTIVE); 4696 setModified(FILTER_LESS_RESTRICTIVE);
@@ -4807,7 +4799,7 @@ BOOL LLInventoryFilter::isFilterWith(LLInventoryType::EType t)
4807 return mFilterOps.mFilterTypes & (0x01 << t); 4799 return mFilterOps.mFilterTypes & (0x01 << t);
4808} 4800}
4809 4801
4810LLString LLInventoryFilter::getFilterText() 4802std::string LLInventoryFilter::getFilterText()
4811{ 4803{
4812 if (!mNeedTextRebuild) 4804 if (!mNeedTextRebuild)
4813 { 4805 {
@@ -4815,12 +4807,12 @@ LLString LLInventoryFilter::getFilterText()
4815 } 4807 }
4816 4808
4817 mNeedTextRebuild = FALSE; 4809 mNeedTextRebuild = FALSE;
4818 LLString filtered_types; 4810 std::string filtered_types;
4819 LLString not_filtered_types; 4811 std::string not_filtered_types;
4820 BOOL filtered_by_type = FALSE; 4812 BOOL filtered_by_type = FALSE;
4821 BOOL filtered_by_all_types = TRUE; 4813 BOOL filtered_by_all_types = TRUE;
4822 S32 num_filter_types = 0; 4814 S32 num_filter_types = 0;
4823 mFilterText = ""; 4815 mFilterText.clear();
4824 4816
4825 if (isFilterWith(LLInventoryType::IT_ANIMATION)) 4817 if (isFilterWith(LLInventoryType::IT_ANIMATION))
4826 { 4818 {
@@ -4999,7 +4991,7 @@ void LLInventoryFilter::fromLLSD(LLSD& data)
4999 4991
5000 if(data.has("min_date") && data.has("max_date")) 4992 if(data.has("min_date") && data.has("max_date"))
5001 { 4993 {
5002 setDateRange((U32)data["min_date"].asInteger(), (U32)data["max_date"].asInteger()); 4994 setDateRange(data["min_date"].asInteger(), data["max_date"].asInteger());
5003 } 4995 }
5004 4996
5005 if(data.has("hours_ago")) 4997 if(data.has("hours_ago"))
@@ -5019,7 +5011,7 @@ void LLInventoryFilter::fromLLSD(LLSD& data)
5019 5011
5020 if(data.has("substring")) 5012 if(data.has("substring"))
5021 { 5013 {
5022 setFilterSubString(LLString(data["substring"].asString())); 5014 setFilterSubString(std::string(data["substring"].asString()));
5023 } 5015 }
5024 5016
5025 if(data.has("sort_order")) 5017 if(data.has("sort_order"))