From 2b54c8a084a3f387d6f15b9d4f61d8cb68b434e0 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 23 Nov 2009 17:46:30 -0500 Subject: EXT-2763 : Right-click on inventory doesn't bring up context menu Also did some minor cleanup on header files. --HG-- branch : avatar-pipeline --- indra/newview/llfolderview.cpp | 6 ++++-- indra/newview/llfolderview.h | 38 ++++++++++++++++---------------------- indra/newview/llfolderviewitem.cpp | 2 +- indra/newview/llinventorypanel.cpp | 28 +++++++++++----------------- indra/newview/llinventorypanel.h | 35 +++++++++++++++-------------------- 5 files changed, 47 insertions(+), 62 deletions(-) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index c9c4c76da4..3138b5b26f 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -44,6 +44,7 @@ #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 +2015,13 @@ static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory"); // Main idle routine void LLFolderView::doIdle() { - // Don't do anything until the inventory is loaded up. + // Don't do anything until the inventory is usable and loaded up. + // Seraph: Change this to calling mParentPanel->isViewsInitialized if (!gInventory.isInventoryUsable()) { 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 -#include -#include -#include -#include +#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/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 -- cgit v1.2.3