summaryrefslogtreecommitdiff
path: root/indra/newview/llfolderviewitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfolderviewitem.cpp')
-rw-r--r--indra/newview/llfolderviewitem.cpp78
1 files changed, 52 insertions, 26 deletions
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index d39a17ca3b..63511301b3 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"
///----------------------------------------------------------------------------
@@ -133,8 +133,8 @@ LLFolderViewItem::LLFolderViewItem(LLFolderViewItem::Params p)
mIconOpen(p.icon_open),
mListener(p.listener),
mArrowImage(p.folder_arrow_image),
- mBoxImage(p.selection_image)
-, mDontShowInHierarhy(false)
+ mBoxImage(p.selection_image),
+ mDontShowInHierarchy(false)
{
refresh();
}
@@ -411,7 +411,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
S32 LLFolderViewItem::getItemHeight()
{
- if (mDontShowInHierarhy) return 0;
+ if (mDontShowInHierarchy) return 0;
S32 icon_height = mIcon->getHeight();
S32 label_height = llround(getLabelFontForStyle(mLabelStyle)->getLineHeight());
@@ -819,7 +819,7 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
void LLFolderViewItem::draw()
{
- if (mDontShowInHierarhy) return;
+ if (mDontShowInHierarchy) return;
static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
@@ -995,14 +995,14 @@ void LLFolderViewItem::draw()
S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2;
S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3);
S32 top = getRect().getHeight();
-
+
LLRect box_rect(left, top, right, bottom);
sBoxImage->draw(box_rect, sFilterBGColor);
F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mStringMatchOffset);
F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD;
font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y,
- sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
- filter_string_length, S32_MAX, &right_x, FALSE );
+ sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
+ filter_string_length, S32_MAX, &right_x, FALSE );
}
}
}
@@ -1253,6 +1253,10 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter)
// filter self only on first pass through
LLFolderViewItem::filter( filter );
}
+ if (mDontShowInHierarchy)
+ {
+ setOpen();
+ }
}
if (getRoot()->getDebugFilters())
@@ -1286,9 +1290,10 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter)
// now query children
for (folders_t::iterator iter = mFolders.begin();
- iter != mFolders.end();)
+ iter != mFolders.end();
+ ++iter)
{
- folders_t::iterator fit = iter++;
+ LLFolderViewFolder* folder = (*iter);
// have we run out of iterations this frame?
if (filter.getFilterCount() < 0)
{
@@ -1298,15 +1303,15 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter)
// mMostFilteredDescendantGeneration might have been reset
// in which case we need to update it even for folders that
// don't need to be filtered anymore
- if ((*fit)->getCompletedFilterGeneration() >= filter_generation)
+ if (folder->getCompletedFilterGeneration() >= filter_generation)
{
// track latest generation to pass any child items
- if ((*fit)->getFiltered() || (*fit)->hasFilteredDescendants(filter.getMinRequiredGeneration()))
+ if (folder->getFiltered() || folder->hasFilteredDescendants(filter.getMinRequiredGeneration()))
{
mMostFilteredDescendantGeneration = filter_generation;
if (getRoot()->needsAutoSelect() && autoopen_folders)
{
- (*fit)->setOpenArrangeRecursively(TRUE);
+ folder->setOpenArrangeRecursively(TRUE);
}
}
// just skip it, it has already been filtered
@@ -1314,48 +1319,49 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter)
}
// update this folders filter status (and children)
- (*fit)->filter( filter );
+ folder->filter( filter );
// track latest generation to pass any child items
- if ((*fit)->getFiltered() || (*fit)->hasFilteredDescendants(filter_generation))
+ if (folder->getFiltered() || folder->hasFilteredDescendants(filter_generation))
{
mMostFilteredDescendantGeneration = filter_generation;
if (getRoot()->needsAutoSelect() && autoopen_folders)
{
- (*fit)->setOpenArrangeRecursively(TRUE);
+ folder->setOpenArrangeRecursively(TRUE);
}
}
}
for (items_t::iterator iter = mItems.begin();
- iter != mItems.end();)
+ iter != mItems.end();
+ ++iter)
{
- items_t::iterator iit = iter++;
+ LLFolderViewItem* item = (*iter);
if (filter.getFilterCount() < 0)
{
break;
}
- if ((*iit)->getLastFilterGeneration() >= filter_generation)
+ if (item->getLastFilterGeneration() >= filter_generation)
{
- if ((*iit)->getFiltered())
+ if (item->getFiltered())
{
mMostFilteredDescendantGeneration = filter_generation;
}
continue;
}
- if ((*iit)->getLastFilterGeneration() >= must_pass_generation &&
- !(*iit)->getFiltered(must_pass_generation))
+ if (item->getLastFilterGeneration() >= must_pass_generation &&
+ !item->getFiltered(must_pass_generation))
{
// failed to pass an earlier filter that was a subset of the current one
// go ahead and flag this item as done
- (*iit)->setFiltered(FALSE, filter_generation);
+ item->setFiltered(FALSE, filter_generation);
continue;
}
- (*iit)->filter( filter );
+ item->filter( filter );
- if ((*iit)->getFiltered(filter.getMinRequiredGeneration()))
+ if (item->getFiltered(filter.getMinRequiredGeneration()))
{
mMostFilteredDescendantGeneration = filter_generation;
}
@@ -2024,6 +2030,22 @@ void LLFolderViewFolder::openItem( void )
toggleOpen();
}
+void LLFolderViewFolder::applyFunctorToChildren(LLFolderViewFunctor& functor)
+{
+ for (folders_t::iterator iter = mFolders.begin();
+ iter != mFolders.end();)
+ {
+ folders_t::iterator fit = iter++;
+ functor.doItem((*fit));
+ }
+ for (items_t::iterator iter = mItems.begin();
+ iter != mItems.end();)
+ {
+ items_t::iterator iit = iter++;
+ functor.doItem((*iit));
+ }
+}
+
void LLFolderViewFolder::applyFunctorRecursively(LLFolderViewFunctor& functor)
{
functor.doFolder(this);
@@ -2166,6 +2188,7 @@ 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 = getListener()->getUUID();
const LLViewerInventoryCategory *cat = gInventory.getCategory(cat_uuid);
if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
@@ -2173,6 +2196,7 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
getListener()->performAction(NULL, NULL,"replaceoutfit");
return TRUE;
}
+ */
BOOL handled = FALSE;
if( mIsOpen )
@@ -2492,11 +2516,13 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde
{
static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ static const LLUUID& landmarks_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
LLUUID a_uuid = a->getParentFolder()->getListener()->getUUID();
LLUUID b_uuid = b->getParentFolder()->getListener()->getUUID();
- if (a_uuid == favorites_folder_id && b_uuid == favorites_folder_id)
+ if ((a_uuid == favorites_folder_id && b_uuid == favorites_folder_id) ||
+ (a_uuid == landmarks_folder_id && b_uuid == landmarks_folder_id))
{
// *TODO: mantipov: probably it is better to add an appropriate method to LLFolderViewItem
// or to LLInvFVBridge