summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-07-03 17:05:28 -0700
committerRichard Linden <none@none>2012-07-03 17:05:28 -0700
commita8defa513c3b2b83f476a1de115fd0332566b483 (patch)
treec08141e3dd3379808aecdafa0f72635b7ed9f113
parent7fb39240d0b0b849e5459c075ce973210d3c5c44 (diff)
CHUI-101 WIP Make LLFolderview general purpose
removed viewer dependencies from folderview code
-rw-r--r--indra/newview/llfolderview.cpp84
-rw-r--r--indra/newview/llfolderview.h5
-rw-r--r--indra/newview/llfolderviewitem.cpp10
-rw-r--r--indra/newview/llfolderviewmodel.cpp3
-rw-r--r--indra/newview/llfolderviewmodel.h1
-rw-r--r--indra/newview/llinventorybridge.cpp6
-rw-r--r--indra/newview/llinventorypanel.cpp11
-rw-r--r--indra/newview/llinventorypanel.h79
8 files changed, 36 insertions, 163 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 6bc89cdbca..10677db094 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -27,25 +27,18 @@
#include "llviewerprecompiledheaders.h"
#include "llfolderview.h"
-
+#include "llfolderviewmodel.h"
#include "llclipboard.h" // *TODO: remove this once hack below gone.
#include "llkeyboard.h"
#include "lllineeditor.h"
#include "llmenugl.h"
#include "llpanel.h"
#include "llscrollcontainer.h" // hack to allow scrolling
+#include "lltextbox.h"
#include "lltrans.h"
#include "llui.h"
#include "lluictrlfactory.h"
-// TODO RN: kill these
-// newview includes
-#include "llcallbacklist.h" // per-frame on-idle
-#include "llfloaterproperties.h" // showProperties
-#include "llviewerwindow.h" // renamer popup handling
-#include "llpreview.h" // openSelectedItems
-#include "llinventorypanel.h" // idle loop for filtering, sort order declarations, etc.
-
// Linden library includes
#include "lldbstrings.h"
#include "llfocusmgr.h"
@@ -172,7 +165,6 @@ LLFolderView::LLFolderView(const Params& p)
mNeedsAutoSelect( FALSE ),
mAutoSelectOverride(FALSE),
mNeedsAutoRename(FALSE),
- mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME), // This gets overridden by a pref immediately
mShowSelectionContext(FALSE),
mShowSingleSelection(FALSE),
mArrangeGeneration(0),
@@ -199,7 +191,6 @@ LLFolderView::LLFolderView(const Params& p)
mAutoOpenTimer.stop();
mKeyboardSelection = FALSE;
mIndentation = p.folder_indentation;
- gIdleCallbacks.addFunction(idle, this);
//clear label
// go ahead and render root folder as usual
@@ -269,7 +260,6 @@ LLFolderView::~LLFolderView( void )
mStatusTextBox = NULL;
mAutoOpenItems.removeAllNodes();
- gIdleCallbacks.deleteFunction(idle, this);
if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die();
@@ -291,16 +281,16 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder)
{
LLFolderViewFolder::addFolder(folder);
- mFolders.remove(folder);
- // enforce sort order of My Inventory followed by Library
- if (((LLFolderViewModelItemInventory*)folder->getViewModelItem())->getUUID() == gInventory.getLibraryRootFolderID())
- {
- mFolders.push_back(folder);
- }
- else
- {
- mFolders.insert(mFolders.begin(), folder);
- }
+ // TODO RN: enforce sort order of My Inventory followed by Library
+ //mFolders.remove(folder);
+ //if (((LLFolderViewModelItemInventory*)folder->getViewModelItem())->getUUID() == gInventory.getLibraryRootFolderID())
+ //{
+ // mFolders.push_back(folder);
+ //}
+ //else
+ //{
+ // mFolders.insert(mFolders.begin(), folder);
+ //}
return TRUE;
}
@@ -754,7 +744,7 @@ void LLFolderView::closeRenamer( void )
if (mRenamer && mRenamer->getVisible())
{
// Triggers onRenamerLost() that actually closes the renamer.
- gViewerWindow->removePopup(mRenamer);
+ LLUI::removePopup(mRenamer);
}
}
@@ -785,24 +775,6 @@ bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector<LLFol
return false;
}
-// static
-void LLFolderView::removeCutItems()
-{
- // There's no item in "cut" mode on the clipboard -> exit
- if (!LLClipboard::instance().isCutMode())
- return;
-
- // Get the list of clipboard item uuids and iterate through them
- LLDynamicArray<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
- for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
- iter != objects.end();
- ++iter)
- {
- gInventory.removeObject(*iter);
- }
-}
-
void LLFolderView::removeSelectedItems()
{
if(getVisible() && getEnabled())
@@ -1126,9 +1098,9 @@ void LLFolderView::cut()
if(listener)
{
listener->cutToClipboard();
+ listener->removeItem();
}
}
- LLFolderView::removeCutItems();
}
mSearchString.clear();
}
@@ -1222,7 +1194,7 @@ void LLFolderView::startRenamingSelectedItem( void )
// set focus will fail unless item is visible
mRenamer->setFocus( TRUE );
mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this));
- gViewerWindow->addPopup(mRenamer);
+ LLUI::addPopup(mRenamer);
}
}
@@ -1808,16 +1780,10 @@ static LLFastTimer::DeclareTimer FTM_AUTO_SELECT("Open and Select");
static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory");
// Main idle routine
-void LLFolderView::doIdle()
+void LLFolderView::update()
{
// 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);
if (getFolderViewModel()->getFilter()->isModified() && getFolderViewModel()->getFilter()->isNotDefault())
@@ -1859,8 +1825,8 @@ void LLFolderView::doIdle()
BOOL filter_finished = getViewModelItem()->passedFilter()
&& mViewModel->contentsReady();
if (filter_finished
- || gFocusMgr.childHasKeyboardFocus(inventory_panel)
- || gFocusMgr.childHasMouseCapture(inventory_panel))
+ || gFocusMgr.childHasKeyboardFocus(getParent()) // assume we are inside a scroll container
+ || gFocusMgr.childHasMouseCapture(getParent()))
{
// finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process
mNeedsAutoSelect = FALSE;
@@ -1919,7 +1885,6 @@ void LLFolderView::doIdle()
constraint_rect.setOriginAndSize(0, 0, content_rect.getWidth(), content_rect.getHeight());
}
-
BOOL is_visible = isInVisibleChain();
if ( is_visible )
@@ -1954,17 +1919,6 @@ void LLFolderView::doIdle()
mSignalSelectCallback = FALSE;
}
-
-//static
-void LLFolderView::idle(void* user_data)
-{
- LLFolderView* self = (LLFolderView*)user_data;
- if ( self )
- { // Do the real idle
- self->doIdle();
- }
-}
-
void LLFolderView::dumpSelectionInformation()
{
llinfos << "LLFolderView::dumpSelectionInformation()" << llendl;
@@ -1988,7 +1942,7 @@ void LLFolderView::updateRenamerPosition()
screenPointToLocal( x, y, &x, &y );
mRenamer->setOrigin( x, y );
- LLRect scroller_rect(0, 0, gViewerWindow->getWindowWidthScaled(), 0);
+ LLRect scroller_rect(0, 0, LLUI::getWindowSize().mV[VX], 0);
if (mScrollContainer)
{
scroller_rect = mScrollContainer->getContentWindowRect();
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index e098119293..78f1d8aff2 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -165,7 +165,6 @@ public:
// Deletion functionality
void removeSelectedItems();
- static void removeCutItems();
// Open the selected item
void openSelectedItems( void );
@@ -223,8 +222,7 @@ public:
F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); }
bool getUseEllipses() { return mUseEllipses; }
- void doIdle(); // Real idle routine
- static void idle(void* user_data); // static glue to doIdle()
+ void update(); // needs to be called periodically (e.g. once per frame)
BOOL needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; }
BOOL needsAutoRename() { return mNeedsAutoRename; }
@@ -288,7 +286,6 @@ protected:
bool mUseLabelSuffix;
bool mShowItemLinkOverlays;
- U32 mSortOrder;
LLDepthStack<LLFolderViewFolder> mAutoOpenItems;
LLFolderViewFolder* mAutoOpenCandidate;
LLFrameTimer mAutoOpenTimer;
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 3937d4332b..dee3fe7218 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -1798,16 +1798,6 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask )
BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
{
- /* Disable outfit double click to wear
- const LLUUID &cat_uuid = getViewModelItem()->getUUID();
- const LLViewerInventoryCategory *cat = gInventory.getCategory(cat_uuid);
- if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
- {
- getViewModelItem()->performAction(NULL, NULL,"replaceoutfit");
- return TRUE;
- }
- */
-
BOOL handled = FALSE;
if( isOpen() )
{
diff --git a/indra/newview/llfolderviewmodel.cpp b/indra/newview/llfolderviewmodel.cpp
index 92db84156e..ca6225aca7 100644
--- a/indra/newview/llfolderviewmodel.cpp
+++ b/indra/newview/llfolderviewmodel.cpp
@@ -28,7 +28,6 @@
#include "llfolderviewmodel.h"
#include "lltrans.h"
-#include "llviewercontrol.h"
bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item)
{
@@ -49,6 +48,6 @@ std::string LLFolderViewModelCommon::getStatusText()
void LLFolderViewModelCommon::filter()
{
- getFilter()->setFilterCount(llclamp(gSavedSettings.getS32("FilterItemsPerFrame"), 1, 5000));
+ getFilter()->setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000));
mFolderView->getViewModelItem()->filter(*getFilter());
}
diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h
index 98b7255137..079409c2a4 100644
--- a/indra/newview/llfolderviewmodel.h
+++ b/indra/newview/llfolderviewmodel.h
@@ -27,7 +27,6 @@
#include "llfontgl.h" // just for StyleFlags enum
#include "llfolderview.h"
-#include "lltooldraganddrop.h"
// These are grouping of inventory types.
// Order matters when sorting system folders to the top.
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 002278601a..d17c25d9f3 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1400,7 +1400,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
else if ("cut" == action)
{
cutToClipboard();
- LLFolderView::removeCutItems();
+ gInventory.removeObject(mUUID);
return;
}
else if ("copy" == action)
@@ -1680,14 +1680,12 @@ BOOL LLItemBridge::renameItem(const std::string& new_name)
return FALSE;
}
-
BOOL LLItemBridge::removeItem()
{
if(!isItemRemovable())
{
return FALSE;
}
-
// move it to the trash
LLPreview::hide(mUUID, TRUE);
@@ -2870,7 +2868,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
else if ("cut" == action)
{
cutToClipboard();
- LLFolderView::removeCutItems();
+ gInventory.removeObject(mUUID);
return;
}
else if ("copy" == action)
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index c1ffe89184..fed9893158 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -258,6 +258,8 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
LLInventoryPanel::~LLInventoryPanel()
{
+ gIdleCallbacks.deleteFunction(idle, this);
+
U32 sort_order = getFolderViewModel()->getSorter().getSortOrder();
if (mSortOrderSetting != INHERIT_SORT_ORDER)
{
@@ -566,12 +568,21 @@ void LLInventoryPanel::onIdle(void *userdata)
}
}
+void LLInventoryPanel::idle(void* user_data)
+{
+ LLInventoryPanel* panel = (LLInventoryPanel*)user_data;
+ panel->mFolderRoot->doIdle();
+}
+
+
void LLInventoryPanel::initializeViews()
{
if (!gInventory.isInventoryUsable()) return;
rebuildViewsFor(gInventory.getRootFolderID());
+ gIdleCallbacks.addFunction(idle, this);
+
mViewsInitialized = true;
openStartFolderOrMyInventory();
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 1061f12575..465ccdd582 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -45,82 +45,6 @@ class LLInventoryFVBridgeBuilder;
class LLInvPanelComplObserver;
class LLFolderViewModelInventory;
-class LLFolderViewModelItemInventory
- : public LLFolderViewModelItemCommon
-{
-public:
- LLFolderViewModelItemInventory()
- : mRootViewModel(NULL)
- {}
- void setRootViewModel(LLFolderViewModelInventory* root_view_model)
- {
- mRootViewModel = root_view_model;
- }
- virtual const LLUUID& getUUID() const = 0;
- virtual time_t getCreationDate() const = 0; // UTC seconds
- virtual void setCreationDate(time_t creation_date_utc) = 0;
- virtual PermissionMask getPermissionMask() const = 0;
- virtual LLFolderType::EType getPreferredType() const = 0;
- virtual void showProperties(void) = 0;
- virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual.
- virtual BOOL isUpToDate() const = 0;
- virtual bool hasChildren() const = 0;
- virtual LLInventoryType::EType getInventoryType() const = 0;
- virtual void performAction(LLInventoryModel* model, std::string action) = 0;
- virtual LLWearableType::EType getWearableType() const = 0;
- virtual EInventorySortGroup getSortGroup() const = 0;
- virtual LLInventoryObject* getInventoryObject() const = 0;
- virtual void requestSort();
- virtual bool potentiallyVisible();
- virtual bool passedFilter(S32 filter_generation = -1);
- virtual bool descendantsPassedFilter(S32 filter_generation = -1);
- virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation);
- virtual bool filter( LLFolderViewFilter& filter);
- virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter);
-protected:
- LLFolderViewModelInventory* mRootViewModel;
-};
-
-class LLInventorySort
-{
-public:
- LLInventorySort(U32 order = 0)
- : mSortOrder(order),
- mByDate(false),
- mSystemToTop(false),
- mFoldersByName(false)
- {
- mByDate = (order & LLInventoryFilter::SO_DATE);
- mSystemToTop = (order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP);
- mFoldersByName = (order & LLInventoryFilter::SO_FOLDERS_BY_NAME);
- }
-
- bool isByDate() const { return mByDate; }
- U32 getSortOrder() const { return mSortOrder; }
-
- bool operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const;
-private:
- U32 mSortOrder;
- bool mByDate;
- bool mSystemToTop;
- bool mFoldersByName;
-};
-
-class LLFolderViewModelInventory
- : public LLFolderViewModel<LLInventorySort, LLFolderViewModelItemInventory, LLFolderViewModelItemInventory, LLInventoryFilter>
-{
-public:
- typedef LLFolderViewModel<LLInventorySort, LLFolderViewModelItemInventory, LLFolderViewModelItemInventory, LLInventoryFilter> base_t;
-
- virtual ~LLFolderViewModelInventory() {}
-
- void sort(LLFolderViewFolder* folder);
-
- bool contentsReady();
-
-};
-
-
class LLInventoryPanel : public LLPanel
{
//--------------------------------------------------------------------
@@ -232,7 +156,8 @@ public:
void doCreate(const LLSD& userdata);
bool beginIMSession();
bool attachObject(const LLSD& userdata);
-
+ static void idle(void* user_data);
+
// DEBUG ONLY:
static void dumpSelectionInformation(void* user_data);