aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfolderview.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llfolderview.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llfolderview.cpp')
-rw-r--r--linden/indra/newview/llfolderview.cpp446
1 files changed, 196 insertions, 250 deletions
diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp
index 9c59c7b..49ca5e4 100644
--- a/linden/indra/newview/llfolderview.cpp
+++ b/linden/indra/newview/llfolderview.cpp
@@ -58,7 +58,7 @@
58#include "llviewerimagelist.h" 58#include "llviewerimagelist.h"
59#include "llviewerjointattachment.h" 59#include "llviewerjointattachment.h"
60#include "llviewermenu.h" 60#include "llviewermenu.h"
61#include "llvieweruictrlfactory.h" 61#include "lluictrlfactory.h"
62#include "llviewerwindow.h" 62#include "llviewerwindow.h"
63#include "llvoavatar.h" 63#include "llvoavatar.h"
64#include "llfloaterproperties.h" 64#include "llfloaterproperties.h"
@@ -114,10 +114,11 @@ LLColor4 LLFolderViewItem::sHighlightBgColor;
114LLColor4 LLFolderViewItem::sHighlightFgColor; 114LLColor4 LLFolderViewItem::sHighlightFgColor;
115LLColor4 LLFolderViewItem::sFilterBGColor; 115LLColor4 LLFolderViewItem::sFilterBGColor;
116LLColor4 LLFolderViewItem::sFilterTextColor; 116LLColor4 LLFolderViewItem::sFilterTextColor;
117LLColor4 LLFolderViewItem::sLoadingMessageTextColor; 117LLColor4 LLFolderViewItem::sSuffixColor;
118LLColor4 LLFolderViewItem::sSearchStatusColor;
118 119
119// Default constructor 120// Default constructor
120LLFolderViewItem::LLFolderViewItem( const LLString& name, LLViewerImage* icon, 121LLFolderViewItem::LLFolderViewItem( const LLString& name, LLUIImagePtr icon,
121 S32 creation_date, 122 S32 creation_date,
122 LLFolderView* root, 123 LLFolderView* root,
123 LLFolderViewEventListener* listener ) : 124 LLFolderViewEventListener* listener ) :
@@ -145,12 +146,12 @@ LLFolderViewItem::LLFolderViewItem( const LLString& name, LLViewerImage* icon,
145 setIcon(icon); 146 setIcon(icon);
146 if( !LLFolderViewItem::sFont ) 147 if( !LLFolderViewItem::sFont )
147 { 148 {
148 LLFolderViewItem::sFont = gResMgr->getRes( LLFONT_SANSSERIF_SMALL ); 149 LLFolderViewItem::sFont = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
149 } 150 }
150 151
151 if (!LLFolderViewItem::sSmallFont) 152 if (!LLFolderViewItem::sSmallFont)
152 { 153 {
153 LLFolderViewItem::sSmallFont = gResMgr->getRes( LLFONT_SMALL ); 154 LLFolderViewItem::sSmallFont = LLResMgr::getInstance()->getRes( LLFONT_SMALL );
154 } 155 }
155 156
156 // HACK: Can't be set above because gSavedSettings might not be constructed. 157 // HACK: Can't be set above because gSavedSettings might not be constructed.
@@ -159,10 +160,12 @@ LLFolderViewItem::LLFolderViewItem( const LLString& name, LLViewerImage* icon,
159 LLFolderViewItem::sHighlightFgColor = gColors.getColor( "MenuItemHighlightFgColor" ); 160 LLFolderViewItem::sHighlightFgColor = gColors.getColor( "MenuItemHighlightFgColor" );
160 LLFolderViewItem::sFilterBGColor = gColors.getColor( "FilterBackgroundColor" ); 161 LLFolderViewItem::sFilterBGColor = gColors.getColor( "FilterBackgroundColor" );
161 LLFolderViewItem::sFilterTextColor = gColors.getColor( "FilterTextColor" ); 162 LLFolderViewItem::sFilterTextColor = gColors.getColor( "FilterTextColor" );
162 LLFolderViewItem::sLoadingMessageTextColor = gColors.getColor( "FolderViewLoadingMessageTextColor" ); 163 LLFolderViewItem::sSuffixColor = gColors.getColor( "InventoryItemSuffixColor" );
164 LLFolderViewItem::sSearchStatusColor = gColors.getColor( "InventorySearchStatusColor" );
163 165
164 mArrowImage = gImageList.getImage(LLUUID(gViewerArt.getString("folder_arrow.tga")), MIPMAP_FALSE, TRUE); 166
165 mBoxImage = gImageList.getImage(LLUUID(gViewerArt.getString("rounded_square.tga")), MIPMAP_FALSE, TRUE); 167 mArrowImage = LLUI::getUIImage("folder_arrow.tga");
168 mBoxImage = LLUI::getUIImage("rounded_square.tga");
166 169
167 refresh(); 170 refresh();
168 setTabStop(FALSE); 171 setTabStop(FALSE);
@@ -267,13 +270,9 @@ void LLFolderViewItem::setFiltered(BOOL filtered, S32 filter_generation)
267 mLastFilterGeneration = filter_generation; 270 mLastFilterGeneration = filter_generation;
268} 271}
269 272
270void LLFolderViewItem::setIcon(LLViewerImage* icon) 273void LLFolderViewItem::setIcon(LLUIImagePtr icon)
271{ 274{
272 mIcon = icon; 275 mIcon = icon;
273 if (mIcon)
274 {
275 mIcon->setBoostLevel(LLViewerImage::BOOST_UI);
276 }
277} 276}
278 277
279// refresh information from the listener 278// refresh information from the listener
@@ -369,16 +368,6 @@ void LLFolderViewItem::extendSelectionFromRoot(LLFolderViewItem* selection)
369 getRoot()->extendSelection(selection, NULL, selected_items); 368 getRoot()->extendSelection(selection, NULL, selected_items);
370} 369}
371 370
372EWidgetType LLFolderViewItem::getWidgetType() const
373{
374 return WIDGET_TYPE_FOLDER_ITEM;
375}
376
377LLString LLFolderViewItem::getWidgetTag() const
378{
379 return LL_FOLDER_VIEW_ITEM_TAG;
380}
381
382EInventorySortGroup LLFolderViewItem::getSortGroup() 371EInventorySortGroup LLFolderViewItem::getSortGroup()
383{ 372{
384 return SG_ITEM; 373 return SG_ITEM;
@@ -649,7 +638,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
649 S32 screen_x; 638 S32 screen_x;
650 S32 screen_y; 639 S32 screen_y;
651 localPointToScreen(x, y, &screen_x, &screen_y ); 640 localPointToScreen(x, y, &screen_x, &screen_y );
652 gToolDragAndDrop->setDragStart( screen_x, screen_y ); 641 LLToolDragAndDrop::getInstance()->setDragStart( screen_x, screen_y );
653 } 642 }
654 return TRUE; 643 return TRUE;
655} 644}
@@ -662,7 +651,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
662 S32 screen_y; 651 S32 screen_y;
663 localPointToScreen(x, y, &screen_x, &screen_y ); 652 localPointToScreen(x, y, &screen_x, &screen_y );
664 BOOL can_drag = TRUE; 653 BOOL can_drag = TRUE;
665 if( gToolDragAndDrop->isOverThreshold( screen_x, screen_y ) ) 654 if( LLToolDragAndDrop::getInstance()->isOverThreshold( screen_x, screen_y ) )
666 { 655 {
667 LLFolderView* root = getRoot(); 656 LLFolderView* root = getRoot();
668 657
@@ -694,7 +683,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
694 // item. 683 // item.
695 gViewerWindow->setKeyboardFocus(NULL); 684 gViewerWindow->setKeyboardFocus(NULL);
696 685
697 return gToolDragAndDrop->handleHover( x, y, mask ); 686 return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask );
698 } 687 }
699 } 688 }
700 } 689 }
@@ -813,7 +802,7 @@ void LLFolderViewItem::draw()
813 if (mArrowImage) 802 if (mArrowImage)
814 { 803 {
815 gl_draw_scaled_rotated_image(mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD, 804 gl_draw_scaled_rotated_image(mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD,
816 ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, mArrowImage, sFgColor); 805 ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, mArrowImage->getImage(), sFgColor);
817 } 806 }
818 } 807 }
819 808
@@ -905,8 +894,7 @@ void LLFolderViewItem::draw()
905 894
906 if(mIcon) 895 if(mIcon)
907 { 896 {
908 gl_draw_image(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight(), mIcon); 897 mIcon->draw(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight());
909 mIcon->addTextureStats( (F32)(mIcon->getWidth() * mIcon->getHeight()));
910 } 898 }
911 899
912 if (!mLabel.empty()) 900 if (!mLabel.empty())
@@ -934,7 +922,7 @@ void LLFolderViewItem::draw()
934 922
935 if ( mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime") ) 923 if ( mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime") )
936 { 924 {
937 sFont->renderUTF8( "Loading... ", 0, text_left, y, sLoadingMessageTextColor, 925 sFont->renderUTF8( "Loading... ", 0, text_left, y, sSearchStatusColor,
938 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);
939 text_left = right_x; 927 text_left = right_x;
940 } 928 }
@@ -944,7 +932,7 @@ void LLFolderViewItem::draw()
944 S32_MAX, S32_MAX, &right_x, FALSE ); 932 S32_MAX, S32_MAX, &right_x, FALSE );
945 if (!mLabelSuffix.empty()) 933 if (!mLabelSuffix.empty())
946 { 934 {
947 sFont->renderUTF8( mLabelSuffix, 0, right_x, y, LLColor4(0.75f, 0.85f, 0.85f, 1.f), 935 sFont->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor,
948 LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, 936 LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle,
949 S32_MAX, S32_MAX, &right_x, FALSE ); 937 S32_MAX, S32_MAX, &right_x, FALSE );
950 } 938 }
@@ -961,9 +949,8 @@ void LLFolderViewItem::draw()
961 S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3); 949 S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3);
962 S32 top = getRect().getHeight(); 950 S32 top = getRect().getHeight();
963 951
964 LLViewerImage::bindTexture(mBoxImage); 952 LLRect box_rect(left, top, right, bottom);
965 gGL.color4fv(sFilterBGColor.mV); 953 mBoxImage->draw(box_rect, sFilterBGColor);
966 gl_segmented_rect_2d_tex(left, top, right, bottom, mBoxImage->getWidth(), mBoxImage->getHeight(), 16);
967 F32 match_string_left = text_left + sFont->getWidthF32(combined_string, 0, mStringMatchOffset); 954 F32 match_string_left = text_left + sFont->getWidthF32(combined_string, 0, mStringMatchOffset);
968 F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; 955 F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD;
969 sFont->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y, 956 sFont->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y,
@@ -985,7 +972,7 @@ void LLFolderViewItem::draw()
985///---------------------------------------------------------------------------- 972///----------------------------------------------------------------------------
986 973
987// Default constructor 974// Default constructor
988LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLViewerImage* icon, 975LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLUIImagePtr icon,
989 LLFolderView* root, 976 LLFolderView* root,
990 LLFolderViewEventListener* listener ): 977 LLFolderViewEventListener* listener ):
991 LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time 978 LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time
@@ -1019,16 +1006,6 @@ LLFolderViewFolder::~LLFolderViewFolder( void )
1019 //mFolders.removeAllNodes(); 1006 //mFolders.removeAllNodes();
1020} 1007}
1021 1008
1022EWidgetType LLFolderViewFolder::getWidgetType() const
1023{
1024 return WIDGET_TYPE_FOLDER;
1025}
1026
1027LLString LLFolderViewFolder::getWidgetTag() const
1028{
1029 return LL_FOLDER_VIEW_FOLDER_TAG;
1030}
1031
1032// addToFolder() returns TRUE if it succeeds. FALSE otherwise 1009// addToFolder() returns TRUE if it succeeds. FALSE otherwise
1033BOOL LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder, LLFolderView* root) 1010BOOL LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder, LLFolderView* root)
1034{ 1011{
@@ -2098,20 +2075,17 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask,
2098BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) 2075BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask )
2099{ 2076{
2100 BOOL handled = FALSE; 2077 BOOL handled = FALSE;
2101 if( getVisible() ) 2078 // fetch contents of this folder, as context menu can depend on contents
2079 // still, user would have to open context menu again to see the changes
2080 gInventory.fetchDescendentsOf(mListener->getUUID());
2081
2082 if( mIsOpen )
2102 { 2083 {
2103 // fetch contents of this folder, as context menu can depend on contents 2084 handled = childrenHandleRightMouseDown( x, y, mask ) != NULL;
2104 // still, user would have to open context menu again to see the changes 2085 }
2105 gInventory.fetchDescendentsOf(mListener->getUUID()); 2086 if (!handled)
2106 2087 {
2107 if( mIsOpen ) 2088 handled = LLFolderViewItem::handleRightMouseDown( x, y, mask );
2108 {
2109 handled = childrenHandleRightMouseDown( x, y, mask ) != NULL;
2110 }
2111 if (!handled)
2112 {
2113 handled = LLFolderViewItem::handleRightMouseDown( x, y, mask );
2114 }
2115 } 2089 }
2116 return handled; 2090 return handled;
2117} 2091}
@@ -2162,16 +2136,12 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask )
2162 2136
2163BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) 2137BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
2164{ 2138{
2165 if (!getVisible()) 2139 BOOL handled = FALSE;
2166 {
2167 return FALSE;
2168 }
2169 BOOL rv = false;
2170 if( mIsOpen ) 2140 if( mIsOpen )
2171 { 2141 {
2172 rv = childrenHandleDoubleClick( x, y, mask ) != NULL; 2142 handled = childrenHandleDoubleClick( x, y, mask ) != NULL;
2173 } 2143 }
2174 if( !rv ) 2144 if( !handled )
2175 { 2145 {
2176 if(x < LEFT_INDENTATION + mIndentation && x > mIndentation - LEFT_PAD) 2146 if(x < LEFT_INDENTATION + mIndentation && x > mIndentation - LEFT_PAD)
2177 { 2147 {
@@ -2184,9 +2154,9 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
2184 setSelectionFromRoot(this, FALSE); 2154 setSelectionFromRoot(this, FALSE);
2185 toggleOpen(); 2155 toggleOpen();
2186 } 2156 }
2187 return TRUE; 2157 handled = TRUE;
2188 } 2158 }
2189 return rv; 2159 return handled;
2190} 2160}
2191 2161
2192void LLFolderViewFolder::draw() 2162void LLFolderViewFolder::draw()
@@ -2529,7 +2499,7 @@ void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item)
2529///---------------------------------------------------------------------------- 2499///----------------------------------------------------------------------------
2530 2500
2531// Default constructor 2501// Default constructor
2532LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_icon, 2502LLFolderView::LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon,
2533 const LLRect& rect, const LLUUID& source_id, LLView *parent_view ) : 2503 const LLRect& rect, const LLUUID& source_id, LLView *parent_view ) :
2534#if LL_WINDOWS 2504#if LL_WINDOWS
2535#pragma warning( push ) 2505#pragma warning( push )
@@ -2584,18 +2554,15 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico
2584 NULL, 2554 NULL,
2585 NULL, 2555 NULL,
2586 this, 2556 this,
2587 &LLLineEditor::prevalidatePrintableNotPipe, 2557 &LLLineEditor::prevalidatePrintableNotPipe);
2588 LLViewBorder::BEVEL_NONE, 2558 //mRenamer->setWriteableBgColor(LLColor4::white);
2589 LLViewBorder::STYLE_LINE,
2590 2);
2591 mRenamer->setWriteableBgColor(LLColor4::white);
2592 // Escape is handled by reverting the rename, not commiting it (default behavior) 2559 // Escape is handled by reverting the rename, not commiting it (default behavior)
2593 mRenamer->setCommitOnFocusLost(TRUE); 2560 mRenamer->setCommitOnFocusLost(TRUE);
2594 mRenamer->setVisible(FALSE); 2561 mRenamer->setVisible(FALSE);
2595 addChild(mRenamer); 2562 addChild(mRenamer);
2596 2563
2597 // make the popup menu available 2564 // make the popup menu available
2598 LLMenuGL* menu = gUICtrlFactory->buildMenu("menu_inventory.xml", parent_view); 2565 LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_inventory.xml", parent_view);
2599 if (!menu) 2566 if (!menu)
2600 { 2567 {
2601 menu = new LLMenuGL(""); 2568 menu = new LLMenuGL("");
@@ -2643,16 +2610,6 @@ LLFolderView::~LLFolderView( void )
2643 mItemMap.clear(); 2610 mItemMap.clear();
2644} 2611}
2645 2612
2646EWidgetType LLFolderView::getWidgetType() const
2647{
2648 return WIDGET_TYPE_FOLDER_VIEW;
2649}
2650
2651LLString LLFolderView::getWidgetTag() const
2652{
2653 return LL_FOLDER_VIEW_TAG;
2654}
2655
2656BOOL LLFolderView::canFocusChildren() const 2613BOOL LLFolderView::canFocusChildren() const
2657{ 2614{
2658 return FALSE; 2615 return FALSE;
@@ -3156,7 +3113,7 @@ BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source)
3156 cargo_ids.push_back(id); 3113 cargo_ids.push_back(id);
3157 } 3114 }
3158 3115
3159 gToolDragAndDrop->beginMultiDrag(types, cargo_ids, source, mSourceID); 3116 LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, source, mSourceID);
3160 } 3117 }
3161 return can_drag; 3118 return can_drag;
3162} 3119}
@@ -3187,15 +3144,11 @@ void LLFolderView::draw()
3187 { 3144 {
3188 closeAutoOpenedFolders(); 3145 closeAutoOpenedFolders();
3189 } 3146 }
3190 if(gViewerWindow->hasKeyboardFocus(this) && !getVisible())
3191 {
3192 gViewerWindow->setKeyboardFocus( NULL );
3193 }
3194 3147
3195 // while dragging, update selection rendering to reflect single/multi drag status 3148 // while dragging, update selection rendering to reflect single/multi drag status
3196 if (gToolDragAndDrop->hasMouseCapture()) 3149 if (LLToolDragAndDrop::getInstance()->hasMouseCapture())
3197 { 3150 {
3198 EAcceptance last_accept = gToolDragAndDrop->getLastAccept(); 3151 EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept();
3199 if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) 3152 if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE)
3200 { 3153 {
3201 setShowSingleSelection(TRUE); 3154 setShowSingleSelection(TRUE);
@@ -3225,12 +3178,12 @@ void LLFolderView::draw()
3225 if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter.getMinRequiredGeneration()) 3178 if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter.getMinRequiredGeneration())
3226 { 3179 {
3227 mStatusText = "Searching..."; // *TODO:translate 3180 mStatusText = "Searching..."; // *TODO:translate
3228 sFont->renderUTF8(mStatusText, 0, 2, 1, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); 3181 sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE );
3229 } 3182 }
3230 else 3183 else
3231 { 3184 {
3232 mStatusText = "No matching items found in inventory."; // *TODO:translate 3185 mStatusText = "No matching items found in inventory."; // *TODO:translate
3233 sFont->renderUTF8(mStatusText, 0, 2, 1, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); 3186 sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE );
3234 } 3187 }
3235 } 3188 }
3236 3189
@@ -3698,7 +3651,7 @@ void LLFolderView::setFocus(BOOL focus)
3698 LLFolderViewFolder::setFocus(focus); 3651 LLFolderViewFolder::setFocus(focus);
3699} 3652}
3700 3653
3701BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) 3654BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
3702{ 3655{
3703 BOOL handled = FALSE; 3656 BOOL handled = FALSE;
3704 3657
@@ -3716,202 +3669,199 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
3716 item = *(getChildList()->begin()); 3669 item = *(getChildList()->begin());
3717 } 3670 }
3718 3671
3719 if( getVisible() && getEnabled() && !called_from_parent ) 3672 switch( key )
3720 { 3673 {
3721 switch( key ) 3674 case KEY_F2:
3722 { 3675 mSearchString.clear();
3723 case KEY_F2: 3676 startRenamingSelectedItem();
3724 mSearchString.clear(); 3677 handled = TRUE;
3725 startRenamingSelectedItem(); 3678 break;
3726 handled = TRUE;
3727 break;
3728
3729 case KEY_RETURN:
3730 if (mask == MASK_NONE)
3731 {
3732 if( mRenameItem && mRenamer->getVisible() )
3733 {
3734 finishRenamingItem();
3735 mSearchString.clear();
3736 handled = TRUE;
3737 }
3738 else
3739 {
3740 LLFolderView::openSelectedItems();
3741 handled = TRUE;
3742 }
3743 }
3744 break;
3745 3679
3746 case KEY_ESCAPE: 3680 case KEY_RETURN:
3747 // mark flag don't commit 3681 if (mask == MASK_NONE)
3682 {
3748 if( mRenameItem && mRenamer->getVisible() ) 3683 if( mRenameItem && mRenamer->getVisible() )
3749 { 3684 {
3750 revertRenamingItem(); 3685 finishRenamingItem();
3686 mSearchString.clear();
3751 handled = TRUE; 3687 handled = TRUE;
3752 } 3688 }
3753 else 3689 else
3754 { 3690 {
3755 if( gViewerWindow->childHasKeyboardFocus( this ) ) 3691 LLFolderView::openSelectedItems();
3756 { 3692 handled = TRUE;
3757 gViewerWindow->setKeyboardFocus( NULL );
3758 }
3759 } 3693 }
3760 mSearchString.clear(); 3694 }
3761 break; 3695 break;
3762 3696
3763 case KEY_PAGE_UP: 3697 case KEY_ESCAPE:
3764 mSearchString.clear(); 3698 // mark flag don't commit
3765 mScrollContainer->pageUp(30); 3699 if( mRenameItem && mRenamer->getVisible() )
3700 {
3701 revertRenamingItem();
3766 handled = TRUE; 3702 handled = TRUE;
3767 break; 3703 }
3704 else
3705 {
3706 if( gViewerWindow->childHasKeyboardFocus( this ) )
3707 {
3708 gViewerWindow->setKeyboardFocus( NULL );
3709 }
3710 }
3711 mSearchString.clear();
3712 break;
3768 3713
3769 case KEY_PAGE_DOWN: 3714 case KEY_PAGE_UP:
3770 mSearchString.clear(); 3715 mSearchString.clear();
3771 mScrollContainer->pageDown(30); 3716 mScrollContainer->pageUp(30);
3772 handled = TRUE; 3717 handled = TRUE;
3773 break; 3718 break;
3774 3719
3775 case KEY_HOME: 3720 case KEY_PAGE_DOWN:
3776 mSearchString.clear(); 3721 mSearchString.clear();
3777 mScrollContainer->goToTop(); 3722 mScrollContainer->pageDown(30);
3778 handled = TRUE; 3723 handled = TRUE;
3779 break; 3724 break;
3780 3725
3781 case KEY_END: 3726 case KEY_HOME:
3782 mSearchString.clear(); 3727 mSearchString.clear();
3783 mScrollContainer->goToBottom(); 3728 mScrollContainer->goToTop();
3784 break; 3729 handled = TRUE;
3730 break;
3785 3731
3786 case KEY_DOWN: 3732 case KEY_END:
3787 if((mSelectedItems.size() > 0) && mScrollContainer) 3733 mSearchString.clear();
3788 { 3734 mScrollContainer->goToBottom();
3789 LLFolderViewItem* last_selected = getCurSelectedItem(); 3735 break;
3790 3736
3791 if (!mKeyboardSelection) 3737 case KEY_DOWN:
3792 { 3738 if((mSelectedItems.size() > 0) && mScrollContainer)
3793 setSelection(last_selected, FALSE, TRUE); 3739 {
3794 mKeyboardSelection = TRUE; 3740 LLFolderViewItem* last_selected = getCurSelectedItem();
3795 }
3796 3741
3797 LLFolderViewItem* next = NULL; 3742 if (!mKeyboardSelection)
3798 if (mask & MASK_SHIFT) 3743 {
3744 setSelection(last_selected, FALSE, TRUE);
3745 mKeyboardSelection = TRUE;
3746 }
3747
3748 LLFolderViewItem* next = NULL;
3749 if (mask & MASK_SHIFT)
3750 {
3751 // don't shift select down to children of folders (they are implicitly selected through parent)
3752 next = last_selected->getNextOpenNode(FALSE);
3753 if (next)
3799 { 3754 {
3800 // don't shift select down to children of folders (they are implicitly selected through parent) 3755 if (next->isSelected())
3801 next = last_selected->getNextOpenNode(FALSE);
3802 if (next)
3803 { 3756 {
3804 if (next->isSelected()) 3757 // shrink selection
3805 { 3758 changeSelectionFromRoot(last_selected, FALSE);
3806 // shrink selection 3759 }
3807 changeSelectionFromRoot(last_selected, FALSE); 3760 else if (last_selected->getParentFolder() == next->getParentFolder())
3808 } 3761 {
3809 else if (last_selected->getParentFolder() == next->getParentFolder()) 3762 // grow selection
3810 { 3763 changeSelectionFromRoot(next, TRUE);
3811 // grow selection
3812 changeSelectionFromRoot(next, TRUE);
3813 }
3814 } 3764 }
3815 } 3765 }
3816 else 3766 }
3767 else
3768 {
3769 next = last_selected->getNextOpenNode();
3770 if( next )
3817 { 3771 {
3818 next = last_selected->getNextOpenNode(); 3772 if (next == last_selected)
3819 if( next )
3820 { 3773 {
3821 if (next == last_selected) 3774 return FALSE;
3822 {
3823 return FALSE;
3824 }
3825 setSelection( next, FALSE, TRUE );
3826 } 3775 }
3776 setSelection( next, FALSE, TRUE );
3827 } 3777 }
3828 scrollToShowSelection();
3829 mSearchString.clear();
3830 handled = TRUE;
3831 } 3778 }
3832 break; 3779 scrollToShowSelection();
3780 mSearchString.clear();
3781 handled = TRUE;
3782 }
3783 break;
3833 3784
3834 case KEY_UP: 3785 case KEY_UP:
3835 if((mSelectedItems.size() > 0) && mScrollContainer) 3786 if((mSelectedItems.size() > 0) && mScrollContainer)
3836 { 3787 {
3837 LLFolderViewItem* last_selected = mSelectedItems.back(); 3788 LLFolderViewItem* last_selected = mSelectedItems.back();
3838 3789
3839 if (!mKeyboardSelection) 3790 if (!mKeyboardSelection)
3840 { 3791 {
3841 setSelection(last_selected, FALSE, TRUE); 3792 setSelection(last_selected, FALSE, TRUE);
3842 mKeyboardSelection = TRUE; 3793 mKeyboardSelection = TRUE;
3843 } 3794 }
3844 3795
3845 LLFolderViewItem* prev = NULL; 3796 LLFolderViewItem* prev = NULL;
3846 if (mask & MASK_SHIFT) 3797 if (mask & MASK_SHIFT)
3798 {
3799 // don't shift select down to children of folders (they are implicitly selected through parent)
3800 prev = last_selected->getPreviousOpenNode(FALSE);
3801 if (prev)
3847 { 3802 {
3848 // don't shift select down to children of folders (they are implicitly selected through parent) 3803 if (prev->isSelected())
3849 prev = last_selected->getPreviousOpenNode(FALSE);
3850 if (prev)
3851 { 3804 {
3852 if (prev->isSelected()) 3805 // shrink selection
3853 { 3806 changeSelectionFromRoot(last_selected, FALSE);
3854 // shrink selection 3807 }
3855 changeSelectionFromRoot(last_selected, FALSE); 3808 else if (last_selected->getParentFolder() == prev->getParentFolder())
3856 } 3809 {
3857 else if (last_selected->getParentFolder() == prev->getParentFolder()) 3810 // grow selection
3858 { 3811 changeSelectionFromRoot(prev, TRUE);
3859 // grow selection
3860 changeSelectionFromRoot(prev, TRUE);
3861 }
3862 } 3812 }
3863 } 3813 }
3864 else 3814 }
3815 else
3816 {
3817 prev = last_selected->getPreviousOpenNode();
3818 if( prev )
3865 { 3819 {
3866 prev = last_selected->getPreviousOpenNode(); 3820 if (prev == this)
3867 if( prev )
3868 { 3821 {
3869 if (prev == this) 3822 return FALSE;
3870 {
3871 return FALSE;
3872 }
3873 setSelection( prev, FALSE, TRUE );
3874 } 3823 }
3824 setSelection( prev, FALSE, TRUE );
3875 } 3825 }
3876 scrollToShowSelection();
3877 mSearchString.clear();
3878
3879 handled = TRUE;
3880 } 3826 }
3881 break; 3827 scrollToShowSelection();
3828 mSearchString.clear();
3829
3830 handled = TRUE;
3831 }
3832 break;
3833
3834 case KEY_RIGHT:
3835 if(mSelectedItems.size())
3836 {
3837 LLFolderViewItem* last_selected = getCurSelectedItem();
3838 last_selected->setOpen( TRUE );
3839 mSearchString.clear();
3840 handled = TRUE;
3841 }
3842 break;
3882 3843
3883 case KEY_RIGHT: 3844 case KEY_LEFT:
3884 if(mSelectedItems.size()) 3845 if(mSelectedItems.size())
3846 {
3847 LLFolderViewItem* last_selected = getCurSelectedItem();
3848 LLFolderViewItem* parent_folder = last_selected->getParentFolder();
3849 if (!last_selected->isOpen() && parent_folder && parent_folder->getParentFolder())
3885 { 3850 {
3886 LLFolderViewItem* last_selected = getCurSelectedItem(); 3851 setSelection(parent_folder, FALSE, TRUE);
3887 last_selected->setOpen( TRUE );
3888 mSearchString.clear();
3889 handled = TRUE;
3890 } 3852 }
3891 break; 3853 else
3892
3893 case KEY_LEFT:
3894 if(mSelectedItems.size())
3895 { 3854 {
3896 LLFolderViewItem* last_selected = getCurSelectedItem(); 3855 last_selected->setOpen( FALSE );
3897 LLFolderViewItem* parent_folder = last_selected->getParentFolder();
3898 if (!last_selected->isOpen() && parent_folder && parent_folder->getParentFolder())
3899 {
3900 setSelection(parent_folder, FALSE, TRUE);
3901 }
3902 else
3903 {
3904 last_selected->setOpen( FALSE );
3905 }
3906 mSearchString.clear();
3907 scrollToShowSelection();
3908 handled = TRUE;
3909 } 3856 }
3910 break; 3857 mSearchString.clear();
3858 scrollToShowSelection();
3859 handled = TRUE;
3911 } 3860 }
3861 break;
3912 } 3862 }
3913 3863
3914 if (!handled && gFocusMgr.childHasKeyboardFocus(getRoot())) 3864 if (!handled && hasFocus())
3915 { 3865 {
3916 if (key == KEY_BACKSPACE) 3866 if (key == KEY_BACKSPACE)
3917 { 3867 {
@@ -3929,7 +3879,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
3929} 3879}
3930 3880
3931 3881
3932BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) 3882BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char)
3933{ 3883{
3934 if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL 3884 if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL
3935 { 3885 {
@@ -4082,11 +4032,7 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const LLString &search_s
4082 4032
4083BOOL LLFolderView::handleDoubleClick( S32 x, S32 y, MASK mask ) 4033BOOL LLFolderView::handleDoubleClick( S32 x, S32 y, MASK mask )
4084{ 4034{
4085 if (!getVisible()) 4035 // skip LLFolderViewFolder::handleDoubleClick()
4086 {
4087 return FALSE;
4088 }
4089
4090 return LLView::handleDoubleClick( x, y, mask ); 4036 return LLView::handleDoubleClick( x, y, mask );
4091} 4037}
4092 4038