[MAINT-2287] Handle refactor

This commit is contained in:
Inusaito Sayori
2014-02-06 14:51:36 -05:00
parent 32ec2be0b6
commit b6225d1d9a
8 changed files with 151 additions and 132 deletions

View File

@@ -111,7 +111,6 @@ LLFloaterOutbox::LLFloaterOutbox(const LLSD& key)
, mInventoryText(NULL) , mInventoryText(NULL)
, mInventoryTitle(NULL) , mInventoryTitle(NULL)
, mOutboxId(LLUUID::null) , mOutboxId(LLUUID::null)
, mOutboxInventoryPanel(NULL)
, mOutboxItemCount(0) , mOutboxItemCount(0)
, mOutboxTopLevelDropZone(NULL) , mOutboxTopLevelDropZone(NULL)
// , mWindowShade(NULL) // , mWindowShade(NULL)
@@ -149,11 +148,10 @@ BOOL LLFloaterOutbox::postBuild()
mImportButton = getChild<LLButton>("outbox_import_btn"); mImportButton = getChild<LLButton>("outbox_import_btn");
mImportButton->setCommitCallback(boost::bind(&LLFloaterOutbox::onImportButtonClicked, this)); mImportButton->setCommitCallback(boost::bind(&LLFloaterOutbox::onImportButtonClicked, this));
//
// Set up the outbox inventory view // Set up the outbox inventory view
// LLInventoryPanel* inventory_panel = getChild<LLInventoryPanel>("panel_outbox_inventory");
mOutboxInventoryPanel = getChild<LLInventoryPanel>("panel_outbox_inventory"); mOutboxInventoryPanel = inventory_panel->getInventoryPanelHandle();
llassert(mOutboxInventoryPanel); llassert(mOutboxInventoryPanel.get() != NULL);
mOutboxTopLevelDropZone = getChild<LLPanel>("outbox_generic_drag_target"); mOutboxTopLevelDropZone = getChild<LLPanel>("outbox_generic_drag_target");
@@ -256,14 +254,15 @@ void LLFloaterOutbox::setupOutbox()
// Set up the outbox inventory view // Set up the outbox inventory view
// Singu Note: we handle this in postBuild, grabbing the panel from the built xml. // Singu Note: we handle this in postBuild, grabbing the panel from the built xml.
LLInventoryPanel* inventory_panel = mOutboxInventoryPanel.get();
// Reshape the inventory to the proper size // Reshape the inventory to the proper size
LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect();
mOutboxInventoryPanel->setShape(inventory_placeholder_rect); inventory_panel->setShape(inventory_placeholder_rect);
// Set the sort order newest to oldest // Set the sort order newest to oldest
mOutboxInventoryPanel->setSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME); inventory_panel->setSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME);
mOutboxInventoryPanel->getFilter()->markDefault(); inventory_panel->getFilter()->markDefault();
// Get the content of the outbox // Get the content of the outbox
fetchOutboxContents(); fetchOutboxContents();
@@ -292,6 +291,8 @@ void LLFloaterOutbox::setStatusString(const std::string& statusString)
void LLFloaterOutbox::updateFolderCount() void LLFloaterOutbox::updateFolderCount()
{ {
if (mOutboxInventoryPanel.get() && mOutboxId.notNull())
{
S32 item_count = 0; S32 item_count = 0;
if (mOutboxId.notNull()) if (mOutboxId.notNull())
@@ -304,6 +305,7 @@ void LLFloaterOutbox::updateFolderCount()
} }
mOutboxItemCount = item_count; mOutboxItemCount = item_count;
}
if (!mImportBusy) if (!mImportBusy)
{ {
@@ -313,7 +315,7 @@ void LLFloaterOutbox::updateFolderCount()
void LLFloaterOutbox::updateFolderCountStatus() void LLFloaterOutbox::updateFolderCountStatus()
{ {
if (mOutboxInventoryPanel) if (mOutboxInventoryPanel.get() && mOutboxId.notNull())
{ {
switch (mOutboxItemCount) switch (mOutboxItemCount)
{ {
@@ -339,18 +341,19 @@ void LLFloaterOutbox::updateView()
{ {
//updateView() is called twice the first time. //updateView() is called twice the first time.
updateFolderCount(); updateFolderCount();
LLInventoryPanel* panel = mOutboxInventoryPanel.get();
if (mOutboxItemCount > 0) if (mOutboxItemCount > 0)
{ {
mOutboxInventoryPanel->setVisible(TRUE); panel->setVisible(TRUE);
mInventoryPlaceholder->setVisible(FALSE); mInventoryPlaceholder->setVisible(FALSE);
mOutboxTopLevelDropZone->setVisible(TRUE); mOutboxTopLevelDropZone->setVisible(TRUE);
} }
else else
{ {
if (mOutboxInventoryPanel) if (panel)
{ {
mOutboxInventoryPanel->setVisible(FALSE); panel->setVisible(FALSE);
} }
// Show the drop zone if there is an outbox folder // Show the drop zone if there is an outbox folder
@@ -436,7 +439,7 @@ BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EAcceptance* accept, EAcceptance* accept,
std::string& tooltip_msg) std::string& tooltip_msg)
{ {
if ((mOutboxInventoryPanel == NULL) || if ((mOutboxInventoryPanel.get() == NULL) ||
//(mWindowShade && mWindowShade->isShown()) || //(mWindowShade && mWindowShade->isShown()) ||
LLMarketplaceInventoryImporter::getInstance()->isImportInProgress()) LLMarketplaceInventoryImporter::getInstance()->isImportInProgress())
{ {
@@ -449,15 +452,16 @@ BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
// Determine if the mouse is inside the inventory panel itself or just within the floater // Determine if the mouse is inside the inventory panel itself or just within the floater
bool pointInInventoryPanel = false; bool pointInInventoryPanel = false;
bool pointInInventoryPanelChild = false; bool pointInInventoryPanelChild = false;
LLFolderView * root_folder = mOutboxInventoryPanel->getRootFolder(); LLInventoryPanel* panel = mOutboxInventoryPanel.get();
if (mOutboxInventoryPanel->getVisible()) LLFolderView * root_folder = panel->getRootFolder();
if (panel->getVisible())
{ {
S32 inv_x, inv_y; S32 inv_x, inv_y;
localPointToOtherView(x, y, &inv_x, &inv_y, mOutboxInventoryPanel); localPointToOtherView(x, y, &inv_x, &inv_y, panel);
pointInInventoryPanel = mOutboxInventoryPanel->getRect().pointInRect(inv_x, inv_y); pointInInventoryPanel = panel->getRect().pointInRect(inv_x, inv_y);
LLView * inventory_panel_child_at_point = mOutboxInventoryPanel->childFromPoint(inv_x, inv_y, true); LLView * inventory_panel_child_at_point = panel->childFromPoint(inv_x, inv_y, true);
pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder); pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder);
} }
@@ -497,7 +501,10 @@ void LLFloaterOutbox::onMouseLeave(S32 x, S32 y, MASK mask)
*/ */
void LLFloaterOutbox::onImportButtonClicked() void LLFloaterOutbox::onImportButtonClicked()
{ {
mOutboxInventoryPanel->clearSelection(); if (mOutboxInventoryPanel.get())
{
mOutboxInventoryPanel.get()->clearSelection();
}
mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport(); mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport();
} }

View File

@@ -106,7 +106,7 @@ private:
LLTextBox * mInventoryTitle; LLTextBox * mInventoryTitle;
LLUUID mOutboxId; LLUUID mOutboxId;
LLInventoryPanel * mOutboxInventoryPanel; LLHandle<LLInventoryPanel> mOutboxInventoryPanel;
U32 mOutboxItemCount; U32 mOutboxItemCount;
LLPanel * mOutboxTopLevelDropZone; LLPanel * mOutboxTopLevelDropZone;

View File

@@ -176,7 +176,7 @@ void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item)
// Default constructor // Default constructor
LLFolderView::LLFolderView( const std::string& name, LLFolderView::LLFolderView( const std::string& name,
const LLRect& rect, const LLUUID& source_id, LLPanel *parent_view, LLFolderViewEventListener* listener ) : const LLRect& rect, const LLUUID& source_id, LLPanel* parent_panel, LLFolderViewEventListener* listener ) :
#if LL_WINDOWS #if LL_WINDOWS
#pragma warning( push ) #pragma warning( push )
#pragma warning( disable : 4355 ) // warning C4355: 'this' : used in base member initializer list #pragma warning( disable : 4355 ) // warning C4355: 'this' : used in base member initializer list
@@ -208,12 +208,13 @@ LLFolderView::LLFolderView( const std::string& name,
mSignalSelectCallback(0), mSignalSelectCallback(0),
mMinWidth(0), mMinWidth(0),
mDragAndDropThisFrame(FALSE), mDragAndDropThisFrame(FALSE),
mParentPanel(parent_view),
mUseEllipses(FALSE), mUseEllipses(FALSE),
mDraggingOverItem(NULL), mDraggingOverItem(NULL),
mStatusTextBox(NULL), mStatusTextBox(NULL),
mSearchType(1) mSearchType(1)
{ {
LLPanel* panel = parent_panel;
mParentPanel = panel->getHandle();
mRoot = this; mRoot = this;
mShowLoadStatus = TRUE; mShowLoadStatus = TRUE;
@@ -256,7 +257,7 @@ LLFolderView::LLFolderView( const std::string& name,
mStatusTextBox->setVPad(STATUS_TEXT_VPAD); mStatusTextBox->setVPad(STATUS_TEXT_VPAD);
mStatusTextBox->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP); mStatusTextBox->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP);
// make the popup menu available // make the popup menu available
LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_inventory.xml", parent_view); LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_inventory.xml", parent_panel);
if (!menu) if (!menu)
{ {
menu = new LLMenuGL(LLStringUtil::null); menu = new LLMenuGL(LLStringUtil::null);
@@ -645,7 +646,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
if( selection && take_keyboard_focus) if( selection && take_keyboard_focus)
{ {
mParentPanel->setFocus(TRUE); mParentPanel.get()->setFocus(TRUE);
} }
// clear selection down here because change of keyboard focus can potentially // clear selection down here because change of keyboard focus can potentially
@@ -1110,11 +1111,11 @@ void LLFolderView::removeSelectedItems( void )
// change selection on successful delete // change selection on successful delete
if (new_selection) if (new_selection)
{ {
setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel.get()->hasFocus());
} }
else else
{ {
setSelectionFromRoot(NULL, mParentPanel->hasFocus()); setSelectionFromRoot(NULL, mParentPanel.get()->hasFocus());
} }
} }
} }
@@ -1140,11 +1141,11 @@ void LLFolderView::removeSelectedItems( void )
} }
if (new_selection) if (new_selection)
{ {
setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel.get()->hasFocus());
} }
else else
{ {
setSelectionFromRoot(NULL, mParentPanel->hasFocus()); setSelectionFromRoot(NULL, mParentPanel.get()->hasFocus());
} }
for(S32 i = 0; i < count; ++i) for(S32 i = 0; i < count; ++i)
@@ -1715,7 +1716,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
break; break;
} }
if (!handled && mParentPanel->hasFocus()) if (!handled && mParentPanel.get()->hasFocus())
{ {
if (key == KEY_BACKSPACE) if (key == KEY_BACKSPACE)
{ {
@@ -1747,7 +1748,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char)
} }
BOOL handled = FALSE; BOOL handled = FALSE;
if (mParentPanel->hasFocus()) if (mParentPanel.get()->hasFocus())
{ {
// SL-51858: Key presses are not being passed to the Popup menu. // SL-51858: Key presses are not being passed to the Popup menu.
// A proper fix is non-trivial so instead just close the menu. // A proper fix is non-trivial so instead just close the menu.
@@ -1804,7 +1805,7 @@ BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask )
mKeyboardSelection = FALSE; mKeyboardSelection = FALSE;
mSearchString.clear(); mSearchString.clear();
mParentPanel->setFocus(TRUE); mParentPanel.get()->setFocus(TRUE);
LLEditMenuHandler::gEditMenuHandler = this; LLEditMenuHandler::gEditMenuHandler = this;
@@ -1887,7 +1888,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
{ {
// all user operations move keyboard focus to inventory // all user operations move keyboard focus to inventory
// this way, we know when to stop auto-updating a search // this way, we know when to stop auto-updating a search
mParentPanel->setFocus(TRUE); mParentPanel.get()->setFocus(TRUE);
BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL;
S32 count = mSelectedItems.size(); S32 count = mSelectedItems.size();
@@ -2157,7 +2158,7 @@ void LLFolderView::doIdle()
{ {
// If this is associated with the user's inventory, don't do anything // If this is associated with the user's inventory, don't do anything
// until that inventory is loaded up. // until that inventory is loaded up.
const LLInventoryPanel *inventory_panel = dynamic_cast<LLInventoryPanel*>(mParentPanel); const LLInventoryPanel *inventory_panel = dynamic_cast<LLInventoryPanel*>(mParentPanel.get());
if (inventory_panel && !inventory_panel->getIsViewsInitialized()) if (inventory_panel && !inventory_panel->getIsViewsInitialized())
{ {
return; return;

View File

@@ -244,7 +244,7 @@ public:
BOOL getDebugFilters() { return mDebugFilters; } BOOL getDebugFilters() { return mDebugFilters; }
LLPanel* getParentPanel() { return mParentPanel; } LLPanel* getParentPanel() { return mParentPanel.get(); }
// DEBUG only // DEBUG only
void dumpSelectionInformation(); void dumpSelectionInformation();
@@ -253,6 +253,9 @@ public:
bool useLabelSuffix() { return mUseLabelSuffix; } bool useLabelSuffix() { return mUseLabelSuffix; }
void updateMenu(); void updateMenu();
// Note: We may eventually have to move that method up the hierarchy to LLFolderViewItem.
LLHandle<LLFolderView> getHandle() const { return getDerivedHandle<LLFolderView>(); }
private: private:
void updateMenuOptions(LLMenuGL* menu); void updateMenuOptions(LLMenuGL* menu);
void updateRenamerPosition(); void updateRenamerPosition();
@@ -317,7 +320,7 @@ protected:
LLUUID mSelectThisID; // if non null, select this item LLUUID mSelectThisID; // if non null, select this item
LLPanel* mParentPanel; LLHandle<LLPanel> mParentPanel;
/** /**
* Is used to determine if we need to cut text In LLFolderViewItem to avoid horizontal scroll. * Is used to determine if we need to cut text In LLFolderViewItem to avoid horizontal scroll.

View File

@@ -414,7 +414,6 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe
bool find_in_library) bool find_in_library)
{ {
LLUUID rv = LLUUID::null; LLUUID rv = LLUUID::null;
const LLUUID &root_id = (find_in_library) ? gInventory.getLibraryRootFolderID() : gInventory.getRootFolderID(); const LLUUID &root_id = (find_in_library) ? gInventory.getLibraryRootFolderID() : gInventory.getRootFolderID();
if(LLFolderType::FT_ROOT_INVENTORY == preferred_type) if(LLFolderType::FT_ROOT_INVENTORY == preferred_type)
{ {
@@ -429,7 +428,7 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe
S32 count = cats->count(); S32 count = cats->count();
for(S32 i = 0; i < count; ++i) for(S32 i = 0; i < count; ++i)
{ {
if(cats->get(i)->getPreferredType() == preferred_type) if (cats->get(i)->getPreferredType() == preferred_type)
{ {
rv = cats->get(i)->getUUID(); rv = cats->get(i)->getUUID();
break; break;
@@ -611,7 +610,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
return id; return id;
} }
// Starting with the object specified, add it's descendents to the // Starting with the object specified, add its descendents to the
// array provided, but do not add the inventory object specified by // array provided, but do not add the inventory object specified by
// id. There is no guaranteed order. Neither array will be erased // id. There is no guaranteed order. Neither array will be erased
// before adding objects to it. Do not store a copy of the pointers // before adding objects to it. Do not store a copy of the pointers
@@ -1038,7 +1037,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat)
new_cat->copyViewerCategory(cat); new_cat->copyViewerCategory(cat);
addCategory(new_cat); addCategory(new_cat);
// make sure this category is correctly referenced by it's parent. // make sure this category is correctly referenced by its parent.
cat_array_t* cat_array; cat_array_t* cat_array;
cat_array = getUnlockedCatArray(cat->getParentUUID()); cat_array = getUnlockedCatArray(cat->getParentUUID());
if(cat_array) if(cat_array)
@@ -1247,12 +1246,6 @@ void LLInventoryModel::updateLinkedObjectsFromPurge(const LLUUID &baseobj_id)
// folders, items, etc in a fairly efficient manner. // folders, items, etc in a fairly efficient manner.
void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
{ {
EHasChildren children = categoryHasChildren(id);
if(children == CHILDREN_NO)
{
llinfos << "Not purging descendents of " << id << llendl;
return;
}
LLPointer<LLViewerInventoryCategory> cat = getCategory(id); LLPointer<LLViewerInventoryCategory> cat = getCategory(id);
if (cat.notNull()) if (cat.notNull())
{ {
@@ -1263,7 +1256,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
<< " iterate and purge non hidden items" << llendl; << " iterate and purge non hidden items" << llendl;
cat_array_t* categories; cat_array_t* categories;
item_array_t* items; item_array_t* items;
// Get the list of direct descendants in tha categoy passed as argument // Get the list of direct descendants in that category passed as argument
getDirectDescendentsOf(id, categories, items); getDirectDescendentsOf(id, categories, items);
std::vector<LLUUID> list_uuids; std::vector<LLUUID> list_uuids;
// Make a unique list with all the UUIDs of the direct descendants (items and categories are not treated differently) // Make a unique list with all the UUIDs of the direct descendants (items and categories are not treated differently)

View File

@@ -139,7 +139,6 @@ LLInventoryPanel::LLInventoryPanel(const std::string& name,
LLPanel(name, rect, TRUE), LLPanel(name, rect, TRUE),
mInventoryObserver(NULL), mInventoryObserver(NULL),
mCompletionObserver(NULL), mCompletionObserver(NULL),
mFolderRoot(NULL),
mScroller(NULL), mScroller(NULL),
mSortOrderSetting(sort_order_setting), mSortOrderSetting(sort_order_setting),
mStartFolder(start_folder), mStartFolder(start_folder),
@@ -191,7 +190,8 @@ void LLInventoryPanel::buildFolderView()
NULL, NULL,
root_id); root_id);
mFolderRoot = createFolderView(new_listener, true/*params.use_label_suffix()*/); LLFolderView* folder_view = createFolderView(new_listener, true/*params.use_label_suffix()*/);
mFolderRoot = folder_view->getHandle();
} }
BOOL LLInventoryPanel::postBuild() BOOL LLInventoryPanel::postBuild()
{ {
@@ -199,16 +199,16 @@ BOOL LLInventoryPanel::postBuild()
buildFolderView(); buildFolderView();
{ {
// scroller // Scroller
LLRect scroller_view_rect = getRect(); LLRect scroller_view_rect = getRect();
scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
mScroller = new LLScrollContainer(std::string("Inventory Scroller"), mScroller = new LLScrollContainer(std::string("Inventory Scroller"),
scroller_view_rect, scroller_view_rect,
mFolderRoot); mFolderRoot.get());
mScroller->setFollowsAll(); mScroller->setFollowsAll();
mScroller->setReserveScrollCorner(TRUE); mScroller->setReserveScrollCorner(TRUE);
addChild(mScroller); addChild(mScroller);
mFolderRoot->setScrollContainer(mScroller); mFolderRoot.get()->setScrollContainer(mScroller);
} }
// Set up the callbacks from the inventory we're viewing, and then build everything. // Set up the callbacks from the inventory we're viewing, and then build everything.
@@ -240,24 +240,42 @@ BOOL LLInventoryPanel::postBuild()
LLInventoryPanel::~LLInventoryPanel() LLInventoryPanel::~LLInventoryPanel()
{ {
if (mFolderRoot) if (mFolderRoot.get())
{ {
U32 sort_order = mFolderRoot->getSortOrder(); U32 sort_order = mFolderRoot.get()->getSortOrder();
if (mSortOrderSetting != INHERIT_SORT_ORDER) if (mSortOrderSetting != INHERIT_SORT_ORDER)
{ {
gSavedSettings.setU32(mSortOrderSetting, sort_order); gSavedSettings.setU32(mSortOrderSetting, sort_order);
} }
} }
clearFolderRoot();
}
void LLInventoryPanel::clearFolderRoot()
{
gIdleCallbacks.deleteFunction(onIdle, this); gIdleCallbacks.deleteFunction(onIdle, this);
// LLView destructor will take care of the sub-views. if (mInventoryObserver)
{
mInventory->removeObserver(mInventoryObserver); mInventory->removeObserver(mInventoryObserver);
mInventory->removeObserver(mCompletionObserver);
delete mInventoryObserver; delete mInventoryObserver;
delete mCompletionObserver; mInventoryObserver = NULL;
}
if (mCompletionObserver)
{
mInventory->removeObserver(mCompletionObserver);
delete mCompletionObserver;
mCompletionObserver = NULL;
}
if (mScroller)
{
removeChild(mScroller);
delete mScroller;
mScroller = NULL; mScroller = NULL;
}
} }
// virtual // virtual
@@ -267,7 +285,7 @@ LLXMLNodePtr LLInventoryPanel::getXML(bool save_children) const
node->setName(LL_INVENTORY_PANEL_TAG); node->setName(LL_INVENTORY_PANEL_TAG);
node->createChild("allow_multi_select", TRUE)->setBoolValue(mFolderRoot->getAllowMultiSelect()); node->createChild("allow_multi_select", TRUE)->setBoolValue(mFolderRoot.get()->getAllowMultiSelect());
return node; return node;
} }
@@ -327,24 +345,24 @@ LLView* LLInventoryPanel::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
void LLInventoryPanel::draw() void LLInventoryPanel::draw()
{ {
// Select the desired item (in case it wasn't loaded when the selection was requested) // Select the desired item (in case it wasn't loaded when the selection was requested)
mFolderRoot->updateSelection(); mFolderRoot.get()->updateSelection();
LLPanel::draw(); LLPanel::draw();
} }
LLInventoryFilter* LLInventoryPanel::getFilter() LLInventoryFilter* LLInventoryPanel::getFilter()
{ {
if (mFolderRoot) if (mFolderRoot.get())
{ {
return mFolderRoot->getFilter(); return mFolderRoot.get()->getFilter();
} }
return NULL; return NULL;
} }
const LLInventoryFilter* LLInventoryPanel::getFilter() const const LLInventoryFilter* LLInventoryPanel::getFilter() const
{ {
if (mFolderRoot) if (mFolderRoot.get())
{ {
return mFolderRoot->getFilter(); return mFolderRoot.get()->getFilter();
} }
return NULL; return NULL;
} }
@@ -359,12 +377,12 @@ void LLInventoryPanel::setFilterTypes(U64 types, LLInventoryFilter::EFilterType
U32 LLInventoryPanel::getFilterObjectTypes() const U32 LLInventoryPanel::getFilterObjectTypes() const
{ {
return mFolderRoot->getFilterObjectTypes(); return mFolderRoot.get()->getFilterObjectTypes();
} }
U32 LLInventoryPanel::getFilterPermMask() const U32 LLInventoryPanel::getFilterPermMask() const
{ {
return mFolderRoot->getFilterPermissions(); return mFolderRoot.get()->getFilterPermissions();
} }
@@ -390,7 +408,7 @@ void LLInventoryPanel::setFilterSubString(const std::string& string)
const std::string LLInventoryPanel::getFilterSubString() const std::string LLInventoryPanel::getFilterSubString()
{ {
return mFolderRoot->getFilterSubString(); return mFolderRoot.get()->getFilterSubString();
} }
@@ -399,20 +417,20 @@ void LLInventoryPanel::setSortOrder(U32 order)
getFilter()->setSortOrder(order); getFilter()->setSortOrder(order);
if (getFilter()->isModified()) if (getFilter()->isModified())
{ {
mFolderRoot->setSortOrder(order); mFolderRoot.get()->setSortOrder(order);
// try to keep selection onscreen, even if it wasn't to start with // try to keep selection onscreen, even if it wasn't to start with
mFolderRoot->scrollToShowSelection(); mFolderRoot.get()->scrollToShowSelection();
} }
} }
U32 LLInventoryPanel::getSortOrder() const U32 LLInventoryPanel::getSortOrder() const
{ {
return mFolderRoot->getSortOrder(); return mFolderRoot.get()->getSortOrder();
} }
void LLInventoryPanel::requestSort() void LLInventoryPanel::requestSort()
{ {
mFolderRoot->requestSort(); mFolderRoot.get()->requestSort();
} }
void LLInventoryPanel::setSinceLogoff(BOOL sl) void LLInventoryPanel::setSinceLogoff(BOOL sl)
@@ -459,7 +477,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
{ {
const LLUUID& item_id = (*items_iter); const LLUUID& item_id = (*items_iter);
const LLInventoryObject* model_item = model->getObject(item_id); const LLInventoryObject* model_item = model->getObject(item_id);
LLFolderViewItem* view_item = mFolderRoot->getItemByID(item_id); LLFolderViewItem* view_item = mFolderRoot.get()->getItemByID(item_id);
// LLFolderViewFolder is derived from LLFolderViewItem so dynamic_cast from item // LLFolderViewFolder is derived from LLFolderViewItem so dynamic_cast from item
// to folder is the fast way to get a folder without searching through folders tree. // to folder is the fast way to get a folder without searching through folders tree.
@@ -548,7 +566,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
// Add the UI element for this item. // Add the UI element for this item.
buildNewViews(item_id); buildNewViews(item_id);
// Select any newly created object that has the auto rename at top of folder root set. // Select any newly created object that has the auto rename at top of folder root set.
if(mFolderRoot->getRoot()->needsAutoRename()) if(mFolderRoot.get()->getRoot()->needsAutoRename())
{ {
setSelection(item_id, FALSE); setSelection(item_id, FALSE);
} }
@@ -562,7 +580,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
// Don't process the item if it is the root // Don't process the item if it is the root
if (view_item->getRoot() != view_item) if (view_item->getRoot() != view_item)
{ {
LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolderRoot->getItemByID(model_item->getParentUUID()); LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolderRoot.get()->getItemByID(model_item->getParentUUID());
// Item has been moved. // Item has been moved.
if (view_item->getParentFolder() != new_parent) if (view_item->getParentFolder() != new_parent)
{ {
@@ -570,7 +588,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
{ {
// Item is to be moved and we found its new parent in the panel's directory, so move the item's UI. // Item is to be moved and we found its new parent in the panel's directory, so move the item's UI.
view_item->getParentFolder()->extractItem(view_item); view_item->getParentFolder()->extractItem(view_item);
view_item->addToFolder(new_parent, mFolderRoot); view_item->addToFolder(new_parent, mFolderRoot.get());
} }
else else
{ {
@@ -594,12 +612,6 @@ void LLInventoryPanel::modelChanged(U32 mask)
} }
} }
LLFolderView* LLInventoryPanel::getRootFolder()
{
return mFolderRoot;
}
// static // static
void LLInventoryPanel::onIdle(void *userdata) void LLInventoryPanel::onIdle(void *userdata)
{ {
@@ -620,7 +632,7 @@ void LLInventoryPanel::onIdle(void *userdata)
const LLUUID& LLInventoryPanel::getRootFolderID() const const LLUUID& LLInventoryPanel::getRootFolderID() const
{ {
return mFolderRoot->getListener()->getUUID(); return mFolderRoot.get()->getListener()->getUUID();
} }
void LLInventoryPanel::initializeViews() void LLInventoryPanel::initializeViews()
@@ -637,14 +649,14 @@ void LLInventoryPanel::initializeViews()
if (gAgent.isFirstLogin()) if (gAgent.isFirstLogin())
{ {
// Auto open the user's library // Auto open the user's library
LLFolderViewFolder* lib_folder = mFolderRoot->getFolderByID(gInventory.getLibraryRootFolderID()); LLFolderViewFolder* lib_folder = mFolderRoot.get()->getFolderByID(gInventory.getLibraryRootFolderID());
if (lib_folder) if (lib_folder)
{ {
lib_folder->setOpen(TRUE); lib_folder->setOpen(TRUE);
} }
// Auto close the user's my inventory folder // Auto close the user's my inventory folder
LLFolderViewFolder* my_inv_folder = mFolderRoot->getFolderByID(gInventory.getRootFolderID()); LLFolderViewFolder* my_inv_folder = mFolderRoot.get()->getFolderByID(gInventory.getRootFolderID());
if (my_inv_folder) if (my_inv_folder)
{ {
my_inv_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); my_inv_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN);
@@ -654,7 +666,7 @@ void LLInventoryPanel::initializeViews()
LLFolderViewItem* LLInventoryPanel::rebuildViewsFor(const LLUUID& id) LLFolderViewItem* LLInventoryPanel::rebuildViewsFor(const LLUUID& id)
{ {
// Destroy the old view for this ID so we can rebuild it. // Destroy the old view for this ID so we can rebuild it.
LLFolderViewItem* old_view = mFolderRoot->getItemByID(id); LLFolderViewItem* old_view = mFolderRoot.get()->getItemByID(id);
if (old_view) if (old_view)
{ {
old_view->destroyView(); old_view->destroyView();
@@ -687,7 +699,7 @@ LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * br
bridge->getIcon(), bridge->getIcon(),
bridge->getOpenIcon(), bridge->getOpenIcon(),
LLUI::getUIImage("inv_link_overlay.tga"), LLUI::getUIImage("inv_link_overlay.tga"),
mFolderRoot, mFolderRoot.get(),
bridge); bridge);
} }
@@ -699,25 +711,25 @@ LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge
bridge->getOpenIcon(), bridge->getOpenIcon(),
LLUI::getUIImage("inv_link_overlay.tga"), LLUI::getUIImage("inv_link_overlay.tga"),
bridge->getCreationDate(), bridge->getCreationDate(),
mFolderRoot, mFolderRoot.get(),
bridge); bridge);
} }
LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
{ {
LLInventoryObject const* objectp = gInventory.getObject(id); LLInventoryObject const* objectp = gInventory.getObject(id);
LLUUID root_id = mFolderRoot->getListener()->getUUID(); LLUUID root_id = mFolderRoot.get()->getListener()->getUUID();
LLFolderViewFolder* parent_folder = NULL; LLFolderViewFolder* parent_folder = NULL;
LLFolderViewItem* itemp = NULL; LLFolderViewItem* itemp = NULL;
if (id == root_id) if (id == root_id)
{ {
parent_folder = mFolderRoot; parent_folder = mFolderRoot.get();
} }
else if (objectp) else if (objectp)
{ {
const LLUUID &parent_id = objectp->getParentUUID(); const LLUUID &parent_id = objectp->getParentUUID();
parent_folder = (LLFolderViewFolder*)mFolderRoot->getItemByID(parent_id); parent_folder = (LLFolderViewFolder*)mFolderRoot.get()->getItemByID(parent_id);
if (parent_folder) if (parent_folder)
{ {
@@ -737,14 +749,14 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
objectp->getType(), objectp->getType(),
LLInventoryType::IT_CATEGORY, LLInventoryType::IT_CATEGORY,
this, this,
mFolderRoot, mFolderRoot.get(),
objectp->getUUID()); objectp->getUUID());
if (new_listener) if (new_listener)
{ {
LLFolderViewFolder* folderp = createFolderViewFolder(new_listener); LLFolderViewFolder* folderp = createFolderViewFolder(new_listener);
if (folderp) if (folderp)
{ {
folderp->setItemSortOrder(mFolderRoot->getSortOrder()); folderp->setItemSortOrder(mFolderRoot.get()->getSortOrder());
} }
itemp = folderp; itemp = folderp;
} }
@@ -757,7 +769,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
item->getActualType(), item->getActualType(),
item->getInventoryType(), item->getInventoryType(),
this, this,
mFolderRoot, mFolderRoot.get(),
item->getUUID(), item->getUUID(),
item->getFlags()); item->getFlags());
@@ -769,7 +781,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
if (itemp) if (itemp)
{ {
itemp->addToFolder(parent_folder, mFolderRoot); itemp->addToFolder(parent_folder, mFolderRoot.get());
} }
} }
} }
@@ -815,7 +827,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
void LLInventoryPanel::openStartFolderOrMyInventory() void LLInventoryPanel::openStartFolderOrMyInventory()
{ {
// Find My Inventory folder and open it up by name // Find My Inventory folder and open it up by name
for (LLView *child = mFolderRoot->getFirstChild(); child; child = mFolderRoot->findNextSibling(child)) for (LLView *child = mFolderRoot.get()->getFirstChild(); child; child = mFolderRoot.get()->findNextSibling(child))
{ {
LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child); LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child);
if (fchild if (fchild
@@ -862,12 +874,12 @@ protected:
void LLInventoryPanel::onItemsCompletion() void LLInventoryPanel::onItemsCompletion()
{ {
if (mFolderRoot) mFolderRoot->updateMenu(); if (mFolderRoot.get()) mFolderRoot.get()->updateMenu();
} }
void LLInventoryPanel::openSelected() void LLInventoryPanel::openSelected()
{ {
LLFolderViewItem* folder_item = mFolderRoot->getCurSelectedItem(); LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem();
if(!folder_item) return; if(!folder_item) return;
LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener(); LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener();
if(!bridge) return; if(!bridge) return;
@@ -876,7 +888,7 @@ void LLInventoryPanel::openSelected()
void LLInventoryPanel::unSelectAll() void LLInventoryPanel::unSelectAll()
{ {
mFolderRoot->setSelection(NULL, FALSE, FALSE); mFolderRoot.get()->setSelection(NULL, FALSE, FALSE);
} }
@@ -913,14 +925,14 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
// If folder view is empty the (x, y) point won't be in its rect // If folder view is empty the (x, y) point won't be in its rect
// so the handler must be called explicitly. // so the handler must be called explicitly.
// but only if was not handled before. See EXT-6746. // but only if was not handled before. See EXT-6746.
if (!handled && !mFolderRoot->hasVisibleChildren()) if (!handled && !mFolderRoot.get()->hasVisibleChildren())
{ {
handled = mFolderRoot->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); handled = mFolderRoot.get()->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
} }
if (handled) if (handled)
{ {
mFolderRoot->setDragAndDropThisFrame(); mFolderRoot.get()->setDragAndDropThisFrame();
} }
} }
@@ -930,7 +942,7 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
void LLInventoryPanel::onFocusLost() void LLInventoryPanel::onFocusLost()
{ {
// inventory no longer handles cut/copy/paste/delete // inventory no longer handles cut/copy/paste/delete
if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot) if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot.get())
{ {
LLEditMenuHandler::gEditMenuHandler = NULL; LLEditMenuHandler::gEditMenuHandler = NULL;
} }
@@ -941,28 +953,28 @@ void LLInventoryPanel::onFocusLost()
void LLInventoryPanel::onFocusReceived() void LLInventoryPanel::onFocusReceived()
{ {
// inventory now handles cut/copy/paste/delete // inventory now handles cut/copy/paste/delete
LLEditMenuHandler::gEditMenuHandler = mFolderRoot; LLEditMenuHandler::gEditMenuHandler = mFolderRoot.get();
LLPanel::onFocusReceived(); LLPanel::onFocusReceived();
} }
void LLInventoryPanel::openAllFolders() void LLInventoryPanel::openAllFolders()
{ {
mFolderRoot->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); mFolderRoot.get()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
mFolderRoot->arrangeAll(); mFolderRoot.get()->arrangeAll();
} }
void LLInventoryPanel::closeAllFolders() void LLInventoryPanel::closeAllFolders()
{ {
mFolderRoot->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); mFolderRoot.get()->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN);
mFolderRoot->arrangeAll(); mFolderRoot.get()->arrangeAll();
} }
void LLInventoryPanel::openDefaultFolderForType(LLAssetType::EType type) void LLInventoryPanel::openDefaultFolderForType(LLAssetType::EType type)
{ {
LLUUID category_id = mInventory->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(type)); LLUUID category_id = mInventory->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(type));
LLOpenFolderByID opener(category_id); LLOpenFolderByID opener(category_id);
mFolderRoot->applyFunctorRecursively(opener); mFolderRoot.get()->applyFunctorRecursively(opener);
} }
void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus) void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus)
@@ -973,20 +985,20 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc
{ {
return; return;
} }
mFolderRoot->setSelectionByID(obj_id, take_keyboard_focus); mFolderRoot.get()->setSelectionByID(obj_id, take_keyboard_focus);
} }
void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb) void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb)
{ {
if (mFolderRoot) if (mFolderRoot.get())
{ {
mFolderRoot->setSelectCallback(cb); mFolderRoot.get()->setSelectCallback(cb);
} }
} }
void LLInventoryPanel::clearSelection() void LLInventoryPanel::clearSelection()
{ {
mFolderRoot->clearSelection(); mFolderRoot.get()->clearSelection();
} }
void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action) void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action)
@@ -1053,7 +1065,7 @@ BOOL LLInventoryPanel::getSinceLogoff()
void LLInventoryPanel::dumpSelectionInformation(void* user_data) void LLInventoryPanel::dumpSelectionInformation(void* user_data)
{ {
LLInventoryPanel* iv = (LLInventoryPanel*)user_data; LLInventoryPanel* iv = (LLInventoryPanel*)user_data;
iv->mFolderRoot->dumpSelectionInformation(); iv->mFolderRoot.get()->dumpSelectionInformation();
} }
// static // static
LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)

