diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-05-08 07:43:08 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-05-08 07:43:08 +0000 |
commit | a4000c3744e42fcbb638e742f3b63fa31a0dee15 (patch) | |
tree | 7f472c30e65bbfa04ee9bc06631a1af305cc31fb /indra/newview/llfolderview.cpp | |
parent | 6c4cadbb04d633ad7b762058bdeba6e1f650dafd (diff) |
merge trunk@116587 skinning-7@119389 -> viewer-2.0.0-skinning-7
Diffstat (limited to 'indra/newview/llfolderview.cpp')
-rw-r--r-- | indra/newview/llfolderview.cpp | 289 |
1 files changed, 155 insertions, 134 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 97a3bd7c50..75c7467442 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -50,10 +50,10 @@ #include "llkeyboard.h" #include "lllineeditor.h" #include "llmenugl.h" -#include "llresmgr.h" #include "llpreview.h" #include "llscrollcontainer.h" // hack to allow scrolling #include "lltooldraganddrop.h" +#include "lltrans.h" #include "llui.h" #include "llviewerimage.h" #include "llviewerimagelist.h" @@ -110,28 +110,16 @@ void renamer_focus_lost( LLFocusableElement* handler, void* user_data ); // statics const LLFontGL* LLFolderViewItem::sFont = NULL; const LLFontGL* LLFolderViewItem::sSmallFont = NULL; -LLColor4 LLFolderViewItem::sFgColor; -LLColor4 LLFolderViewItem::sHighlightBgColor; -LLColor4 LLFolderViewItem::sHighlightFgColor; -LLColor4 LLFolderViewItem::sFilterBGColor; -LLColor4 LLFolderViewItem::sFilterTextColor; -LLColor4 LLFolderViewItem::sSuffixColor; -LLColor4 LLFolderViewItem::sSearchStatusColor; LLUIImagePtr LLFolderViewItem::sArrowImage; LLUIImagePtr LLFolderViewItem::sBoxImage; +const LLColor4U DEFAULT_WHITE(255, 255, 255); + //static void LLFolderViewItem::initClass() { - sFont = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); - sSmallFont = LLResMgr::getInstance()->getRes( LLFONT_SMALL ); - sFgColor = gColors.getColor( "MenuItemEnabledColor" ); - sHighlightBgColor = gColors.getColor( "MenuItemHighlightBgColor" ); - sHighlightFgColor = gColors.getColor( "MenuItemHighlightFgColor" ); - sFilterBGColor = gColors.getColor( "FilterBackgroundColor" ); - sFilterTextColor = gColors.getColor( "FilterTextColor" ); - sSuffixColor = gColors.getColor( "InventoryItemSuffixColor" ); - sSearchStatusColor = gColors.getColor( "InventorySearchStatusColor" ); + sFont = LLFontGL::getFontSansSerifSmall(); + sSmallFont = LLFontGL::getFontMonospace(); sArrowImage = LLUI::getUIImage("folder_arrow.tga"); sBoxImage = LLUI::getUIImage("rounded_square.tga"); } @@ -143,23 +131,17 @@ void LLFolderViewItem::cleanupClass() sBoxImage = NULL; } -// Default constructor // NOTE: Optimize this, we call it a *lot* when opening a large inventory -LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon, - time_t creation_date, - LLFolderView* root, - LLFolderViewEventListener* listener ) : - LLUICtrl( name, LLRect(0, 0, 0, 0), TRUE, NULL, NULL, FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_RIGHT), - mLabel( name ), + +// Default constructor +LLFolderViewItem::LLFolderViewItem(LLFolderViewItem::Params p) +: LLUICtrl(p), mLabelWidth(0), - mCreationDate(creation_date), mParentFolder( NULL ), - mListener( listener ), mIsSelected( FALSE ), mIsCurSelection( FALSE ), mSelectPending(FALSE), mLabelStyle( LLFontGL::NORMAL ), - mIcon(icon), mHasVisibleChildren(FALSE), mIndentation(0), mNumDescendantsSelected(0), @@ -167,12 +149,16 @@ LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon, mLastFilterGeneration(-1), mStringMatchOffset(std::string::npos), mControlLabelRotation(0.f), - mRoot( root ), mDragAndDropTarget(FALSE), - mIsLoading(FALSE) + mIsLoading(FALSE), + mLabel(p.name), + mRoot(p.root), + mCreationDate(p.creation_date), + mListener(p.listener), + mArrowImage(p.folder_arrow_image), + mBoxImage(p.selection_image) { - refresh(); // possible opt: only call refreshFromListener() - setTabStop(FALSE); + refresh(); } // Destroys the object @@ -258,7 +244,7 @@ BOOL LLFolderViewItem::potentiallyVisible() BOOL LLFolderViewItem::getFiltered() { - return mFiltered && mLastFilterGeneration >= mRoot->getFilter()->getMinRequiredGeneration(); + return mFiltered && mLastFilterGeneration >= getRoot()->getFilter()->getMinRequiredGeneration(); } BOOL LLFolderViewItem::getFiltered(S32 filter_generation) @@ -283,6 +269,15 @@ void LLFolderViewItem::refreshFromListener() if(mListener) { mLabel = mListener->getDisplayName(); + LLAssetType::EType preferred_type = mListener->getPreferredType(); + + // *TODO: to be removed when database supports multi language. This is a + // temporary attempt to display the inventory folder in the user locale. + if (preferred_type != LLAssetType::AT_NONE) + { + mLabel = LLTrans::getString("InvFolder " + mLabel); + }; + setIcon(mListener->getIcon()); time_t creation_date = mListener->getCreationDate(); if (mCreationDate != creation_date) @@ -796,6 +791,14 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, void LLFolderViewItem::draw() { + static LLCachedControl<LLColor4> sFgColor(gSavedSkinSettings, "MenuItemEnabledColor", DEFAULT_WHITE); + static LLCachedControl<LLColor4> sHighlightBgColor(gSavedSkinSettings, "MenuItemHighlightBgColor", DEFAULT_WHITE); + static LLCachedControl<LLColor4> sHighlightFgColor(gSavedSkinSettings, "MenuItemHighlightFgColor", DEFAULT_WHITE); + static LLCachedControl<LLColor4> sFilterBGColor(gSavedSkinSettings, "FilterBackgroundColor", DEFAULT_WHITE); + static LLCachedControl<LLColor4> sFilterTextColor(gSavedSkinSettings, "FilterTextColor", DEFAULT_WHITE); + static LLCachedControl<LLColor4> sSuffixColor(gSavedSkinSettings, "InventoryItemSuffixColor", DEFAULT_WHITE); + static LLCachedControl<LLColor4> sSearchStatusColor(gSavedSkinSettings, "InventorySearchStatusColor", DEFAULT_WHITE); + bool possibly_has_children = false; bool up_to_date = mListener && mListener->isUpToDate(); if((up_to_date && hasVisibleChildren() ) || // we fetched our children and some of them have passed the filter... @@ -920,7 +923,7 @@ void LLFolderViewItem::draw() LLColor4 filter_color = mLastFilterGeneration >= getRoot()->getFilter()->getCurrentGeneration() ? LLColor4(0.5f, 0.8f, 0.5f, 1.f) : LLColor4(0.8f, 0.5f, 0.5f, 1.f); sSmallFont->renderUTF8(mStatusText, 0, text_left, y, filter_color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE ); text_left = right_x; } @@ -928,26 +931,25 @@ void LLFolderViewItem::draw() if ( mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime") ) { - // *TODO: Translate - sFont->renderUTF8( std::string("Loading... "), 0, text_left, y, sSearchStatusColor, - LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, S32_MAX, S32_MAX, &right_x, FALSE); + sFont->renderUTF8(LLTrans::getString("LoadingData"), 0, text_left, y, sSearchStatusColor, + LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE); text_left = right_x; } sFont->renderUTF8( mLabel, 0, text_left, y, color, - LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, + LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE ); if (!mLabelSuffix.empty()) { sFont->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor, - LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, + LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE ); } if (sBoxImage.notNull() && mStringMatchOffset != std::string::npos) { // don't draw backgrounds for zero-length strings - S32 filter_string_length = mRoot->getFilterSubString().size(); + S32 filter_string_length = getRoot()->getFilterSubString().size(); if (filter_string_length > 0) { std::string combined_string = mLabel + mLabelSuffix; @@ -961,7 +963,7 @@ void LLFolderViewItem::draw() F32 match_string_left = text_left + sFont->getWidthF32(combined_string, 0, mStringMatchOffset); F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; sFont->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y, - sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, + sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW, filter_string_length, S32_MAX, &right_x, FALSE ); } } @@ -971,6 +973,13 @@ void LLFolderViewItem::draw() { drawDebugRect(); } + + //// *HACK: also draw debug rectangles around currently-being-edited LLView, and any elements that are being highlighted by GUI preview code (see LLFloaterUIPreview) + //std::set<LLView*>::iterator iter = std::find(sPreviewHighlightedElements.begin(), sPreviewHighlightedElements.end(), this); + //if ((sEditingUI && this == sEditingUIView) || (iter != sPreviewHighlightedElements.end() && sDrawPreviewHighlights)) + //{ + // drawDebugRect(); + //} } @@ -978,11 +987,8 @@ void LLFolderViewItem::draw() /// Class LLFolderViewFolder ///---------------------------------------------------------------------------- -// Default constructor -LLFolderViewFolder::LLFolderViewFolder( const std::string& name, LLUIImagePtr icon, - LLFolderView* root, - LLFolderViewEventListener* listener ): - LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time +LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): + LLFolderViewItem( p ), // 0 = no create time mIsOpen(FALSE), mExpanderHighlighted(FALSE), mCurHeight(0.f), @@ -1042,7 +1048,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) { // set last arrange generation first, in case children are animating // and need to be arranged again - mLastArrangeGeneration = mRoot->getArrangeGeneration(); + mLastArrangeGeneration = getRoot()->getArrangeGeneration(); if (mIsOpen) { // Add sizes of children @@ -1163,7 +1169,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) BOOL LLFolderViewFolder::needsArrange() { - return mLastArrangeGeneration < mRoot->getArrangeGeneration(); + return mLastArrangeGeneration < getRoot()->getArrangeGeneration(); } void LLFolderViewFolder::setCompletedFilterGeneration(S32 generation, BOOL recurse_up) @@ -1256,7 +1262,7 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter) if ((*fit)->getFiltered() || (*fit)->hasFilteredDescendants(filter.getMinRequiredGeneration())) { mMostFilteredDescendantGeneration = filter_generation; - if (mRoot->needsAutoSelect()) + if (getRoot()->needsAutoSelect()) { (*fit)->setOpenArrangeRecursively(TRUE); } @@ -1272,7 +1278,7 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter) if ((*fit)->getFiltered() || (*fit)->hasFilteredDescendants(filter_generation)) { mMostFilteredDescendantGeneration = filter_generation; - if (mRoot->needsAutoSelect()) + if (getRoot()->needsAutoSelect()) { (*fit)->setOpenArrangeRecursively(TRUE); } @@ -1346,7 +1352,7 @@ void LLFolderViewFolder::dirtyFilter() BOOL LLFolderViewFolder::hasFilteredDescendants() { - return mMostFilteredDescendantGeneration >= mRoot->getFilter()->getCurrentGeneration(); + return mMostFilteredDescendantGeneration >= getRoot()->getFilter()->getCurrentGeneration(); } // Passes selection information on to children and record selection @@ -2209,7 +2215,7 @@ BOOL LLFolderViewFolder::potentiallyVisible() // folder should be visible by it's own filter status return LLFolderViewItem::potentiallyVisible() // or one or more of its descendants have passed the minimum filter requirement - || hasFilteredDescendants(mRoot->getFilter()->getMinRequiredGeneration()) + || hasFilteredDescendants(getRoot()->getFilter()->getMinRequiredGeneration()) // or not all of its descendants have been checked against minimum filter requirement || getCompletedFilterGeneration() < getRoot()->getFilter()->getMinRequiredGeneration(); } @@ -2494,21 +2500,13 @@ void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item) ///---------------------------------------------------------------------------- // Default constructor -LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_icon, - const LLRect& rect, const LLUUID& source_id, LLView *parent_view ) : -#if LL_WINDOWS -#pragma warning( push ) -#pragma warning( disable : 4355 ) // warning C4355: 'this' : used in base member initializer list -#endif - LLFolderViewFolder( name, root_folder_icon, this, NULL ), -#if LL_WINDOWS -#pragma warning( pop ) -#endif +LLFolderView::LLFolderView(const Params& p) +: LLFolderViewFolder(p), mScrollContainer( NULL ), mPopupMenuHandle(), mAllowMultiSelect(TRUE), mShowFolderHierarchy(FALSE), - mSourceID(source_id), + mSourceID(p.task_id), mRenameItem( NULL ), mNeedsScroll( FALSE ), mLastScrollItem( NULL ), @@ -2517,16 +2515,16 @@ LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_ic mNeedsAutoRename(FALSE), mDebugFilters(FALSE), mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME), // This gets overridden by a pref immediately - mFilter(name), + mFilter(p.name), mShowSelectionContext(FALSE), mShowSingleSelection(FALSE), mArrangeGeneration(0), - mUserData(NULL), - mSelectCallback(NULL), mSignalSelectCallback(0), mMinWidth(0), - mDragAndDropThisFrame(FALSE) + mDragAndDropThisFrame(FALSE), + mCallbackRegistrar(NULL) { + LLRect rect = p.rect; LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom); setRect( rect ); reshape(rect.getWidth(), rect.getHeight()); @@ -2543,27 +2541,27 @@ LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_ic // just make sure the label ("Inventory Folder") never shows up mLabel = LLStringUtil::null; - mRenamer = new LLLineEditor(std::string("ren"), getRect(), LLStringUtil::null, sFont, - DB_INV_ITEM_NAME_STR_LEN, - &LLFolderView::commitRename, - NULL, - NULL, - this, - &LLLineEditor::prevalidatePrintableNotPipe); //mRenamer->setWriteableBgColor(LLColor4::white); // Escape is handled by reverting the rename, not commiting it (default behavior) - mRenamer->setCommitOnFocusLost(TRUE); - mRenamer->setVisible(FALSE); + LLLineEditor::Params params; + params.name("ren"); + params.rect(getRect()); + params.font(sFont); + params.max_length_bytes(DB_INV_ITEM_NAME_STR_LEN); + params.commit_callback.function(boost::bind(&LLFolderView::commitRename, this, _2)); + params.prevalidate_callback(&LLLineEditor::prevalidatePrintableNotPipe); + params.commit_on_focus_lost(true); + params.visible(false); + mRenamer = LLUICtrlFactory::create<LLLineEditor> (params); addChild(mRenamer); // make the popup menu available - LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_inventory.xml", parent_view); + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory.xml", p.parent_panel); if (!menu) { - menu = new LLMenuGL(LLStringUtil::null); + menu = LLUICtrlFactory::createDummyWidget<LLMenuGL>("inventory_menu"); } - menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); - menu->setVisible(FALSE); + menu->setBackgroundColor(gSavedSkinSettings.getColor("MenuPopupBgColor")); mPopupMenuHandle = menu->getHandle(); setTabStop(TRUE); @@ -2674,7 +2672,7 @@ void LLFolderView::closeAllFolders() void LLFolderView::openFolder(const std::string& foldername) { - LLFolderViewFolder* inv = getChild<LLFolderViewFolder>(foldername); + LLFolderViewFolder* inv = findChild<LLFolderViewFolder>(foldername); if (inv) { setSelection(inv, FALSE, FALSE); @@ -2700,7 +2698,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen mHasVisibleChildren = hasFilteredDescendants(filter_generation); // arrange always finishes, so optimistically set the arrange generation to the most current - mLastArrangeGeneration = mRoot->getArrangeGeneration(); + mLastArrangeGeneration = getRoot()->getArrangeGeneration(); LLInventoryFilter::EFolderShow show_folder_state = getRoot()->getShowFolderState(); @@ -3113,24 +3111,21 @@ BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source) return can_drag; } -void LLFolderView::commitRename( LLUICtrl* renamer, void* user_data ) +void LLFolderView::commitRename( const LLSD& data ) { - LLFolderView* root = reinterpret_cast<LLFolderView*>(user_data); - if( root ) - { - root->finishRenamingItem(); - } + finishRenamingItem(); } void LLFolderView::draw() { + static LLCachedControl<LLColor4> sSearchStatusColor(gSavedSkinSettings, "InventorySearchStatusColor", DEFAULT_WHITE); if (mDebugFilters) { std::string current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", mFilter.getCurrentGeneration(), mFilter.getMinRequiredGeneration(), mFilter.getMustPassGeneration()); sSmallFont->renderUTF8(current_filter_string, 0, 2, getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } // if cursor has moved off of me during drag and drop @@ -3176,13 +3171,13 @@ void LLFolderView::draw() { if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter.getMinRequiredGeneration()) { - mStatusText = std::string("Searching..."); // *TODO:translate - sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); + mStatusText = LLTrans::getString("Searching"); + sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } else { - mStatusText = std::string("No matching items found in inventory."); // *TODO:translate - sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); + mStatusText = LLTrans::getString("InventoryNoMatchingItems"); + sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } } @@ -3347,11 +3342,8 @@ void LLFolderView::openSelectedItems( void ) } else { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLMultiPreview* multi_previewp = new LLMultiPreview(LLRect(left, top, left + 300, top - 100)); - gFloaterView->getNewFloaterPosition(&left, &top); - LLMultiProperties* multi_propertiesp = new LLMultiProperties(LLRect(left, top, left + 300, top - 100)); + LLMultiPreview* multi_previewp = new LLMultiPreview(); + LLMultiProperties* multi_propertiesp = new LLMultiProperties(); selected_items_t::iterator item_it; for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) @@ -3371,8 +3363,8 @@ void LLFolderView::openSelectedItems( void ) LLFloater::setFloaterHost(NULL); // *NOTE: LLMulti* will safely auto-delete when open'd // without any children. - multi_previewp->open(); - multi_propertiesp->open(); + multi_previewp->openFloater(LLSD()); + multi_propertiesp->openFloater(LLSD()); } } } @@ -3389,10 +3381,7 @@ void LLFolderView::propertiesSelectedItems( void ) } else { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - - LLMultiProperties* multi_propertiesp = new LLMultiProperties(LLRect(left, top, left + 100, top - 100)); + LLMultiProperties* multi_propertiesp = new LLMultiProperties(); LLFloater::setFloaterHost(multi_propertiesp); @@ -3403,7 +3392,7 @@ void LLFolderView::propertiesSelectedItems( void ) } LLFloater::setFloaterHost(NULL); - multi_propertiesp->open(); /* Flawfinder: ignore */ + multi_propertiesp->openFloater(LLSD()); } } } @@ -3631,7 +3620,7 @@ void LLFolderView::startRenamingSelectedItem( void ) mRenamer->setVisible( TRUE ); // set focus will fail unless item is visible mRenamer->setFocus( TRUE ); - mRenamer->setLostTopCallback(onRenamerLost); + mRenamer->setTopLostCallback(onRenamerLost); gFocusMgr.setTopCtrl( mRenamer ); } } @@ -4037,6 +4026,8 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if(handled && (count > 0) && menu) { + if (mCallbackRegistrar) + mCallbackRegistrar->pushScope(); //menu->empty(); const LLView::child_list_t *list = menu->getChildList(); @@ -4056,9 +4047,10 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) flags = 0x0; } - menu->arrange(); menu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(this, menu, x, y); + if (mCallbackRegistrar) + mCallbackRegistrar->popScope(); } else { @@ -4295,11 +4287,11 @@ void LLFolderView::doIdle() } } - if (mSignalSelectCallback && mSelectCallback) + if (mSignalSelectCallback) { //RN: we use keyboard focus as a proxy for user-explicit actions BOOL take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); - mSelectCallback(mSelectedItems, take_keyboard_focus, mUserData); + mSelectSignal(mSelectedItems, take_keyboard_focus); } mSignalSelectCallback = FALSE; } @@ -4400,9 +4392,13 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde } //static -void LLFolderView::onRenamerLost( LLUICtrl* renamer, void* user_data) +void LLFolderView::onRenamerLost( LLFocusableElement* renamer, void* user_data) { - renamer->setVisible(FALSE); + LLUICtrl* uictrl = dynamic_cast<LLUICtrl*>(renamer); + if (uictrl) + { + uictrl->setVisible(FALSE); + } } void delete_selected_item(void* user_data) @@ -4823,133 +4819,156 @@ std::string LLInventoryFilter::getFilterText() if (isFilterWith(LLInventoryType::IT_ANIMATION)) { - filtered_types += " Animations,"; + //filtered_types += " Animations,"; + filtered_types += LLTrans::getString("Animations"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Animations,"; + //not_filtered_types += " Animations,"; + not_filtered_types += LLTrans::getString("Animations"); + filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_CALLINGCARD)) { - filtered_types += " Calling Cards,"; + //filtered_types += " Calling Cards,"; + filtered_types += LLTrans::getString("Calling Cards"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Calling Cards,"; + //not_filtered_types += " Calling Cards,"; + not_filtered_types += LLTrans::getString("Calling Cards"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_WEARABLE)) { - filtered_types += " Clothing,"; + //filtered_types += " Clothing,"; + filtered_types += LLTrans::getString("Clothing"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Clothing,"; + //not_filtered_types += " Clothing,"; + not_filtered_types += LLTrans::getString("Clothing"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_GESTURE)) { - filtered_types += " Gestures,"; + //filtered_types += " Gestures,"; + filtered_types += LLTrans::getString("Gestures"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Gestures,"; + //not_filtered_types += " Gestures,"; + not_filtered_types += LLTrans::getString("Gestures"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_LANDMARK)) { - filtered_types += " Landmarks,"; + //filtered_types += " Landmarks,"; + filtered_types += LLTrans::getString("Landmarks"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Landmarks,"; + //not_filtered_types += " Landmarks,"; + not_filtered_types += LLTrans::getString("Landmarks"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_NOTECARD)) { - filtered_types += " Notecards,"; + //filtered_types += " Notecards,"; + filtered_types += LLTrans::getString("Notecards"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Notecards,"; + //not_filtered_types += " Notecards,"; + not_filtered_types += LLTrans::getString("Notecards"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_OBJECT) && isFilterWith(LLInventoryType::IT_ATTACHMENT)) { - filtered_types += " Objects,"; + //filtered_types += " Objects,"; + filtered_types += LLTrans::getString("Objects"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Objects,"; + //not_filtered_types += " Objects,"; + not_filtered_types += LLTrans::getString("Objects"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_LSL)) { - filtered_types += " Scripts,"; + //filtered_types += " Scripts,"; + filtered_types += LLTrans::getString("Scripts"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Scripts,"; + //not_filtered_types += " Scripts,"; + not_filtered_types += LLTrans::getString("Scripts"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_SOUND)) { - filtered_types += " Sounds,"; + //filtered_types += " Sounds,"; + filtered_types += LLTrans::getString("Sounds"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Sounds,"; + //not_filtered_types += " Sounds,"; + not_filtered_types += LLTrans::getString("Sounds"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_TEXTURE)) { - filtered_types += " Textures,"; + //filtered_types += " Textures,"; + filtered_types += LLTrans::getString("Textures"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Textures,"; + //not_filtered_types += " Textures,"; + not_filtered_types += LLTrans::getString("Textures"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_SNAPSHOT)) { - filtered_types += " Snapshots,"; + //filtered_types += " Snapshots,"; + filtered_types += LLTrans::getString("Snapshots"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Snapshots,"; + //not_filtered_types += " Snapshots,"; + not_filtered_types += LLTrans::getString("Snapshots"); filtered_by_all_types = FALSE; } @@ -4962,7 +4981,8 @@ std::string LLInventoryFilter::getFilterText() } else { - mFilterText += "No "; + //mFilterText += "No "; + mFilterText += LLTrans::getString("No Filters"); mFilterText += not_filtered_types; } // remove the ',' at the end @@ -4971,7 +4991,8 @@ std::string LLInventoryFilter::getFilterText() if (isSinceLogoff()) { - mFilterText += " - Since Logoff"; + //mFilterText += " - Since Logoff"; + mFilterText += LLTrans::getString("Since Logoff"); } return mFilterText; } |