From db316f830df45e1b0229ebcbdb5feedc5eb23913 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 26 Apr 2012 10:44:45 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose removed hacks for object inventory folderview --- indra/newview/llfolderview.cpp | 23 ++++------------- indra/newview/llfolderview.h | 8 ------ indra/newview/llfolderviewitem.cpp | 5 ++-- indra/newview/llpanelobjectinventory.cpp | 43 +++++++++++++------------------- 4 files changed, 25 insertions(+), 54 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index e0d7d67f7d..d54f04475f 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -176,6 +176,7 @@ LLFolderView::Params::Params() show_load_status("show_load_status", true), use_ellipses("use_ellipses", false) { + folder_indentation = -4; } @@ -224,10 +225,7 @@ LLFolderView::LLFolderView(const Params& p) mAutoOpenCandidate = NULL; mAutoOpenTimer.stop(); mKeyboardSelection = FALSE; - const LLFolderViewItem::Params& item_params = - LLUICtrlFactory::getDefaultParams(); - S32 indentation = item_params.folder_indentation(); - mIndentation = -indentation; // children start at indentation 0 + mIndentation = p.folder_indentation; gIdleCallbacks.addFunction(idle, this); //clear label @@ -235,7 +233,6 @@ LLFolderView::LLFolderView(const Params& p) // just make sure the label ("Inventory Folder") never shows up mLabel = LLStringUtil::null; - //mRenamer->setWriteableBgColor(LLColor4::white); // Escape is handled by reverting the rename, not commiting it (default behavior) LLLineEditor::Params params; params.name("ren"); @@ -1921,20 +1918,10 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // when drop is not handled by child, it should be handled // by the folder which is the hierarchy root. - if (!handled) + if (!handled + && getListener()->getUUID().notNull()) { - if (getListener()->getUUID().notNull()) - { - handled = LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - } - else - { - if (!mFolders.empty()) - { - // dispatch to last folder as a hack to support "Contents" folder in object inventory - handled = mFolders.back()->handleDragAndDropFromChild(mask,drop,cargo_type,cargo_data,accept,tooltip_msg); - } - } + handled = LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } if (handled) diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 1d018b5e6a..9a6bf05cd1 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -187,14 +187,6 @@ public: // public rename functionality - can only start the process void startRenamingSelectedItem( void ); - // These functions were used when there was only one folderview, - // and relied on that concept. This functionality is now handled - // by the listeners and the lldraganddroptool. - //LLFolderViewItem* getMovingItem() { return mMovingItem; } - //void setMovingItem( LLFolderViewItem* item ) { mMovingItem = item; } - //void dragItemIntoFolder( LLFolderViewItem* moving_item, LLFolderViewFolder* dst_folder, BOOL drop, BOOL* accept ); - //void dragFolderIntoFolder( LLFolderViewFolder* moving_folder, LLFolderViewFolder* dst_folder, BOOL drop, BOOL* accept ); - // LLView functionality ///*virtual*/ BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent ); /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 8d6114c887..ab1794ff15 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -417,9 +417,8 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation) const Params& p = LLUICtrlFactory::getDefaultParams(); S32 indentation = p.folder_indentation(); // Only indent deeper items in hierarchy - mIndentation = (getParentFolder() - && getParentFolder()->getParentFolder() ) - ? mParentFolder->getIndentation() + indentation + mIndentation = (getParentFolder()) + ? getParentFolder()->getIndentation() + indentation : 0; if (mLabelWidthDirty) { diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 98ea680504..1efd1c3d9c 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -738,15 +738,7 @@ const std::string& LLTaskCategoryBridge::getDisplayName() const if (cat) { - // Localize "Contents" folder. - if (cat->getParentUUID().isNull() && cat->getName() == "Contents") - { - mDisplayName.assign(LLTrans::getString("ViewerObjectContents")); - } - else - { - mDisplayName.assign(cat->getName()); - } + mDisplayName.assign(cat->getName()); } return mDisplayName; @@ -1552,6 +1544,7 @@ void LLPanelObjectInventory::reset() p.parent_panel = this; p.tool_tip= LLTrans::getString("PanelContentsTooltip"); p.listener = LLTaskInvFVBridge::createObjectBridge(this, NULL); + p.folder_indentation = -14; // subtract space normally reserved for folder expanders mFolders = LLUICtrlFactory::create(p); // this ensures that we never say "searching..." or "no items found" mFolders->getFilter()->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); @@ -1630,10 +1623,11 @@ void LLPanelObjectInventory::updateInventory() LLInventoryObject* inventory_root = objectp->getInventoryRoot(); LLInventoryObject::object_list_t contents; objectp->getInventoryContents(contents); - if (inventory_root) + mHaveInventory = TRUE; + + if (inventory_root && !contents.empty()) { createFolderViews(inventory_root, contents); - mHaveInventory = TRUE; mIsInventoryEmpty = FALSE; mFolders->setEnabled(TRUE); } @@ -1641,7 +1635,6 @@ void LLPanelObjectInventory::updateInventory() { // TODO: create an empty inventory mIsInventoryEmpty = TRUE; - mHaveInventory = TRUE; } } else @@ -1693,19 +1686,19 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root bridge = LLTaskInvFVBridge::createObjectBridge(this, inventory_root); if(bridge) { - LLFolderViewFolder* new_folder = NULL; - LLFolderViewFolder::Params p; - p.name = inventory_root->getName(); - p.icon = LLUI::getUIImage("Inv_FolderClosed"); - p.icon_open = LLUI::getUIImage("Inv_FolderOpen"); - p.root = mFolders; - p.listener = bridge; - p.tool_tip = p.name; - new_folder = LLUICtrlFactory::create(p); - new_folder->addToFolder(mFolders, mFolders); - new_folder->toggleOpen(); - - createViewsForCategory(&contents, inventory_root, new_folder); + //LLFolderViewFolder* new_folder = NULL; + //LLFolderViewFolder::Params p; + //p.name = inventory_root->getName(); + //p.icon = LLUI::getUIImage("Inv_FolderClosed"); + //p.icon_open = LLUI::getUIImage("Inv_FolderOpen"); + //p.root = mFolders; + //p.listener = bridge; + //p.tool_tip = p.name; + //new_folder = LLUICtrlFactory::create(p); + //new_folder->addToFolder(mFolders, mFolders); + //new_folder->toggleOpen(); + + createViewsForCategory(&contents, inventory_root, mFolders); } } -- cgit v1.2.3