diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llfolderview.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfolderview.cpp | 172 |
1 files changed, 84 insertions, 88 deletions
diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp index ca3c9c1..586c466 100644 --- a/linden/indra/newview/llfolderview.cpp +++ b/linden/indra/newview/llfolderview.cpp | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "llfocusmgr.h" | 40 | #include "llfocusmgr.h" |
41 | #include "llfontgl.h" | 41 | #include "llfontgl.h" |
42 | #include "llgl.h" | 42 | #include "llgl.h" |
43 | #include "llglimmediate.h" | ||
43 | #include "llinventory.h" | 44 | #include "llinventory.h" |
44 | 45 | ||
45 | #include "llcallbacklist.h" | 46 | #include "llcallbacklist.h" |
@@ -87,6 +88,11 @@ const F32 FOLDER_CLOSE_TIME_CONSTANT = 0.02f; | |||
87 | const F32 FOLDER_OPEN_TIME_CONSTANT = 0.03f; | 88 | const F32 FOLDER_OPEN_TIME_CONSTANT = 0.03f; |
88 | const S32 MAX_FOLDER_ITEM_OVERLAP = 2; | 89 | const S32 MAX_FOLDER_ITEM_OVERLAP = 2; |
89 | 90 | ||
91 | enum { | ||
92 | SIGNAL_NO_KEYBOARD_FOCUS = 1, | ||
93 | SIGNAL_KEYBOARD_FOCUS = 2 | ||
94 | }; | ||
95 | |||
90 | F32 LLFolderView::sAutoOpenTime = 1.f; | 96 | F32 LLFolderView::sAutoOpenTime = 1.f; |
91 | 97 | ||
92 | void delete_selected_item(void* user_data); | 98 | void delete_selected_item(void* user_data); |
@@ -600,16 +606,6 @@ const LLString& LLFolderViewItem::getName( void ) const | |||
600 | return mLabel; | 606 | return mLabel; |
601 | } | 607 | } |
602 | 608 | ||
603 | LLFolderViewFolder* LLFolderViewItem::getParentFolder( void ) | ||
604 | { | ||
605 | return mParentFolder; | ||
606 | } | ||
607 | |||
608 | LLFolderViewEventListener* LLFolderViewItem::getListener( void ) | ||
609 | { | ||
610 | return mListener; | ||
611 | } | ||
612 | |||
613 | // LLView functionality | 609 | // LLView functionality |
614 | BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) | 610 | BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) |
615 | { | 611 | { |
@@ -814,10 +810,9 @@ void LLFolderViewItem::draw() | |||
814 | } | 810 | } |
815 | if(/*mControlLabel[0] != '\0' && */possibly_has_children) | 811 | if(/*mControlLabel[0] != '\0' && */possibly_has_children) |
816 | { | 812 | { |
817 | LLGLSTexture gls_texture; | ||
818 | if (mArrowImage) | 813 | if (mArrowImage) |
819 | { | 814 | { |
820 | gl_draw_scaled_rotated_image(mIndentation, mRect.getHeight() - ARROW_SIZE - TEXT_PAD, | 815 | gl_draw_scaled_rotated_image(mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD, |
821 | ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, mArrowImage, sFgColor); | 816 | ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, mArrowImage, sFgColor); |
822 | } | 817 | } |
823 | } | 818 | } |
@@ -853,33 +848,33 @@ void LLFolderViewItem::draw() | |||
853 | 848 | ||
854 | gl_rect_2d( | 849 | gl_rect_2d( |
855 | 0, | 850 | 0, |
856 | mRect.getHeight(), | 851 | getRect().getHeight(), |
857 | mRect.getWidth() - 2, | 852 | getRect().getWidth() - 2, |
858 | llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD), | 853 | llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD), |
859 | bg_color, filled); | 854 | bg_color, filled); |
860 | if (mIsCurSelection) | 855 | if (mIsCurSelection) |
861 | { | 856 | { |
862 | gl_rect_2d( | 857 | gl_rect_2d( |
863 | 0, | 858 | 0, |
864 | mRect.getHeight(), | 859 | getRect().getHeight(), |
865 | mRect.getWidth() - 2, | 860 | getRect().getWidth() - 2, |
866 | llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD), | 861 | llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD), |
867 | sHighlightFgColor, FALSE); | 862 | sHighlightFgColor, FALSE); |
868 | } | 863 | } |
869 | if (mRect.getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2) | 864 | if (getRect().getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2) |
870 | { | 865 | { |
871 | gl_rect_2d( | 866 | gl_rect_2d( |
872 | 0, | 867 | 0, |
873 | llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, | 868 | llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, |
874 | mRect.getWidth() - 2, | 869 | getRect().getWidth() - 2, |
875 | 2, | 870 | 2, |
876 | sHighlightFgColor, FALSE); | 871 | sHighlightFgColor, FALSE); |
877 | if (show_context) | 872 | if (show_context) |
878 | { | 873 | { |
879 | gl_rect_2d( | 874 | gl_rect_2d( |
880 | 0, | 875 | 0, |
881 | llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, | 876 | llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, |
882 | mRect.getWidth() - 2, | 877 | getRect().getWidth() - 2, |
883 | 2, | 878 | 2, |
884 | sHighlightBgColor, TRUE); | 879 | sHighlightBgColor, TRUE); |
885 | } | 880 | } |
@@ -890,17 +885,17 @@ void LLFolderViewItem::draw() | |||
890 | LLGLSNoTexture gls_no_texture; | 885 | LLGLSNoTexture gls_no_texture; |
891 | gl_rect_2d( | 886 | gl_rect_2d( |
892 | 0, | 887 | 0, |
893 | mRect.getHeight(), | 888 | getRect().getHeight(), |
894 | mRect.getWidth() - 2, | 889 | getRect().getWidth() - 2, |
895 | llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD), | 890 | llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD), |
896 | sHighlightBgColor, FALSE); | 891 | sHighlightBgColor, FALSE); |
897 | 892 | ||
898 | if (mRect.getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2) | 893 | if (getRect().getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2) |
899 | { | 894 | { |
900 | gl_rect_2d( | 895 | gl_rect_2d( |
901 | 0, | 896 | 0, |
902 | llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, | 897 | llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, |
903 | mRect.getWidth() - 2, | 898 | getRect().getWidth() - 2, |
904 | 2, | 899 | 2, |
905 | sHighlightBgColor, FALSE); | 900 | sHighlightBgColor, FALSE); |
906 | } | 901 | } |
@@ -910,7 +905,7 @@ void LLFolderViewItem::draw() | |||
910 | 905 | ||
911 | if(mIcon) | 906 | if(mIcon) |
912 | { | 907 | { |
913 | gl_draw_image(mIndentation + ARROW_SIZE + TEXT_PAD, mRect.getHeight() - mIcon->getHeight(), mIcon); | 908 | gl_draw_image(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight(), mIcon); |
914 | mIcon->addTextureStats( (F32)(mIcon->getWidth() * mIcon->getHeight())); | 909 | mIcon->addTextureStats( (F32)(mIcon->getWidth() * mIcon->getHeight())); |
915 | } | 910 | } |
916 | 911 | ||
@@ -920,7 +915,7 @@ void LLFolderViewItem::draw() | |||
920 | BOOL debug_filters = getRoot()->getDebugFilters(); | 915 | BOOL debug_filters = getRoot()->getDebugFilters(); |
921 | LLColor4 color = ( (mIsSelected && filled) ? sHighlightFgColor : sFgColor ); | 916 | LLColor4 color = ( (mIsSelected && filled) ? sHighlightFgColor : sFgColor ); |
922 | F32 right_x; | 917 | F32 right_x; |
923 | F32 y = (F32)mRect.getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; | 918 | F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; |
924 | 919 | ||
925 | if (debug_filters) | 920 | if (debug_filters) |
926 | { | 921 | { |
@@ -963,14 +958,14 @@ void LLFolderViewItem::draw() | |||
963 | LLString combined_string = mLabel + mLabelSuffix; | 958 | LLString combined_string = mLabel + mLabelSuffix; |
964 | S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1; | 959 | S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1; |
965 | S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; | 960 | S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; |
966 | S32 bottom = llfloor(mRect.getHeight() - sFont->getLineHeight() - 3); | 961 | S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3); |
967 | S32 top = mRect.getHeight(); | 962 | S32 top = getRect().getHeight(); |
968 | 963 | ||
969 | LLViewerImage::bindTexture(mBoxImage); | 964 | LLViewerImage::bindTexture(mBoxImage); |
970 | glColor4fv(sFilterBGColor.mV); | 965 | gGL.color4fv(sFilterBGColor.mV); |
971 | gl_segmented_rect_2d_tex(left, top, right, bottom, mBoxImage->getWidth(), mBoxImage->getHeight(), 16); | 966 | gl_segmented_rect_2d_tex(left, top, right, bottom, mBoxImage->getWidth(), mBoxImage->getHeight(), 16); |
972 | F32 match_string_left = text_left + sFont->getWidthF32(combined_string, 0, mStringMatchOffset); | 967 | F32 match_string_left = text_left + sFont->getWidthF32(combined_string, 0, mStringMatchOffset); |
973 | F32 y = (F32)mRect.getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; | 968 | F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; |
974 | sFont->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y, | 969 | sFont->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y, |
975 | sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, | 970 | sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, |
976 | filter_string_length, S32_MAX, &right_x, FALSE ); | 971 | filter_string_length, S32_MAX, &right_x, FALSE ); |
@@ -1074,7 +1069,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) | |||
1074 | if (mIsOpen) | 1069 | if (mIsOpen) |
1075 | { | 1070 | { |
1076 | // Add sizes of children | 1071 | // Add sizes of children |
1077 | S32 parent_item_height = mRect.getHeight(); | 1072 | S32 parent_item_height = getRect().getHeight(); |
1078 | 1073 | ||
1079 | folders_t::iterator fit = mFolders.begin(); | 1074 | folders_t::iterator fit = mFolders.begin(); |
1080 | folders_t::iterator fend = mFolders.end(); | 1075 | folders_t::iterator fend = mFolders.end(); |
@@ -1158,7 +1153,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) | |||
1158 | { | 1153 | { |
1159 | folders_t::iterator fit = iter++; | 1154 | folders_t::iterator fit = iter++; |
1160 | // number of pixels that bottom of folder label is from top of parent folder | 1155 | // number of pixels that bottom of folder label is from top of parent folder |
1161 | if (mRect.getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight() | 1156 | if (getRect().getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight() |
1162 | > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) | 1157 | > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) |
1163 | { | 1158 | { |
1164 | // hide if beyond current folder height | 1159 | // hide if beyond current folder height |
@@ -1171,7 +1166,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) | |||
1171 | { | 1166 | { |
1172 | items_t::iterator iit = iter++; | 1167 | items_t::iterator iit = iter++; |
1173 | // number of pixels that bottom of item label is from top of parent folder | 1168 | // number of pixels that bottom of item label is from top of parent folder |
1174 | if (mRect.getHeight() - (*iit)->getRect().mBottom | 1169 | if (getRect().getHeight() - (*iit)->getRect().mBottom |
1175 | > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) | 1170 | > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) |
1176 | { | 1171 | { |
1177 | (*iit)->setVisible(FALSE); | 1172 | (*iit)->setVisible(FALSE); |
@@ -1184,7 +1179,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) | |||
1184 | } | 1179 | } |
1185 | 1180 | ||
1186 | // don't change width as this item is already as wide as its parent folder | 1181 | // don't change width as this item is already as wide as its parent folder |
1187 | reshape(mRect.getWidth(),llround(mCurHeight)); | 1182 | reshape(getRect().getWidth(),llround(mCurHeight)); |
1188 | 1183 | ||
1189 | // pass current height value back to parent | 1184 | // pass current height value back to parent |
1190 | *height = llround(mCurHeight); | 1185 | *height = llround(mCurHeight); |
@@ -1903,7 +1898,7 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item) | |||
1903 | item, | 1898 | item, |
1904 | mSortFunction); | 1899 | mSortFunction); |
1905 | mItems.insert(it,item); | 1900 | mItems.insert(it,item); |
1906 | item->setRect(LLRect(0, 0, mRect.getWidth(), 0)); | 1901 | item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); |
1907 | item->setVisible(FALSE); | 1902 | item->setVisible(FALSE); |
1908 | addChild( item ); | 1903 | addChild( item ); |
1909 | item->dirtyFilter(); | 1904 | item->dirtyFilter(); |
@@ -1921,7 +1916,7 @@ BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) | |||
1921 | mSortFunction); | 1916 | mSortFunction); |
1922 | mFolders.insert(it,folder); | 1917 | mFolders.insert(it,folder); |
1923 | folder->setOrigin(0, 0); | 1918 | folder->setOrigin(0, 0); |
1924 | folder->reshape(mRect.getWidth(), 0); | 1919 | folder->reshape(getRect().getWidth(), 0); |
1925 | folder->setVisible(FALSE); | 1920 | folder->setVisible(FALSE); |
1926 | addChild( folder ); | 1921 | addChild( folder ); |
1927 | folder->dirtyFilter(); | 1922 | folder->dirtyFilter(); |
@@ -1972,6 +1967,7 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL open, ERecurseType recur | |||
1972 | mListener->openItem(); | 1967 | mListener->openItem(); |
1973 | } | 1968 | } |
1974 | } | 1969 | } |
1970 | |||
1975 | if (recurse == RECURSE_DOWN || recurse == RECURSE_UP_DOWN) | 1971 | if (recurse == RECURSE_DOWN || recurse == RECURSE_UP_DOWN) |
1976 | { | 1972 | { |
1977 | for (folders_t::iterator iter = mFolders.begin(); | 1973 | for (folders_t::iterator iter = mFolders.begin(); |
@@ -2131,7 +2127,7 @@ BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) | |||
2131 | handled = LLFolderViewItem::handleHover(x, y, mask); | 2127 | handled = LLFolderViewItem::handleHover(x, y, mask); |
2132 | } | 2128 | } |
2133 | 2129 | ||
2134 | //if(x < LEFT_INDENTATION + mIndentation && x > mIndentation - LEFT_PAD && y > mRect.getHeight() - ) | 2130 | //if(x < LEFT_INDENTATION + mIndentation && x > mIndentation - LEFT_PAD && y > getRect().getHeight() - ) |
2135 | //{ | 2131 | //{ |
2136 | // gViewerWindow->setCursor(UI_CURSOR_ARROW); | 2132 | // gViewerWindow->setCursor(UI_CURSOR_ARROW); |
2137 | // mExpanderHighlighted = TRUE; | 2133 | // mExpanderHighlighted = TRUE; |
@@ -2544,7 +2540,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico | |||
2544 | #pragma warning( pop ) | 2540 | #pragma warning( pop ) |
2545 | #endif | 2541 | #endif |
2546 | mScrollContainer( NULL ), | 2542 | mScrollContainer( NULL ), |
2547 | mPopupMenuHandle( LLViewHandle::sDeadHandle ), | 2543 | mPopupMenuHandle(), |
2548 | mAllowMultiSelect(TRUE), | 2544 | mAllowMultiSelect(TRUE), |
2549 | mShowFolderHierarchy(FALSE), | 2545 | mShowFolderHierarchy(FALSE), |
2550 | mSourceID(source_id), | 2546 | mSourceID(source_id), |
@@ -2562,11 +2558,11 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico | |||
2562 | mArrangeGeneration(0), | 2558 | mArrangeGeneration(0), |
2563 | mUserData(NULL), | 2559 | mUserData(NULL), |
2564 | mSelectCallback(NULL), | 2560 | mSelectCallback(NULL), |
2565 | mSelectionChanged(FALSE), | 2561 | mSignalSelectCallback(0), |
2566 | mMinWidth(0), | 2562 | mMinWidth(0), |
2567 | mDragAndDropThisFrame(FALSE) | 2563 | mDragAndDropThisFrame(FALSE) |
2568 | { | 2564 | { |
2569 | LLRect new_rect(rect.mLeft, rect.mBottom + mRect.getHeight(), rect.mLeft + mRect.getWidth(), rect.mBottom); | 2565 | LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom); |
2570 | setRect( rect ); | 2566 | setRect( rect ); |
2571 | reshape(rect.getWidth(), rect.getHeight()); | 2567 | reshape(rect.getWidth(), rect.getHeight()); |
2572 | mIsOpen = TRUE; // this view is always open. | 2568 | mIsOpen = TRUE; // this view is always open. |
@@ -2582,7 +2578,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico | |||
2582 | // just make sure the label ("Inventory Folder") never shows up | 2578 | // just make sure the label ("Inventory Folder") never shows up |
2583 | mLabel = LLString::null; | 2579 | mLabel = LLString::null; |
2584 | 2580 | ||
2585 | mRenamer = new LLLineEditor("ren", mRect, "", sFont, | 2581 | mRenamer = new LLLineEditor("ren", getRect(), "", sFont, |
2586 | DB_INV_ITEM_NAME_STR_LEN, | 2582 | DB_INV_ITEM_NAME_STR_LEN, |
2587 | &LLFolderView::commitRename, | 2583 | &LLFolderView::commitRename, |
2588 | NULL, | 2584 | NULL, |
@@ -2606,7 +2602,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico | |||
2606 | } | 2602 | } |
2607 | menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); | 2603 | menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); |
2608 | menu->setVisible(FALSE); | 2604 | menu->setVisible(FALSE); |
2609 | mPopupMenuHandle = menu->mViewHandle; | 2605 | mPopupMenuHandle = menu->getHandle(); |
2610 | 2606 | ||
2611 | setTabStop(TRUE); | 2607 | setTabStop(TRUE); |
2612 | } | 2608 | } |
@@ -2710,7 +2706,7 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder) | |||
2710 | mFolders.insert(mFolders.begin(), folder); | 2706 | mFolders.insert(mFolders.begin(), folder); |
2711 | } | 2707 | } |
2712 | folder->setOrigin(0, 0); | 2708 | folder->setOrigin(0, 0); |
2713 | folder->reshape(mRect.getWidth(), 0); | 2709 | folder->reshape(getRect().getWidth(), 0); |
2714 | folder->setVisible(FALSE); | 2710 | folder->setVisible(FALSE); |
2715 | addChild( folder ); | 2711 | addChild( folder ); |
2716 | folder->dirtyFilter(); | 2712 | folder->dirtyFilter(); |
@@ -2726,7 +2722,7 @@ void LLFolderView::closeAllFolders() | |||
2726 | 2722 | ||
2727 | void LLFolderView::openFolder(const LLString& foldername) | 2723 | void LLFolderView::openFolder(const LLString& foldername) |
2728 | { | 2724 | { |
2729 | LLFolderViewFolder* inv = (LLFolderViewFolder*)getChildByName(foldername); | 2725 | LLFolderViewFolder* inv = getChild<LLFolderViewFolder>(foldername); |
2730 | if (inv) | 2726 | if (inv) |
2731 | { | 2727 | { |
2732 | setSelection(inv, FALSE, FALSE); | 2728 | setSelection(inv, FALSE, FALSE); |
@@ -2759,7 +2755,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen | |||
2759 | S32 total_width = LEFT_PAD; | 2755 | S32 total_width = LEFT_PAD; |
2760 | S32 running_height = mDebugFilters ? llceil(sSmallFont->getLineHeight()) : 0; | 2756 | S32 running_height = mDebugFilters ? llceil(sSmallFont->getLineHeight()) : 0; |
2761 | S32 target_height = running_height; | 2757 | S32 target_height = running_height; |
2762 | S32 parent_item_height = mRect.getHeight(); | 2758 | S32 parent_item_height = getRect().getHeight(); |
2763 | 2759 | ||
2764 | for (folders_t::iterator iter = mFolders.begin(); | 2760 | for (folders_t::iterator iter = mFolders.begin(); |
2765 | iter != mFolders.end();) | 2761 | iter != mFolders.end();) |
@@ -2943,7 +2939,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL open, /* Flaw | |||
2943 | 2939 | ||
2944 | llassert(mSelectedItems.size() <= 1); | 2940 | llassert(mSelectedItems.size() <= 1); |
2945 | 2941 | ||
2946 | mSelectionChanged = TRUE; | 2942 | mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS; |
2947 | 2943 | ||
2948 | return rv; | 2944 | return rv; |
2949 | } | 2945 | } |
@@ -2985,7 +2981,7 @@ BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) | |||
2985 | 2981 | ||
2986 | rv = LLFolderViewFolder::changeSelection(selection, selected); | 2982 | rv = LLFolderViewFolder::changeSelection(selection, selected); |
2987 | 2983 | ||
2988 | mSelectionChanged = TRUE; | 2984 | mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS; |
2989 | 2985 | ||
2990 | return rv; | 2986 | return rv; |
2991 | } | 2987 | } |
@@ -3011,7 +3007,7 @@ S32 LLFolderView::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* | |||
3011 | rv++; | 3007 | rv++; |
3012 | } | 3008 | } |
3013 | 3009 | ||
3014 | mSelectionChanged = TRUE; | 3010 | mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS; |
3015 | return rv; | 3011 | return rv; |
3016 | } | 3012 | } |
3017 | 3013 | ||
@@ -3181,7 +3177,7 @@ void LLFolderView::draw() | |||
3181 | LLString current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", | 3177 | LLString current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", |
3182 | mFilter.getCurrentGeneration(), mFilter.getMinRequiredGeneration(), mFilter.getMustPassGeneration()); | 3178 | mFilter.getCurrentGeneration(), mFilter.getMinRequiredGeneration(), mFilter.getMustPassGeneration()); |
3183 | sSmallFont->renderUTF8(current_filter_string, 0, 2, | 3179 | sSmallFont->renderUTF8(current_filter_string, 0, 2, |
3184 | mRect.getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), | 3180 | getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), |
3185 | LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); | 3181 | LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); |
3186 | } | 3182 | } |
3187 | 3183 | ||
@@ -3287,7 +3283,7 @@ void LLFolderView::revertRenamingItem( void ) | |||
3287 | 3283 | ||
3288 | void LLFolderView::removeSelectedItems( void ) | 3284 | void LLFolderView::removeSelectedItems( void ) |
3289 | { | 3285 | { |
3290 | if(getVisible() && mEnabled) | 3286 | if(getVisible() && getEnabled()) |
3291 | { | 3287 | { |
3292 | // just in case we're removing the renaming item. | 3288 | // just in case we're removing the renaming item. |
3293 | mRenameItem = NULL; | 3289 | mRenameItem = NULL; |
@@ -3392,7 +3388,7 @@ void LLFolderView::removeSelectedItems( void ) | |||
3392 | // open the selected item. | 3388 | // open the selected item. |
3393 | void LLFolderView::openSelectedItems( void ) | 3389 | void LLFolderView::openSelectedItems( void ) |
3394 | { | 3390 | { |
3395 | if(getVisible() && mEnabled) | 3391 | if(getVisible() && getEnabled()) |
3396 | { | 3392 | { |
3397 | if (mSelectedItems.size() == 1) | 3393 | if (mSelectedItems.size() == 1) |
3398 | { | 3394 | { |
@@ -3432,7 +3428,7 @@ void LLFolderView::openSelectedItems( void ) | |||
3432 | 3428 | ||
3433 | void LLFolderView::propertiesSelectedItems( void ) | 3429 | void LLFolderView::propertiesSelectedItems( void ) |
3434 | { | 3430 | { |
3435 | if(getVisible() && mEnabled) | 3431 | if(getVisible() && getEnabled()) |
3436 | { | 3432 | { |
3437 | if (mSelectedItems.size() == 1) | 3433 | if (mSelectedItems.size() == 1) |
3438 | { | 3434 | { |
@@ -3531,17 +3527,16 @@ BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) | |||
3531 | return FALSE; | 3527 | return FALSE; |
3532 | } | 3528 | } |
3533 | 3529 | ||
3534 | BOOL LLFolderView::canCopy() | 3530 | BOOL LLFolderView::canCopy() const |
3535 | { | 3531 | { |
3536 | if (!(getVisible() && mEnabled && (mSelectedItems.size() > 0))) | 3532 | if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) |
3537 | { | 3533 | { |
3538 | return FALSE; | 3534 | return FALSE; |
3539 | } | 3535 | } |
3540 | 3536 | ||
3541 | selected_items_t::iterator selected_it; | 3537 | for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) |
3542 | for (selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) | ||
3543 | { | 3538 | { |
3544 | LLFolderViewItem* item = *selected_it; | 3539 | const LLFolderViewItem* item = *selected_it; |
3545 | if (!item->getListener()->isItemCopyable()) | 3540 | if (!item->getListener()->isItemCopyable()) |
3546 | { | 3541 | { |
3547 | return FALSE; | 3542 | return FALSE; |
@@ -3556,7 +3551,7 @@ void LLFolderView::copy() | |||
3556 | // *NOTE: total hack to clear the inventory clipboard | 3551 | // *NOTE: total hack to clear the inventory clipboard |
3557 | LLInventoryClipboard::instance().reset(); | 3552 | LLInventoryClipboard::instance().reset(); |
3558 | S32 count = mSelectedItems.size(); | 3553 | S32 count = mSelectedItems.size(); |
3559 | if(getVisible() && mEnabled && (count > 0)) | 3554 | if(getVisible() && getEnabled() && (count > 0)) |
3560 | { | 3555 | { |
3561 | LLFolderViewEventListener* listener = NULL; | 3556 | LLFolderViewEventListener* listener = NULL; |
3562 | selected_items_t::iterator item_it; | 3557 | selected_items_t::iterator item_it; |
@@ -3572,7 +3567,7 @@ void LLFolderView::copy() | |||
3572 | mSearchString.clear(); | 3567 | mSearchString.clear(); |
3573 | } | 3568 | } |
3574 | 3569 | ||
3575 | BOOL LLFolderView::canCut() | 3570 | BOOL LLFolderView::canCut() const |
3576 | { | 3571 | { |
3577 | return FALSE; | 3572 | return FALSE; |
3578 | } | 3573 | } |
@@ -3582,24 +3577,24 @@ void LLFolderView::cut() | |||
3582 | // implement Windows-style cut-and-leave | 3577 | // implement Windows-style cut-and-leave |
3583 | } | 3578 | } |
3584 | 3579 | ||
3585 | BOOL LLFolderView::canPaste() | 3580 | BOOL LLFolderView::canPaste() const |
3586 | { | 3581 | { |
3587 | if (mSelectedItems.empty()) | 3582 | if (mSelectedItems.empty()) |
3588 | { | 3583 | { |
3589 | return FALSE; | 3584 | return FALSE; |
3590 | } | 3585 | } |
3591 | 3586 | ||
3592 | if(getVisible() && mEnabled) | 3587 | if(getVisible() && getEnabled()) |
3593 | { | 3588 | { |
3594 | selected_items_t::iterator item_it; | 3589 | for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); |
3595 | for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) | 3590 | item_it != mSelectedItems.end(); ++item_it) |
3596 | { | 3591 | { |
3597 | // *TODO: only check folders and parent folders of items | 3592 | // *TODO: only check folders and parent folders of items |
3598 | LLFolderViewItem* item = (*item_it); | 3593 | const LLFolderViewItem* item = (*item_it); |
3599 | LLFolderViewEventListener* listener = item->getListener(); | 3594 | const LLFolderViewEventListener* listener = item->getListener(); |
3600 | if(!listener || !listener->isClipboardPasteable()) | 3595 | if(!listener || !listener->isClipboardPasteable()) |
3601 | { | 3596 | { |
3602 | LLFolderViewFolder* folderp = item->getParentFolder(); | 3597 | const LLFolderViewFolder* folderp = item->getParentFolder(); |
3603 | listener = folderp->getListener(); | 3598 | listener = folderp->getListener(); |
3604 | if (!listener || !listener->isClipboardPasteable()) | 3599 | if (!listener || !listener->isClipboardPasteable()) |
3605 | { | 3600 | { |
@@ -3615,7 +3610,7 @@ BOOL LLFolderView::canPaste() | |||
3615 | // paste selected item | 3610 | // paste selected item |
3616 | void LLFolderView::paste() | 3611 | void LLFolderView::paste() |
3617 | { | 3612 | { |
3618 | if(getVisible() && mEnabled) | 3613 | if(getVisible() && getEnabled()) |
3619 | { | 3614 | { |
3620 | // find set of unique folders to paste into | 3615 | // find set of unique folders to paste into |
3621 | std::set<LLFolderViewItem*> folder_set; | 3616 | std::set<LLFolderViewItem*> folder_set; |
@@ -3657,7 +3652,7 @@ void LLFolderView::startRenamingSelectedItem( void ) | |||
3657 | { | 3652 | { |
3658 | item = mSelectedItems.front(); | 3653 | item = mSelectedItems.front(); |
3659 | } | 3654 | } |
3660 | if(getVisible() && mEnabled && (count == 1) && item && item->getListener() && | 3655 | if(getVisible() && getEnabled() && (count == 1) && item && item->getListener() && |
3661 | item->getListener()->isItemRenameable()) | 3656 | item->getListener()->isItemRenameable()) |
3662 | { | 3657 | { |
3663 | mRenameItem = item; | 3658 | mRenameItem = item; |
@@ -3676,7 +3671,7 @@ void LLFolderView::startRenamingSelectedItem( void ) | |||
3676 | mScrollContainer->calcVisibleSize( &scroller_width, &scroller_height, &dummy_bool, &dummy_bool); | 3671 | mScrollContainer->calcVisibleSize( &scroller_width, &scroller_height, &dummy_bool, &dummy_bool); |
3677 | } | 3672 | } |
3678 | 3673 | ||
3679 | S32 width = llmax(llmin(item->getRect().getWidth() - x, scroller_width - x - mRect.mLeft), MINIMUM_RENAMER_WIDTH); | 3674 | S32 width = llmax(llmin(item->getRect().getWidth() - x, scroller_width - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH); |
3680 | S32 height = llfloor(sFont->getLineHeight() + RENAME_HEIGHT_PAD); | 3675 | S32 height = llfloor(sFont->getLineHeight() + RENAME_HEIGHT_PAD); |
3681 | mRenamer->reshape( width, height, TRUE ); | 3676 | mRenamer->reshape( width, height, TRUE ); |
3682 | 3677 | ||
@@ -3709,7 +3704,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) | |||
3709 | 3704 | ||
3710 | // SL-51858: Key presses are not being passed to the Popup menu. | 3705 | // SL-51858: Key presses are not being passed to the Popup menu. |
3711 | // A proper fix is non-trivial so instead just close the menu. | 3706 | // A proper fix is non-trivial so instead just close the menu. |
3712 | LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); | 3707 | LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); |
3713 | if (menu && menu->isOpen()) | 3708 | if (menu && menu->isOpen()) |
3714 | { | 3709 | { |
3715 | LLMenuGL::sMenuContainer->hideMenus(); | 3710 | LLMenuGL::sMenuContainer->hideMenus(); |
@@ -3721,7 +3716,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) | |||
3721 | item = *(getChildList()->begin()); | 3716 | item = *(getChildList()->begin()); |
3722 | } | 3717 | } |
3723 | 3718 | ||
3724 | if( getVisible() && mEnabled && !called_from_parent ) | 3719 | if( getVisible() && getEnabled() && !called_from_parent ) |
3725 | { | 3720 | { |
3726 | switch( key ) | 3721 | switch( key ) |
3727 | { | 3722 | { |
@@ -3952,7 +3947,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare | |||
3952 | { | 3947 | { |
3953 | // SL-51858: Key presses are not being passed to the Popup menu. | 3948 | // SL-51858: Key presses are not being passed to the Popup menu. |
3954 | // A proper fix is non-trivial so instead just close the menu. | 3949 | // A proper fix is non-trivial so instead just close the menu. |
3955 | LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); | 3950 | LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); |
3956 | if (menu && menu->isOpen()) | 3951 | if (menu && menu->isOpen()) |
3957 | { | 3952 | { |
3958 | LLMenuGL::sMenuContainer->hideMenus(); | 3953 | LLMenuGL::sMenuContainer->hideMenus(); |
@@ -3977,11 +3972,11 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare | |||
3977 | } | 3972 | } |
3978 | 3973 | ||
3979 | 3974 | ||
3980 | BOOL LLFolderView::canDoDelete() | 3975 | BOOL LLFolderView::canDoDelete() const |
3981 | { | 3976 | { |
3982 | if (mSelectedItems.size() == 0) return FALSE; | 3977 | if (mSelectedItems.size() == 0) return FALSE; |
3983 | selected_items_t::iterator item_it; | 3978 | |
3984 | for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) | 3979 | for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) |
3985 | { | 3980 | { |
3986 | if (!(*item_it)->getListener()->isItemRemovable()) | 3981 | if (!(*item_it)->getListener()->isItemRemovable()) |
3987 | { | 3982 | { |
@@ -4103,7 +4098,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) | |||
4103 | 4098 | ||
4104 | BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; | 4099 | BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; |
4105 | S32 count = mSelectedItems.size(); | 4100 | S32 count = mSelectedItems.size(); |
4106 | LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); | 4101 | LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); |
4107 | if(handled && (count > 0) && menu) | 4102 | if(handled && (count > 0) && menu) |
4108 | { | 4103 | { |
4109 | //menu->empty(); | 4104 | //menu->empty(); |
@@ -4179,7 +4174,7 @@ void LLFolderView::deleteAllChildren() | |||
4179 | gViewerWindow->setTopCtrl(NULL); | 4174 | gViewerWindow->setTopCtrl(NULL); |
4180 | } | 4175 | } |
4181 | LLView::deleteViewByHandle(mPopupMenuHandle); | 4176 | LLView::deleteViewByHandle(mPopupMenuHandle); |
4182 | mPopupMenuHandle = LLViewHandle::sDeadHandle; | 4177 | mPopupMenuHandle = LLHandle<LLView>(); |
4183 | mRenamer = NULL; | 4178 | mRenamer = NULL; |
4184 | mRenameItem = NULL; | 4179 | mRenameItem = NULL; |
4185 | clearSelection(); | 4180 | clearSelection(); |
@@ -4247,7 +4242,7 @@ LLRect LLFolderView::getVisibleRect() | |||
4247 | S32 visible_height = mScrollContainer->getRect().getHeight(); | 4242 | S32 visible_height = mScrollContainer->getRect().getHeight(); |
4248 | S32 visible_width = mScrollContainer->getRect().getWidth(); | 4243 | S32 visible_width = mScrollContainer->getRect().getWidth(); |
4249 | LLRect visible_rect; | 4244 | LLRect visible_rect; |
4250 | visible_rect.setLeftTopAndSize(-mRect.mLeft, visible_height - mRect.mBottom, visible_width, visible_height); | 4245 | visible_rect.setLeftTopAndSize(-getRect().mLeft, visible_height - getRect().mBottom, visible_width, visible_height); |
4251 | return visible_rect; | 4246 | return visible_rect; |
4252 | } | 4247 | } |
4253 | 4248 | ||
@@ -4257,7 +4252,7 @@ BOOL LLFolderView::getShowSelectionContext() | |||
4257 | { | 4252 | { |
4258 | return TRUE; | 4253 | return TRUE; |
4259 | } | 4254 | } |
4260 | LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); | 4255 | LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); |
4261 | if (menu && menu->getVisible()) | 4256 | if (menu && menu->getVisible()) |
4262 | { | 4257 | { |
4263 | return TRUE; | 4258 | return TRUE; |
@@ -4364,12 +4359,13 @@ void LLFolderView::doIdle() | |||
4364 | } | 4359 | } |
4365 | } | 4360 | } |
4366 | 4361 | ||
4367 | if (mSelectionChanged && mSelectCallback) | 4362 | if (mSignalSelectCallback && mSelectCallback) |
4368 | { | 4363 | { |
4369 | //RN: we use keyboard focus as a proxy for user-explicit actions | 4364 | //RN: we use keyboard focus as a proxy for user-explicit actions |
4370 | mSelectCallback(mSelectedItems, gFocusMgr.childHasKeyboardFocus(this), mUserData); | 4365 | BOOL take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); |
4366 | mSelectCallback(mSelectedItems, take_keyboard_focus, mUserData); | ||
4371 | } | 4367 | } |
4372 | mSelectionChanged = FALSE; | 4368 | mSignalSelectCallback = FALSE; |
4373 | } | 4369 | } |
4374 | 4370 | ||
4375 | 4371 | ||