View File

@@ -114,7 +114,7 @@ public:
void setFilterSubString(const std::string& string); void setFilterSubString(const std::string& string);
const std::string getFilterSubString(); const std::string getFilterSubString();
void setFilterWorn(bool worn); void setFilterWorn(bool worn);
bool getFilterWorn() const { return mFolderRoot->getFilterWorn(); } bool getFilterWorn() const { return mFolderRoot.get()->getFilterWorn(); }
void setSinceLogoff(BOOL sl); void setSinceLogoff(BOOL sl);
void setHoursAgo(U32 hours); void setHoursAgo(U32 hours);
@@ -123,10 +123,10 @@ public:
void setShowFolderState(LLInventoryFilter::EFolderShow show); void setShowFolderState(LLInventoryFilter::EFolderShow show);
LLInventoryFilter::EFolderShow getShowFolderState(); LLInventoryFilter::EFolderShow getShowFolderState();
void setAllowMultiSelect(BOOL allow) { mFolderRoot->setAllowMultiSelect(allow); } void setAllowMultiSelect(BOOL allow) { mFolderRoot.get()->setAllowMultiSelect(allow); }
// This method is called when something has changed about the inventory. // This method is called when something has changed about the inventory.
void modelChanged(U32 mask); void modelChanged(U32 mask);
LLFolderView* getRootFolder(); LLFolderView* getRootFolder() { return mFolderRoot.get(); }
LLScrollContainer* getScrollableContainer() { return mScroller; } LLScrollContainer* getScrollableContainer() { return mScroller; }
void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
@@ -155,6 +155,9 @@ public:
LLInventoryType::EType inv_type, LLInventoryType::EType inv_type,
U32 next_owner_perm = 0); U32 next_owner_perm = 0);
// Clean up stuff when the folder root gets deleted
void clearFolderRoot();
protected: protected:
void openStartFolderOrMyInventory(); // open the first level of inventory void openStartFolderOrMyInventory(); // open the first level of inventory
void onItemsCompletion(); // called when selected items are complete void onItemsCompletion(); // called when selected items are complete
@@ -164,7 +167,7 @@ protected:
LLInvPanelComplObserver* mCompletionObserver; LLInvPanelComplObserver* mCompletionObserver;
BOOL mAllowMultiSelect; BOOL mAllowMultiSelect;
LLFolderView* mFolderRoot; LLHandle<LLFolderView> mFolderRoot;
LLScrollContainer* mScroller; LLScrollContainer* mScroller;
/** /**

View File

@@ -83,7 +83,7 @@ void LLOutboxInventoryPanel::buildFolderView(/*const LLInventoryPanel::Params& p
NULL, NULL,
root_id); root_id);
mFolderRoot = createFolderView(new_listener, true/*params.use_label_suffix()*/); mFolderRoot = createFolderView(new_listener, true/*params.use_label_suffix()*/)->getHandle();
} }
LLFolderViewFolder * LLOutboxInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge) LLFolderViewFolder * LLOutboxInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge)
@@ -93,7 +93,7 @@ LLFolderViewFolder * LLOutboxInventoryPanel::createFolderViewFolder(LLInvFVBridg
bridge->getIcon(), bridge->getIcon(),
bridge->getOpenIcon(), bridge->getOpenIcon(),
LLUI::getUIImage("inv_link_overlay.tga"), LLUI::getUIImage("inv_link_overlay.tga"),
mFolderRoot, mFolderRoot.get(),
bridge); bridge);
} }
@@ -105,7 +105,7 @@ LLFolderViewItem * LLOutboxInventoryPanel::createFolderViewItem(LLInvFVBridge *
bridge->getOpenIcon(), bridge->getOpenIcon(),
LLUI::getUIImage("inv_link_overlay.tga"), LLUI::getUIImage("inv_link_overlay.tga"),
bridge->getCreationDate(), bridge->getCreationDate(),
mFolderRoot, mFolderRoot.get(),
bridge); bridge);
} }