diff options
-rw-r--r-- | indra/newview/llfolderview.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llfolderview.h | 38 | ||||
-rw-r--r-- | indra/newview/llfolderviewitem.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 62 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.h | 35 |
6 files changed, 79 insertions, 96 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index c9c4c76da4..ab49739d58 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -39,11 +39,13 @@ #include "llinventoryclipboard.h" // *TODO: remove this once hack below gone. #include "llinventoryfilter.h" #include "llinventoryfunctions.h" +#include "llinventorypanel.h" #include "llfoldertype.h" #include "llfloaterinventory.h"// hacked in for the bonus context menu items. #include "llkeyboard.h" #include "lllineeditor.h" #include "llmenugl.h" +#include "llpanel.h" #include "llpreview.h" #include "llscrollcontainer.h" // hack to allow scrolling #include "lltooldraganddrop.h" @@ -2014,12 +2016,14 @@ static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory"); // Main idle routine void LLFolderView::doIdle() { - // Don't do anything until the inventory is loaded up. - if (!gInventory.isInventoryUsable()) + // 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"); diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 0bd65b5f90..a0e252ae88 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -41,25 +41,27 @@ #ifndef LL_LLFOLDERVIEW_H #define LL_LLFOLDERVIEW_H -// JAMESDEBUG - trim this list -#include <vector> -#include <map> -#include <deque> -#include <boost/function.hpp> -#include <boost/signals2.hpp> +#include "llfolderviewitem.h" // because LLFolderView is-a LLFolderViewFolder #include "lluictrl.h" #include "v4color.h" #include "lldarray.h" -//#include "llviewermenu.h" #include "stdenums.h" -#include "llfontgl.h" -#include "lleditmenuhandler.h" -#include "llviewertexture.h" #include "lldepthstack.h" +#include "lleditmenuhandler.h" +#include "llfontgl.h" #include "lltooldraganddrop.h" -// JAMESDEBUG - move this up -#include "llfolderviewitem.h" // because LLFolderView is-a LLFolderViewFolder +#include "llviewertexture.h" + +class LLFolderViewEventListener; +class LLFolderViewFolder; +class LLFolderViewItem; +class LLInventoryModel; +class LLPanel; +class LLLineEditor; +class LLMenuGL; +class LLScrollContainer; +class LLUICtrl; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLFolderViewFunctor @@ -70,8 +72,7 @@ // that later when it's determined to be too slow. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFolderViewItem; -class LLFolderViewFolder; + class LLFolderViewFunctor { @@ -89,13 +90,6 @@ public: // manages the screen region of the folder view. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFolderViewEventListener; -class LLInventoryModel; -class LLLineEditor; -class LLMenuGL; -class LLScrollContainer; -class LLUICtrl; - class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler { public: @@ -330,7 +324,7 @@ protected: LLUUID mSelectThisID; // if non null, select this item - LLPanel* mParentPanel; + LLPanel* mParentPanel; /** * Is used to determine if we need to cut text In LLFolderViewItem to avoid horizontal scroll. diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 41e3279795..420dba07fe 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -38,12 +38,12 @@ #include "llfoldervieweventlistener.h" #include "llinventorybridge.h" // for LLItemBridge in LLInventorySort::operator() #include "llinventoryfilter.h" +#include "llpanel.h" #include "llviewercontrol.h" // gSavedSettings #include "llviewerwindow.h" // Argh, only for setCursor() // linden library includes #include "llfocusmgr.h" // gFocusMgr -#include "llpanel.h" // panel->hasFocus() #include "lltrans.h" ///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index db079de593..50dbe8af96 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -509,28 +509,39 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, std::vector<std::string> &items,
std::vector<std::string> &disabled_items, U32 flags)
{
- items.push_back(std::string("Rename"));
- if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Rename"));
- }
-
- if (show_asset_id)
+ const LLInventoryObject *obj = getInventoryObject();
+ if (obj && obj->getIsLinkType())
{
- items.push_back(std::string("Copy Asset UUID"));
- if ( (! ( isItemPermissive() || gAgent.isGodlike() ) )
- || (flags & FIRST_SELECTED_ITEM) == 0)
+ items.push_back(std::string("Find Original"));
+ if (LLAssetType::lookupIsLinkType(obj->getType()))
{
- disabled_items.push_back(std::string("Copy Asset UUID"));
+ disabled_items.push_back(std::string("Find Original"));
}
}
-
- items.push_back(std::string("Copy Separator"));
-
- items.push_back(std::string("Copy"));
- if (!isItemCopyable())
+ else
{
- disabled_items.push_back(std::string("Copy"));
+ items.push_back(std::string("Rename"));
+ if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Rename"));
+ }
+
+ if (show_asset_id)
+ {
+ items.push_back(std::string("Copy Asset UUID"));
+ if ( (! ( isItemPermissive() || gAgent.isGodlike() ) )
+ || (flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Copy Asset UUID"));
+ }
+ }
+ items.push_back(std::string("Copy Separator"));
+
+ items.push_back(std::string("Copy"));
+ if (!isItemCopyable())
+ {
+ disabled_items.push_back(std::string("Copy"));
+ }
}
items.push_back(std::string("Paste"));
@@ -3707,11 +3718,6 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) }
else
{
- LLInventoryItem* item = getItem();
- if (item && item->getIsLinkType())
- {
- items.push_back(std::string("Find Original"));
- }
items.push_back(std::string("Open"));
items.push_back(std::string("Properties"));
@@ -4031,14 +4037,9 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) }
else
{
- LLInventoryItem* item = getItem();
- if (item && item->getIsLinkType())
- {
- items.push_back(std::string("Find Original"));
- }
-
items.push_back(std::string("Properties"));
+ LLInventoryItem *item = getItem();
getClipboardEntries(true, items, disabled_items, flags);
LLObjectBridge::sContextMenuItemID = mUUID;
@@ -4469,11 +4470,6 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Open"));
}
- if (item && item->getIsLinkType())
- {
- items.push_back(std::string("Find Original"));
- }
-
items.push_back(std::string("Properties"));
getClipboardEntries(true, items, disabled_items, flags);
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index e4dd70cdd1..47201b2ccc 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -78,7 +78,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mSortOrderSetting(p.sort_order_setting), mInventory(p.inventory), mAllowMultiSelect(p.allow_multi_select), - mHasInventoryConnection(false), + mViewsInitialized(false), mStartFolderString(p.start_folder), mBuildDefaultHierarchy(true), mInvFVBridgeBuilder(NULL) @@ -151,11 +151,9 @@ BOOL LLInventoryPanel::postBuild() mInventory->addObserver(mInventoryObserver); // build view of inventory if we need default full hierarchy and inventory ready, otherwise wait for modelChanged() callback - if (mBuildDefaultHierarchy && mInventory->isInventoryUsable() && !mHasInventoryConnection) + if (mBuildDefaultHierarchy && mInventory->isInventoryUsable() && !mViewsInitialized) { - generateViews(); - mHasInventoryConnection = true; - defaultOpenInventory(); + initializeViews(); } if (mSortOrderSetting != INHERIT_SORT_ORDER) @@ -258,11 +256,9 @@ void LLInventoryPanel::modelChanged(U32 mask) bool handled = false; // inventory just initialized, do complete build - if ((mask & LLInventoryObserver::ADD) && mInventory->isInventoryUsable() && gInventory.getChangedIDs().empty() && !mHasInventoryConnection) + if ((mask & LLInventoryObserver::ADD) && mInventory->isInventoryUsable() && gInventory.getChangedIDs().empty() && !mViewsInitialized) { - generateViews(); - mHasInventoryConnection = true; - defaultOpenInventory(); + initializeViews(); return; } @@ -372,11 +368,10 @@ void LLInventoryPanel::modelChanged(U32 mask) } -void LLInventoryPanel::generateViews() +void LLInventoryPanel::initializeViews() { - - // Blow away the entire previous UI tree. - mFolders->getRoot()->destroyView(); + if (!gInventory.isInventoryUsable()) + return; // Determine the root folder in case specified, and // build the views starting with that folder. @@ -392,6 +387,9 @@ void LLInventoryPanel::generateViews() } llinfos << this << " Generating views for start folder " << mStartFolderString << llendl; rebuildViewsFor(mStartFolderID); + + mViewsInitialized = true; + defaultOpenInventory(); } void LLInventoryPanel::rebuildViewsFor(const LLUUID& id) @@ -426,10 +424,6 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) return; } - if (objectp->getName() == "My Inventory") - { - llinfos << this << " Adding MyInventory for start folder " << mStartFolderString << llendl; - } if (objectp->getType() <= LLAssetType::AT_NONE || objectp->getType() >= LLAssetType::AT_COUNT) { diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 41f393c660..5b1104936d 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -161,9 +161,6 @@ public: void unSelectAll() { mFolders->setSelection(NULL, FALSE, FALSE); } private: - // Destroys the old views, and regenerates them based on the - // start folder ID. - void generateViews(); // Given the id and the parent, build all of the folder views. void rebuildViewsFor(const LLUUID& id); @@ -176,25 +173,8 @@ protected: BOOL mAllowMultiSelect; std::string mSortOrderSetting; -//private: // Can not make these private - needed by llinventorysubtreepanel LLFolderView* mFolders; - std::string mStartFolderString; - - /** - * Contains UUID of Inventory item from which hierarchy should be built. - * Can be set with the "start_folder" xml property. - * Default is LLUUID::null that means total Inventory hierarchy. - */ - LLUUID mStartFolderID; LLScrollContainer* mScroller; - bool mHasInventoryConnection; - - /** - * Flag specified if default inventory hierarchy should be created in postBuild() - */ - bool mBuildDefaultHierarchy; - - LLUUID mRootInventoryItemUUID; /** * Pointer to LLInventoryFVBridgeBuilder. @@ -205,6 +185,21 @@ protected: */ const LLInventoryFVBridgeBuilder* mInvFVBridgeBuilder; + //-------------------------------------------------------------------- + // Initialization routines for building up the UI ("views") + //-------------------------------------------------------------------- +public: + BOOL getIsViewsInitialized() const { return mViewsInitialized; } +private: + // Builds the UI. Call this once the inventory is usable. + void initializeViews(); + BOOL mBuildDefaultHierarchy; // default inventory hierarchy should be created in postBuild() + BOOL mViewsInitialized; // Views have been generated + + // UUID of category from which hierarchy should be built. Set with the + // "start_folder" xml property. Default is LLUUID::null that means total Inventory hierarchy. + std::string mStartFolderString; + LLUUID mStartFolderID; }; #endif // LL_LLINVENTORYPANEL_H |