Inv menus appear now. Still need to update llmenugl and its variants, since our current version is buggy. Also need to look into why inventory postfixes aren't appearing.
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "llinventoryfilter.h"
|
||||
#include "llinventoryfunctions.h"
|
||||
#include "llinventorymodelbackgroundfetch.h"
|
||||
#include "llinventorypanel.h"
|
||||
#include "llfoldertype.h"
|
||||
#include "llkeyboard.h"
|
||||
#include "lllineeditor.h"
|
||||
@@ -196,7 +197,7 @@ 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, LLFolderViewEventListener* listener ) :
|
||||
const LLRect& rect, const LLUUID& source_id, LLPanel *parent_view, LLFolderViewEventListener* listener ) :
|
||||
#if LL_WINDOWS
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4355 ) // warning C4355: 'this' : used in base member initializer list
|
||||
@@ -205,6 +206,7 @@ LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_ic
|
||||
#if LL_WINDOWS
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
mRunningHeight(0),
|
||||
mScrollContainer( NULL ),
|
||||
mPopupMenuHandle(),
|
||||
mAllowMultiSelect(TRUE),
|
||||
@@ -225,8 +227,10 @@ LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_ic
|
||||
mArrangeGeneration(0),
|
||||
mSignalSelectCallback(0),
|
||||
mMinWidth(0),
|
||||
mDragAndDropThisFrame(FALSE)
|
||||
mDragAndDropThisFrame(FALSE),
|
||||
mParentPanel(parent_view)
|
||||
{
|
||||
mRoot = this;
|
||||
LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom);
|
||||
setRect( rect );
|
||||
reshape(rect.getWidth(), rect.getHeight());
|
||||
@@ -267,6 +271,8 @@ LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_ic
|
||||
mPopupMenuHandle = menu->getHandle();
|
||||
|
||||
setTabStop(TRUE);
|
||||
|
||||
mListener->openItem();
|
||||
}
|
||||
|
||||
// Destroys the object
|
||||
@@ -282,23 +288,12 @@ LLFolderView::~LLFolderView( void )
|
||||
mScrollContainer = NULL;
|
||||
mRenameItem = NULL;
|
||||
mRenamer = NULL;
|
||||
gFocusMgr.releaseFocusIfNeeded( this );
|
||||
|
||||
if( gEditMenuHandler == this )
|
||||
{
|
||||
gEditMenuHandler = NULL;
|
||||
}
|
||||
|
||||
mAutoOpenItems.removeAllNodes();
|
||||
gIdleCallbacks.deleteFunction(idle, this);
|
||||
|
||||
if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die();
|
||||
|
||||
if(mRenamer == gFocusMgr.getTopCtrl())
|
||||
{
|
||||
gFocusMgr.setTopCtrl(NULL);
|
||||
}
|
||||
|
||||
mAutoOpenItems.removeAllNodes();
|
||||
clearSelection();
|
||||
mItems.clear();
|
||||
@@ -447,6 +442,16 @@ void LLFolderView::openFolder(const std::string& foldername)
|
||||
}
|
||||
}
|
||||
|
||||
void LLFolderView::openTopLevelFolders()
|
||||
{
|
||||
for (folders_t::iterator iter = mFolders.begin();
|
||||
iter != mFolders.end();)
|
||||
{
|
||||
folders_t::iterator fit = iter++;
|
||||
(*fit)->setOpen(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFolderView::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse)
|
||||
{
|
||||
// call base class to do proper recursion
|
||||
@@ -460,6 +465,18 @@ static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange");
|
||||
// This view grows and shinks to enclose all of its children items and folders.
|
||||
S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_generation )
|
||||
{
|
||||
if(!mScrollContainer)
|
||||
return 1;
|
||||
if (getListener()->getUUID().notNull())
|
||||
{
|
||||
if (mNeedsSort)
|
||||
{
|
||||
mFolders.sort(mSortFunction);
|
||||
mItems.sort(mSortFunction);
|
||||
mNeedsSort = false;
|
||||
}
|
||||
}
|
||||
|
||||
LLFastTimer t2(FTM_ARRANGE);
|
||||
|
||||
filter_generation = mFilter->getMinRequiredGeneration();
|
||||
@@ -529,17 +546,21 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen
|
||||
}
|
||||
}
|
||||
|
||||
S32 dummy_s32;
|
||||
BOOL dummy_bool;
|
||||
S32 min_width;
|
||||
mScrollContainer->calcVisibleSize( &min_width, &dummy_s32, &dummy_bool, &dummy_bool);
|
||||
reshape( llmax(min_width, total_width), running_height );
|
||||
|
||||
S32 new_min_width;
|
||||
mScrollContainer->calcVisibleSize( &new_min_width, &dummy_s32, &dummy_bool, &dummy_bool);
|
||||
if (new_min_width != min_width)
|
||||
/*if(!mHasVisibleChildren)// is there any filtered items ?
|
||||
{
|
||||
reshape( llmax(min_width, total_width), running_height );
|
||||
//Nope. We need to display status textbox, let's reserve some place for it
|
||||
running_height = mStatusTextBox->getTextPixelHeight();
|
||||
target_height = running_height;
|
||||
}*/
|
||||
|
||||
mRunningHeight = running_height;
|
||||
LLRect scroll_rect = mScrollContainer->getContentWindowRect();
|
||||
reshape( llmax(scroll_rect.getWidth(), total_width), running_height );
|
||||
|
||||
LLRect new_scroll_rect = mScrollContainer->getContentWindowRect();
|
||||
if (new_scroll_rect.getWidth() != scroll_rect.getWidth())
|
||||
{
|
||||
reshape( llmax(scroll_rect.getWidth(), total_width), running_height );
|
||||
}
|
||||
|
||||
// move item renamer text field to item's new position
|
||||
@@ -575,14 +596,14 @@ void LLFolderView::filter( LLInventoryFilter& filter )
|
||||
|
||||
void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent)
|
||||
{
|
||||
S32 min_width = 0;
|
||||
S32 dummy_height;
|
||||
BOOL dummy_bool;
|
||||
LLRect scroll_rect;
|
||||
if (mScrollContainer)
|
||||
{
|
||||
mScrollContainer->calcVisibleSize( &min_width, &dummy_height, &dummy_bool, &dummy_bool);
|
||||
LLView::reshape(width, height, called_from_parent);
|
||||
scroll_rect = mScrollContainer->getContentWindowRect();
|
||||
}
|
||||
width = llmax(mMinWidth, min_width);
|
||||
width = llmax(mMinWidth, scroll_rect.getWidth());
|
||||
height = llmax(mRunningHeight, scroll_rect.getHeight());
|
||||
LLView::reshape(width, height, called_from_parent);
|
||||
|
||||
mReshapeSignal(mSelectedItems, FALSE);
|
||||
@@ -643,6 +664,8 @@ LLFolderViewItem* LLFolderView::getCurSelectedItem( void )
|
||||
BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
|
||||
BOOL take_keyboard_focus)
|
||||
{
|
||||
mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS;
|
||||
|
||||
if( selection == this )
|
||||
{
|
||||
return FALSE;
|
||||
@@ -650,7 +673,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
|
||||
|
||||
if( selection && take_keyboard_focus)
|
||||
{
|
||||
setFocus(TRUE);
|
||||
mParentPanel->setFocus(TRUE);
|
||||
}
|
||||
|
||||
// clear selection down here because change of keyboard focus can potentially
|
||||
@@ -670,8 +693,6 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
|
||||
|
||||
llassert(mSelectedItems.size() <= 1);
|
||||
|
||||
mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -921,10 +942,6 @@ void LLFolderView::draw()
|
||||
{
|
||||
closeAutoOpenedFolders();
|
||||
}
|
||||
if(this == gFocusMgr.getKeyboardFocus() && !getVisible())
|
||||
{
|
||||
gFocusMgr.setKeyboardFocus( NULL );
|
||||
}
|
||||
|
||||
// while dragging, update selection rendering to reflect single/multi drag status
|
||||
if (LLToolDragAndDrop::getInstance()->hasMouseCapture())
|
||||
@@ -996,11 +1013,40 @@ void LLFolderView::closeRenamer( void )
|
||||
{
|
||||
if (mRenamer && mRenamer->getVisible())
|
||||
{
|
||||
if(mRenamer == gFocusMgr.getTopCtrl())
|
||||
gFocusMgr.setTopCtrl( NULL );
|
||||
// Triggers onRenamerLost() that actually closes the renamer.
|
||||
gFocusMgr.setTopCtrl( NULL );
|
||||
//gFocusMgr.setTopCtrl( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector<LLFolderViewItem*>& selectedItems)
|
||||
{
|
||||
LLFolderViewItem* item_parent = dynamic_cast<LLFolderViewItem*>(item->getParent());
|
||||
|
||||
if (item_parent)
|
||||
{
|
||||
for(std::vector<LLFolderViewItem*>::const_iterator it = selectedItems.begin(); it != selectedItems.end(); ++it)
|
||||
{
|
||||
const LLFolderViewItem* const selected_item = (*it);
|
||||
|
||||
LLFolderViewItem* parent = item_parent;
|
||||
|
||||
while (parent)
|
||||
{
|
||||
if (selected_item == parent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
parent = dynamic_cast<LLFolderViewItem*>(parent->getParent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LLFolderView::removeSelectedItems( void )
|
||||
{
|
||||
if(getVisible() && getEnabled())
|
||||
@@ -1049,11 +1095,11 @@ void LLFolderView::removeSelectedItems( void )
|
||||
// change selection on successful delete
|
||||
if (new_selection)
|
||||
{
|
||||
setSelectionFromRoot(new_selection, new_selection->isOpen(), hasFocus());
|
||||
setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel->hasFocus());
|
||||
}
|
||||
else
|
||||
{
|
||||
setSelectionFromRoot(NULL, hasFocus());
|
||||
setSelectionFromRoot(NULL, mParentPanel->hasFocus());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1072,18 +1118,18 @@ void LLFolderView::removeSelectedItems( void )
|
||||
if (!new_selection)
|
||||
{
|
||||
new_selection = last_item->getPreviousOpenNode(FALSE);
|
||||
while (new_selection && (new_selection->isSelected()/* || isDescendantOfASelectedItem(new_selection, items)*/))
|
||||
while (new_selection && (new_selection->isSelected() || isDescendantOfASelectedItem(new_selection, items)))
|
||||
{
|
||||
new_selection = new_selection->getPreviousOpenNode(FALSE);
|
||||
}
|
||||
}
|
||||
if (new_selection)
|
||||
{
|
||||
setSelectionFromRoot(new_selection, new_selection->isOpen(), hasFocus());
|
||||
setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel->hasFocus());
|
||||
}
|
||||
else
|
||||
{
|
||||
setSelectionFromRoot(NULL, hasFocus());
|
||||
setSelectionFromRoot(NULL, mParentPanel->hasFocus());
|
||||
}
|
||||
|
||||
for(S32 i = 0; i < count; ++i)
|
||||
@@ -1432,19 +1478,6 @@ void LLFolderView::startRenamingSelectedItem( void )
|
||||
}
|
||||
}
|
||||
|
||||
void LLFolderView::setFocus(BOOL focus)
|
||||
{
|
||||
if (focus)
|
||||
{
|
||||
if(!hasFocus())
|
||||
{
|
||||
gEditMenuHandler = this;
|
||||
}
|
||||
}
|
||||
|
||||
LLFolderViewFolder::setFocus(focus);
|
||||
}
|
||||
|
||||
BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
|
||||
{
|
||||
BOOL handled = FALSE;
|
||||
@@ -1647,7 +1680,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
|
||||
break;
|
||||
}
|
||||
|
||||
if (!handled && hasFocus())
|
||||
if (!handled && mParentPanel->hasFocus())
|
||||
{
|
||||
if (key == KEY_BACKSPACE)
|
||||
{
|
||||
@@ -1679,7 +1712,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char)
|
||||
}
|
||||
|
||||
BOOL handled = FALSE;
|
||||
if (hasFocus())
|
||||
if (mParentPanel->hasFocus())
|
||||
{
|
||||
// SL-51858: Key presses are not being passed to the Popup menu.
|
||||
// A proper fix is non-trivial so instead just close the menu.
|
||||
@@ -1736,20 +1769,13 @@ BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask )
|
||||
mKeyboardSelection = FALSE;
|
||||
mSearchString.clear();
|
||||
|
||||
setFocus(TRUE);
|
||||
mParentPanel->setFocus(TRUE);
|
||||
|
||||
LLEditMenuHandler::gEditMenuHandler = this;
|
||||
|
||||
return LLView::handleMouseDown( x, y, mask );
|
||||
}
|
||||
|
||||
void LLFolderView::onFocusLost( )
|
||||
{
|
||||
if( gEditMenuHandler == this )
|
||||
{
|
||||
gEditMenuHandler = NULL;
|
||||
}
|
||||
LLUICtrl::onFocusLost();
|
||||
}
|
||||
|
||||
BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward)
|
||||
{
|
||||
// get first selected item
|
||||
@@ -1826,35 +1852,21 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
// all user operations move keyboard focus to inventory
|
||||
// this way, we know when to stop auto-updating a search
|
||||
setFocus(TRUE);
|
||||
mParentPanel->setFocus(TRUE);
|
||||
|
||||
BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL;
|
||||
S32 count = mSelectedItems.size();
|
||||
LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
|
||||
if(handled && (count > 0) && menu)
|
||||
if ( handled
|
||||
&& ( count > 0 && (hasVisibleChildren() || mFilter->getShowFolderState() == LLInventoryFilter::SHOW_ALL_FOLDERS) ) // show menu only if selected items are visible
|
||||
&& menu )
|
||||
{
|
||||
//menu->empty();
|
||||
const LLView::child_list_t *list = menu->getChildList();
|
||||
|
||||
LLView::child_list_t::const_iterator menu_itor;
|
||||
for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor)
|
||||
{
|
||||
(*menu_itor)->setVisible(TRUE);
|
||||
(*menu_itor)->setEnabled(TRUE);
|
||||
}
|
||||
|
||||
// Successively filter out invalid options
|
||||
selected_items_t::iterator item_itor;
|
||||
U32 flags = FIRST_SELECTED_ITEM;
|
||||
for (item_itor = mSelectedItems.begin(); item_itor != mSelectedItems.end(); ++item_itor)
|
||||
{
|
||||
(*item_itor)->buildContextMenu(*menu, flags);
|
||||
flags = 0x0;
|
||||
}
|
||||
|
||||
menu->arrange();
|
||||
updateMenuOptions(menu);
|
||||
|
||||
menu->updateParent(LLMenuGL::sMenuContainer);
|
||||
LLMenuGL::showPopup(this, menu, x, y);
|
||||
|
||||
menu->needsArrange(); // update menu height if needed
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1867,6 +1879,37 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
|
||||
return handled;
|
||||
}
|
||||
|
||||
// Add "--no options--" if the menu is completely blank.
|
||||
BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const
|
||||
{
|
||||
const std::string nooptions_str = "--no options--";
|
||||
LLView *nooptions_item = NULL;
|
||||
|
||||
const LLView::child_list_t *list = menu->getChildList();
|
||||
for (LLView::child_list_t::const_iterator itor = list->begin();
|
||||
itor != list->end();
|
||||
++itor)
|
||||
{
|
||||
LLView *menu_item = (*itor);
|
||||
if (menu_item->getVisible())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
std::string name = menu_item->getName();
|
||||
if (menu_item->getName() == nooptions_str)
|
||||
{
|
||||
nooptions_item = menu_item;
|
||||
}
|
||||
}
|
||||
if (nooptions_item)
|
||||
{
|
||||
nooptions_item->setVisible(TRUE);
|
||||
nooptions_item->setEnabled(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLFolderView::handleHover( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
return LLView::handleHover( x, y, mask );
|
||||
@@ -1901,21 +1944,25 @@ BOOL LLFolderView::handleScrollWheel(S32 x, S32 y, S32 clicks)
|
||||
|
||||
void LLFolderView::deleteAllChildren()
|
||||
{
|
||||
if(mRenamer == gFocusMgr.getTopCtrl())
|
||||
{
|
||||
gFocusMgr.setTopCtrl(NULL);
|
||||
}
|
||||
LLView::deleteViewByHandle(mPopupMenuHandle);
|
||||
closeRenamer();
|
||||
if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die();
|
||||
mPopupMenuHandle = LLHandle<LLView>();
|
||||
mRenamer = NULL;
|
||||
mScrollContainer = NULL;
|
||||
mRenameItem = NULL;
|
||||
mRenamer = NULL;
|
||||
clearSelection();
|
||||
LLView::deleteAllChildren();
|
||||
}
|
||||
|
||||
void LLFolderView::scrollToShowSelection()
|
||||
{
|
||||
if (mSelectedItems.size())
|
||||
// If items are filtered while background fetch is in progress
|
||||
// scrollbar resets to the first filtered item. See EXT-3981.
|
||||
// However we allow scrolling for folder views with mAutoSelectOverride
|
||||
// (used in Places SP) as an exception because the selection in them
|
||||
// is not reset during items filtering. See STORM-133.
|
||||
if ( (!LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() || mAutoSelectOverride)
|
||||
&& mSelectedItems.size() )
|
||||
{
|
||||
mNeedsScroll = TRUE;
|
||||
}
|
||||
@@ -1925,6 +1972,7 @@ void LLFolderView::scrollToShowSelection()
|
||||
// is maximally visible.
|
||||
void LLFolderView::scrollToShowItem(LLFolderViewItem* item)
|
||||
{
|
||||
if (!mScrollContainer) return;
|
||||
// don't scroll to items when mouse is being used to scroll/drag and drop
|
||||
if (gFocusMgr.childHasMouseCapture(mScrollContainer))
|
||||
{
|
||||
@@ -2015,7 +2063,7 @@ LLFastTimer::DeclareTimer FTM_GET_ITEM_BY_ID("Get FolderViewItem by ID");
|
||||
LLFolderViewItem* LLFolderView::getItemByID(const LLUUID& id)
|
||||
{
|
||||
LLFastTimer _(FTM_GET_ITEM_BY_ID);
|
||||
if (id.isNull())
|
||||
if (id == getListener()->getUUID())
|
||||
{
|
||||
return this;
|
||||
}
|
||||
@@ -2030,6 +2078,25 @@ LLFolderViewItem* LLFolderView::getItemByID(const LLUUID& id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LLFolderViewFolder* LLFolderView::getFolderByID(const LLUUID& id)
|
||||
{
|
||||
if (id == getListener()->getUUID())
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
for (folders_t::iterator iter = mFolders.begin();
|
||||
iter != mFolders.end();
|
||||
++iter)
|
||||
{
|
||||
LLFolderViewFolder *folder = (*iter);
|
||||
if (folder->getListener()->getUUID() == id)
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_AUTO_SELECT("Open and Select");
|
||||
@@ -2038,6 +2105,14 @@ extern std::set<LLFolderViewItem*> sFolderViewItems; //dumb hack
|
||||
// Main idle routine
|
||||
void LLFolderView::doIdle()
|
||||
{
|
||||
// If this is associated with the user's inventory, don't do anything
|
||||
// until that inventory is loaded up.
|
||||
const LLInventoryPanel *inventory_panel = dynamic_cast<LLInventoryPanel*>(mParentPanel);
|
||||
if (inventory_panel && !inventory_panel->getIsViewsInitialized())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLFastTimer t2(FTM_INVENTORY);
|
||||
|
||||
BOOL debug_filters = gSavedSettings.getBOOL("DebugInventoryFilters");
|
||||
@@ -2078,12 +2153,21 @@ void LLFolderView::doIdle()
|
||||
clearSelection();
|
||||
requestArrange();
|
||||
}
|
||||
else if (!mAutoSelectOverride && (!selected_itemp || !selected_itemp->getFiltered()))
|
||||
else if ((selected_itemp && !selected_itemp->getFiltered()) && !mAutoSelectOverride)
|
||||
{
|
||||
// select first filtered item
|
||||
LLSelectFirstFilteredItem filter;
|
||||
applyFunctorRecursively(filter);
|
||||
}
|
||||
|
||||
// Open filtered folders for folder views with mAutoSelectOverride=TRUE.
|
||||
// Used by LLPlacesFolderView.
|
||||
if (mAutoSelectOverride && !mFilter->getFilterSubString().empty())
|
||||
{
|
||||
LLOpenFilteredFolders filter;
|
||||
applyFunctorRecursively(filter);
|
||||
}
|
||||
|
||||
scrollToShowSelection();
|
||||
}
|
||||
|
||||
@@ -2155,8 +2239,7 @@ void LLFolderView::updateRenamerPosition()
|
||||
LLRect scroller_rect(0, 0, gViewerWindow->getWindowWidthScaled(), 0);
|
||||
if (mScrollContainer)
|
||||
{
|
||||
BOOL dummy_bool;
|
||||
mScrollContainer->calcVisibleSize( &scroller_rect.mRight, &scroller_rect.mTop, &dummy_bool, &dummy_bool);
|
||||
scroller_rect = mScrollContainer->getContentWindowRect();
|
||||
}
|
||||
|
||||
S32 width = llmax(llmin(mRenameItem->getRect().getWidth() - x, scroller_rect.getWidth() - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH);
|
||||
@@ -2164,13 +2247,64 @@ void LLFolderView::updateRenamerPosition()
|
||||
mRenamer->reshape( width, height, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
// Update visibility and availability (i.e. enabled/disabled) of context menu items.
|
||||
void LLFolderView::updateMenuOptions(LLMenuGL* menu)
|
||||
{
|
||||
const LLView::child_list_t *list = menu->getChildList();
|
||||
|
||||
LLView::child_list_t::const_iterator menu_itor;
|
||||
for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor)
|
||||
{
|
||||
(*menu_itor)->setVisible(FALSE);
|
||||
(*menu_itor)->pushVisible(TRUE);
|
||||
(*menu_itor)->setEnabled(TRUE);
|
||||
}
|
||||
|
||||
// Successively filter out invalid options
|
||||
|
||||
U32 flags = FIRST_SELECTED_ITEM;
|
||||
for (selected_items_t::iterator item_itor = mSelectedItems.begin();
|
||||
item_itor != mSelectedItems.end();
|
||||
++item_itor)
|
||||
{
|
||||
LLFolderViewItem* selected_item = (*item_itor);
|
||||
selected_item->buildContextMenu(*menu, flags);
|
||||
flags = 0x0;
|
||||
}
|
||||
|
||||
addNoOptions(menu);
|
||||
}
|
||||
|
||||
// Refresh the context menu (that is already shown).
|
||||
void LLFolderView::updateMenu()
|
||||
{
|
||||
LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
|
||||
if (menu && menu->getVisible())
|
||||
{
|
||||
updateMenuOptions(menu);
|
||||
menu->needsArrange(); // update menu height if needed
|
||||
}
|
||||
}
|
||||
///----------------------------------------------------------------------------
|
||||
/// Local function definitions
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
void LLFolderView::onRenamerLost()
|
||||
{
|
||||
if (mRenamer && mRenamer->getVisible())
|
||||
{
|
||||
mRenamer->setVisible(FALSE);
|
||||
|
||||
// will commit current name (which could be same as original name)
|
||||
mRenamer->setFocus(FALSE);
|
||||
}
|
||||
|
||||
if( mRenameItem )
|
||||
{
|
||||
setSelectionFromRoot( mRenameItem, TRUE );
|
||||
mRenameItem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
LLInventoryFilter* LLFolderView::getFilter()
|
||||
|
||||
Reference in New Issue
Block a user