summaryrefslogtreecommitdiff
path: root/indra/llui/llfolderviewitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llfolderviewitem.cpp')
-rw-r--r--indra/llui/llfolderviewitem.cpp334
1 files changed, 168 insertions, 166 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index a9e1171444..82cd2483e8 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -128,18 +128,18 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
mSuffixNeedsRefresh(false),
mLabelPaddingRight(DEFAULT_LABEL_PADDING_RIGHT),
mParentFolder( NULL ),
- mIsSelected( FALSE ),
- mIsCurSelection( FALSE ),
- mSelectPending(FALSE),
+ mIsSelected( false ),
+ mIsCurSelection( false ),
+ mSelectPending(false),
mIsItemCut(false),
mCutGeneration(0),
mLabelStyle( LLFontGL::NORMAL ),
- mHasVisibleChildren(FALSE),
+ mHasVisibleChildren(false),
mLocalIndentation(p.folder_indentation),
mIndentation(0),
mItemHeight(p.item_height),
mControlLabelRotation(0.f),
- mDragAndDropTarget(FALSE),
+ mDragAndDropTarget(false),
mLabel(p.name),
mRoot(p.root),
mViewModelItem(p.listener),
@@ -185,7 +185,7 @@ LLFolderViewItem::~LLFolderViewItem()
gFocusMgr.removeKeyboardFocusWithoutCallback(this);
}
-BOOL LLFolderViewItem::postBuild()
+bool LLFolderViewItem::postBuild()
{
LLFolderViewModelItem* vmi = getViewModelItem();
llassert(vmi); // not supposed to happen, if happens, find out why and fix
@@ -207,7 +207,7 @@ BOOL LLFolderViewItem::postBuild()
// while LLFolderViewItem::arrange() updates visual part
mSuffixNeedsRefresh = true;
mLabelWidthDirty = true;
- return TRUE;
+ return true;
}
LLFolderView* LLFolderViewItem::getRoot()
@@ -220,21 +220,21 @@ const LLFolderView* LLFolderViewItem::getRoot() const
return mRoot;
}
// Returns true if this object is a child (or grandchild, etc.) of potential_ancestor.
-BOOL LLFolderViewItem::isDescendantOf( const LLFolderViewFolder* potential_ancestor )
+bool LLFolderViewItem::isDescendantOf( const LLFolderViewFolder* potential_ancestor )
{
LLFolderViewItem* root = this;
while( root->mParentFolder )
{
if( root->mParentFolder == potential_ancestor )
{
- return TRUE;
+ return true;
}
root = root->mParentFolder;
}
- return FALSE;
+ return false;
}
-LLFolderViewItem* LLFolderViewItem::getNextOpenNode(BOOL include_children)
+LLFolderViewItem* LLFolderViewItem::getNextOpenNode(bool include_children)
{
if (!mParentFolder)
{
@@ -256,7 +256,7 @@ LLFolderViewItem* LLFolderViewItem::getNextOpenNode(BOOL include_children)
return itemp;
}
-LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children)
+LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(bool include_children)
{
if (!mParentFolder)
{
@@ -280,19 +280,19 @@ LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children)
return itemp;
}
-BOOL LLFolderViewItem::passedFilter(S32 filter_generation)
+bool LLFolderViewItem::passedFilter(S32 filter_generation)
{
return getViewModelItem()->passedFilter(filter_generation);
}
-BOOL LLFolderViewItem::isPotentiallyVisible(S32 filter_generation)
+bool LLFolderViewItem::isPotentiallyVisible(S32 filter_generation)
{
if (filter_generation < 0)
{
filter_generation = getFolderViewModel()->getFilter().getFirstSuccessGeneration();
}
LLFolderViewModelItem* model = getViewModelItem();
- BOOL visible = model->passedFilter(filter_generation);
+ bool visible = model->passedFilter(filter_generation);
if (model->getMarkedDirtyGeneration() >= filter_generation)
{
// unsure visibility state
@@ -352,8 +352,8 @@ void LLFolderViewItem::refreshSuffix()
}
// Utility function for LLFolderView
-void LLFolderViewItem::arrangeAndSet(BOOL set_selection,
- BOOL take_keyboard_focus)
+void LLFolderViewItem::arrangeAndSet(bool set_selection,
+ bool take_keyboard_focus)
{
LLFolderView* root = getRoot();
if (getParentFolder())
@@ -362,7 +362,7 @@ void LLFolderViewItem::arrangeAndSet(BOOL set_selection,
}
if(set_selection)
{
- getRoot()->setSelection(this, TRUE, take_keyboard_focus);
+ getRoot()->setSelection(this, true, take_keyboard_focus);
if(root)
{
root->scrollToShowSelection();
@@ -377,7 +377,7 @@ std::set<LLFolderViewItem*> LLFolderViewItem::getSelectionList() const
return selection;
}
-// addToFolder() returns TRUE if it succeeds. FALSE otherwise
+// addToFolder() returns true if it succeeds. false otherwise
void LLFolderViewItem::addToFolder(LLFolderViewFolder* folder)
{
folder->addItem(this);
@@ -447,7 +447,7 @@ S32 LLFolderViewItem::getTextPad()
// means 'deselect' for a leaf item. Do this optimization after
// multiple selection is implemented to make sure it all plays nice
// together.
-BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus)
+bool LLFolderViewItem::setSelection(LLFolderViewItem* selection, bool openitem, bool take_keyboard_focus)
{
if (selection == this && !mIsSelected)
{
@@ -460,7 +460,7 @@ BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem,
return mIsSelected;
}
-BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selected)
+bool LLFolderViewItem::changeSelection(LLFolderViewItem* selection, bool selected)
{
if (selection == this)
{
@@ -472,31 +472,31 @@ BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selecte
{
selectItem();
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void LLFolderViewItem::deselectItem(void)
{
- mIsSelected = FALSE;
+ mIsSelected = false;
}
void LLFolderViewItem::selectItem(void)
{
- if (mIsSelected == FALSE)
+ if (!mIsSelected)
{
- mIsSelected = TRUE;
+ mIsSelected = true;
getViewModelItem()->selectItem();
}
}
-BOOL LLFolderViewItem::isMovable()
+bool LLFolderViewItem::isMovable()
{
return getViewModelItem()->isItemMovable();
}
-BOOL LLFolderViewItem::isRemovable()
+bool LLFolderViewItem::isRemovable()
{
return getViewModelItem()->isItemRemovable();
}
@@ -515,12 +515,12 @@ void LLFolderViewItem::destroyView()
// Call through to the viewed object and return true if it can be
// removed.
-//BOOL LLFolderViewItem::removeRecursively(BOOL single_item)
-BOOL LLFolderViewItem::remove()
+//bool LLFolderViewItem::removeRecursively(bool single_item)
+bool LLFolderViewItem::remove()
{
if(!isRemovable())
{
- return FALSE;
+ return false;
}
return getViewModelItem()->removeItem();
}
@@ -554,21 +554,21 @@ const std::string& LLFolderViewItem::getName( void ) const
}
// LLView functionality
-BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask )
+bool LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask )
{
if(!mIsSelected)
{
- getRoot()->setSelection(this, FALSE);
+ getRoot()->setSelection(this, false);
}
make_ui_sound("UISndClick");
- return TRUE;
+ return true;
}
-BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
+bool LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
{
if (LLView::childrenHandleMouseDown(x, y, mask))
{
- return TRUE;
+ return true;
}
// No handler needed for focus lost since this class has no
@@ -587,7 +587,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
}
else
{
- getRoot()->setSelection(this, FALSE);
+ getRoot()->setSelection(this, false);
}
make_ui_sound("UISndClick");
}
@@ -595,15 +595,15 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
{
// If selected, we reserve the decision of deselecting/reselecting to the mouse up moment.
// This is necessary so we maintain selection consistent when starting a drag.
- mSelectPending = TRUE;
+ mSelectPending = true;
}
mDragStartX = x;
mDragStartY = y;
- return TRUE;
+ return true;
}
-BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
+bool LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
{
mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight));
@@ -618,7 +618,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
{
// RN: when starting drag and drop, clear out last auto-open
root->autoOpenTest(NULL);
- root->setShowSelectionContext(TRUE);
+ root->setShowSelectionContext(true);
// Release keyboard focus, so that if stuff is dropped into the
// world, pressing the delete key won't blow away the inventory
@@ -633,31 +633,31 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
}
root->clearHoveredItem();
- return TRUE;
+ return true;
}
else
{
LLFolderView* pRoot = getRoot();
pRoot->setHoveredItem(this);
- pRoot->setShowSelectionContext(FALSE);
+ pRoot->setShowSelectionContext(false);
getWindow()->setCursor(UI_CURSOR_ARROW);
// let parent handle this then...
- return FALSE;
+ return false;
}
}
-BOOL LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask )
+bool LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask )
{
openItem();
- return TRUE;
+ return true;
}
-BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask )
+bool LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask )
{
if (LLView::childrenHandleMouseUp(x, y, mask))
{
- return TRUE;
+ return true;
}
// if mouse hasn't moved since mouse down...
@@ -674,21 +674,21 @@ BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask )
}
else
{
- getRoot()->setSelection(this, FALSE);
+ getRoot()->setSelection(this, false);
}
}
- mSelectPending = FALSE;
+ mSelectPending = false;
if( hasMouseCapture() )
{
if (getRoot())
{
- getRoot()->setShowSelectionContext(FALSE);
+ getRoot()->setShowSelectionContext(false);
}
gFocusMgr.setMouseCapture( NULL );
}
- return TRUE;
+ return true;
}
void LLFolderViewItem::onMouseLeave(S32 x, S32 y, MASK mask)
@@ -703,18 +703,18 @@ void LLFolderViewItem::onMouseLeave(S32 x, S32 y, MASK mask)
}
}
-BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+bool LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg)
{
- BOOL handled = FALSE;
- BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg);
+ bool handled = false;
+ bool accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg);
handled = accepted;
if (accepted)
{
- mDragAndDropTarget = TRUE;
+ mDragAndDropTarget = true;
*accept = ACCEPT_YES_MULTI;
}
else
@@ -775,7 +775,7 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L
return mIsItemCut;
}
-void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor,
+void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor,
const LLUIColor &focusOutlineColor, const LLUIColor &mouseOverColor)
{
const S32 focus_top = getRect().getHeight();
@@ -789,7 +789,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
//--------------------------------------------------------------------------------//
// Draw highlight for selected items
// Note: Always render "current" item or flashing item, only render other selected
- // items if mShowSingleSelection is FALSE.
+ // items if mShowSingleSelection is false.
//
if (isHighlightAllowed())
@@ -833,7 +833,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
focus_top,
getRect().getWidth() - 2,
focus_bottom,
- focusOutlineColor, FALSE);
+ focusOutlineColor, false);
}
if (folder_open)
@@ -842,14 +842,14 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
focus_bottom + 1, // overlap with bottom edge of above rect
getRect().getWidth() - 2,
0,
- focusOutlineColor, FALSE);
+ focusOutlineColor, false);
if (showContent && !isFlashing())
{
gl_rect_2d(FOCUS_LEFT,
focus_bottom + 1,
getRect().getWidth() - 2,
0,
- bgColor, TRUE);
+ bgColor, true);
}
}
}
@@ -859,7 +859,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
focus_top,
getRect().getWidth() - 2,
focus_bottom,
- mouseOverColor, FALSE);
+ mouseOverColor, false);
}
//--------------------------------------------------------------------------------//
@@ -872,16 +872,16 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
focus_top,
getRect().getWidth() - 2,
focus_bottom,
- bgColor, FALSE);
+ bgColor, false);
if (folder_open)
{
gl_rect_2d(FOCUS_LEFT,
focus_bottom + 1, // overlap with bottom edge of above rect
getRect().getWidth() - 2,
0,
- bgColor, FALSE);
+ bgColor, false);
}
- mDragAndDropTarget = FALSE;
+ mDragAndDropTarget = false;
}
}
@@ -892,13 +892,13 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y
//
font->renderUTF8(mLabel, 0, x, y, color,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
- S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/TRUE);
+ S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/true);
}
void LLFolderViewItem::draw()
{
- const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE);
- const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled
+ const bool show_context = (getRoot() ? getRoot()->getShowSelectionContext() : false);
+ const bool filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : false); // If we have keyboard focus, draw selection filled
const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
const S32 TOP_PAD = default_params.item_top_pad;
@@ -940,22 +940,22 @@ void LLFolderViewItem::draw()
return;
}
- std::string::size_type filter_string_length = mViewModelItem->hasFilterStringMatch() ? mViewModelItem->getFilterStringSize() : 0;
+ auto filter_string_length = mViewModelItem->hasFilterStringMatch() ? static_cast<S32>(mViewModelItem->getFilterStringSize()) : 0;
F32 right_x = 0;
F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
F32 text_left = (F32)getLabelXPos();
std::string combined_string = mLabel + mLabelSuffix;
const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL);
- S32 filter_offset = mViewModelItem->getFilterStringOffset();
+ S32 filter_offset = static_cast<S32>(mViewModelItem->getFilterStringOffset());
if (filter_string_length > 0)
{
S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD);
S32 top = getRect().getHeight() - TOP_PAD;
if(mLabelSuffix.empty() || (font == suffix_font))
{
- S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 2;
- S32 right = left + font->getWidth(combined_string, mViewModelItem->getFilterStringOffset(), filter_string_length) + 2;
+ S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2;
+ S32 right = left + font->getWidth(combined_string, static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2;
LLUIImage* box_image = default_params.selection_image;
LLRect box_rect(left, top, right, bottom);
@@ -976,7 +976,7 @@ void LLFolderViewItem::draw()
if(suffix_filter_length > 0)
{
S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size());
- S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2;
+ S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2;
S32 right = left + suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length) + 2;
LLUIImage* box_image = default_params.selection_image;
LLRect box_rect(left, top, right, bottom);
@@ -1033,7 +1033,7 @@ void LLFolderViewItem::draw()
if(suffix_filter_length > 0)
{
S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size());
- F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length);
+ F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length);
F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
suffix_font->renderUTF8(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
@@ -1071,8 +1071,8 @@ bool LLFolderViewItem::isInSelection() const
LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ):
LLFolderViewItem( p ),
- mIsOpen(FALSE),
- mExpanderHighlighted(FALSE),
+ mIsOpen(false),
+ mExpanderHighlighted(false),
mCurHeight(0.f),
mTargetHeight(0.f),
mAutoOpenCountdown(0.f),
@@ -1107,7 +1107,7 @@ LLFolderViewFolder::~LLFolderViewFolder( void )
gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
}
-// addToFolder() returns TRUE if it succeeds. FALSE otherwise
+// addToFolder() returns true if it succeeds. false otherwise
void LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder)
{
folder->addFolder(this);
@@ -1267,7 +1267,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
> ll_round(mCurHeight) + mMaxFolderItemOverlap)
{
// hide if beyond current folder height
- (*fit)->setVisible(FALSE);
+ (*fit)->setVisible(false);
}
}
@@ -1279,7 +1279,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
if (getRect().getHeight() - (*iit)->getRect().mBottom
> ll_round(mCurHeight) + mMaxFolderItemOverlap)
{
- (*iit)->setVisible(FALSE);
+ (*iit)->setVisible(false);
}
}
}
@@ -1297,7 +1297,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
return ll_round(mTargetHeight);
}
-BOOL LLFolderViewFolder::needsArrange()
+bool LLFolderViewFolder::needsArrange()
{
return mLastArrangeGeneration < getRoot()->getArrangeGeneration();
}
@@ -1309,17 +1309,17 @@ bool LLFolderViewFolder::descendantsPassedFilter(S32 filter_generation)
// Passes selection information on to children and record selection
// information if necessary.
-BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem,
- BOOL take_keyboard_focus)
+bool LLFolderViewFolder::setSelection(LLFolderViewItem* selection, bool openitem,
+ bool take_keyboard_focus)
{
- BOOL rv = FALSE;
+ bool rv = false;
if (selection == this)
{
if (!isSelected())
{
selectItem();
}
- rv = TRUE;
+ rv = true;
}
else
{
@@ -1327,9 +1327,9 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
{
deselectItem();
}
- rv = FALSE;
+ rv = false;
}
- BOOL child_selected = FALSE;
+ bool child_selected = false;
for (folders_t::iterator iter = mFolders.begin();
iter != mFolders.end();)
@@ -1337,8 +1337,8 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
folders_t::iterator fit = iter++;
if((*fit)->setSelection(selection, openitem, take_keyboard_focus))
{
- rv = TRUE;
- child_selected = TRUE;
+ rv = true;
+ child_selected = true;
}
}
for (items_t::iterator iter = mItems.begin();
@@ -1347,13 +1347,13 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
items_t::iterator iit = iter++;
if((*iit)->setSelection(selection, openitem, take_keyboard_focus))
{
- rv = TRUE;
- child_selected = TRUE;
+ rv = true;
+ child_selected = true;
}
}
if(openitem && child_selected && !mSingleFolderMode)
{
- setOpenArrangeRecursively(TRUE);
+ setOpenArrangeRecursively(true);
}
return rv;
}
@@ -1361,15 +1361,15 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
// This method is used to change the selection of an item.
// Recursively traverse all children; if 'selection' is 'this' then change
// the select status if necessary.
-// Returns TRUE if the selection state of this folder, or of a child, was changed.
-BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selected)
+// Returns true if the selection state of this folder, or of a child, was changed.
+bool LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, bool selected)
{
- BOOL rv = FALSE;
+ bool rv = false;
if(selection == this)
{
if (isSelected() != selected)
{
- rv = TRUE;
+ rv = true;
if (selected)
{
selectItem();
@@ -1387,7 +1387,7 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selec
folders_t::iterator fit = iter++;
if((*fit)->changeSelection(selection, selected))
{
- rv = TRUE;
+ rv = true;
}
}
for (items_t::iterator iter = mItems.begin();
@@ -1396,7 +1396,7 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selec
items_t::iterator iit = iter++;
if((*iit)->changeSelection(selection, selected))
{
- rv = TRUE;
+ rv = true;
}
}
return rv;
@@ -1580,7 +1580,8 @@ void LLFolderViewFolder::gatherChildRangeExclusive(LLFolderViewItem* start, LLFo
void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection)
{
- if (getRoot()->getAllowMultiSelect() == FALSE) return;
+ if (!getRoot()->getAllowMultiSelect())
+ return;
LLFolderViewItem* cur_selected_item = getRoot()->getCurSelectedItem();
if (cur_selected_item == NULL)
@@ -1591,14 +1592,15 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection)
bool reverse = false;
LLFolderViewFolder* common_ancestor = getCommonAncestor(cur_selected_item, new_selection, reverse);
- if (!common_ancestor) return;
+ if (!common_ancestor)
+ return;
LLFolderViewItem* last_selected_item_from_cur = cur_selected_item;
LLFolderViewFolder* cur_folder = cur_selected_item->getParentFolder();
std::vector<LLFolderViewItem*> items_to_select_forward;
- while(cur_folder != common_ancestor)
+ while (cur_folder != common_ancestor)
{
cur_folder->gatherChildRangeExclusive(last_selected_item_from_cur, NULL, reverse, items_to_select_forward);
@@ -1610,7 +1612,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection)
LLFolderViewItem* last_selected_item_from_new = new_selection;
cur_folder = new_selection->getParentFolder();
- while(cur_folder != common_ancestor)
+ while (cur_folder != common_ancestor)
{
cur_folder->gatherChildRangeExclusive(last_selected_item_from_new, NULL, !reverse, items_to_select_reverse);
@@ -1629,7 +1631,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection)
LLFolderView* root = getRoot();
- BOOL selection_reverse = new_selection->isSelected(); //indication that some elements are being deselected
+ bool selection_reverse = new_selection->isSelected(); //indication that some elements are being deselected
// array always go from 'will be selected' to ' will be unselected', iterate
// in opposite direction to simplify identification of 'point of origin' in
@@ -1639,12 +1641,12 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection)
++it)
{
LLFolderViewItem* item = *it;
- BOOL selected = item->isSelected();
+ bool selected = item->isSelected();
if (!selection_reverse && selected)
{
// it is our 'point of origin' where we shift/expand from
// don't deselect it
- selection_reverse = TRUE;
+ selection_reverse = true;
}
else
{
@@ -1655,11 +1657,11 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection)
if (selection_reverse)
{
// at some point we reversed selection, first element should be deselected
- root->changeSelection(last_selected_item_from_cur, FALSE);
+ root->changeSelection(last_selected_item_from_cur, false);
}
// element we expand to should always be selected
- root->changeSelection(new_selection, TRUE);
+ root->changeSelection(new_selection, true);
}
@@ -1717,11 +1719,11 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item, bool deparent_mode
removeChild(item);
}
-BOOL LLFolderViewFolder::isMovable()
+bool LLFolderViewFolder::isMovable()
{
if( !(getViewModelItem()->isItemMovable()) )
{
- return FALSE;
+ return false;
}
for (items_t::iterator iter = mItems.begin();
@@ -1730,7 +1732,7 @@ BOOL LLFolderViewFolder::isMovable()
items_t::iterator iit = iter++;
if(!(*iit)->isMovable())
{
- return FALSE;
+ return false;
}
}
@@ -1740,18 +1742,18 @@ BOOL LLFolderViewFolder::isMovable()
folders_t::iterator fit = iter++;
if(!(*fit)->isMovable())
{
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
-BOOL LLFolderViewFolder::isRemovable()
+bool LLFolderViewFolder::isRemovable()
{
if( !(getViewModelItem()->isItemRemovable()) )
{
- return FALSE;
+ return false;
}
for (items_t::iterator iter = mItems.begin();
@@ -1760,7 +1762,7 @@ BOOL LLFolderViewFolder::isRemovable()
items_t::iterator iit = iter++;
if(!(*iit)->isRemovable())
{
- return FALSE;
+ return false;
}
}
@@ -1770,10 +1772,10 @@ BOOL LLFolderViewFolder::isRemovable()
folders_t::iterator fit = iter++;
if(!(*fit)->isRemovable())
{
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
void LLFolderViewFolder::destroyRoot()
@@ -1793,7 +1795,7 @@ void LLFolderViewFolder::addItem(LLFolderViewItem* item)
mItems.push_back(item);
item->setRect(LLRect(0, 0, getRect().getWidth(), 0));
- item->setVisible(FALSE);
+ item->setVisible(false);
addChild(item);
@@ -1816,7 +1818,7 @@ void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder)
mFolders.push_back(folder);
folder->setOrigin(0, 0);
folder->reshape(getRect().getWidth(), 0);
- folder->setVisible(FALSE);
+ folder->setVisible(false);
// rearrange all descendants too, as our indentation level might have changed
//folder->requestArrange();
//requestSort();
@@ -1847,7 +1849,7 @@ void LLFolderViewFolder::toggleOpen()
}
// Force a folder open or closed
-void LLFolderViewFolder::setOpen(BOOL openitem)
+void LLFolderViewFolder::setOpen(bool openitem)
{
if(mSingleFolderMode)
{
@@ -1864,9 +1866,9 @@ void LLFolderViewFolder::setOpen(BOOL openitem)
}
}
-void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse)
+void LLFolderViewFolder::setOpenArrangeRecursively(bool openitem, ERecurseType recurse)
{
- BOOL was_open = isOpen();
+ bool was_open = isOpen();
mIsOpen = openitem;
if(!was_open && openitem)
{
@@ -1901,17 +1903,17 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType r
}
}
-BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask,
- BOOL drop,
+bool LLFolderViewFolder::handleDragAndDropFromChild(MASK mask,
+ bool drop,
EDragAndDropType c_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg)
{
- BOOL accepted = mViewModelItem->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg);
+ bool accepted = mViewModelItem->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg);
if (accepted)
{
- mDragAndDropTarget = TRUE;
+ mDragAndDropTarget = true;
*accept = ACCEPT_YES_MULTI;
}
else
@@ -1922,7 +1924,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask,
// drag and drop to child item, so clear pending auto-opens
getRoot()->autoOpenTest(NULL);
- return TRUE;
+ return true;
}
void LLFolderViewFolder::openItem( void )
@@ -1965,14 +1967,14 @@ void LLFolderViewFolder::applyFunctorRecursively(LLFolderViewFunctor& functor)
}
// LLView functionality
-BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop,
+bool LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask,
+ bool drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg)
{
- BOOL handled = FALSE;
+ bool handled = false;
if (isOpen())
{
@@ -1986,11 +1988,11 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask,
LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFolderViewFolder" << LL_ENDL;
}
- return TRUE;
+ return true;
}
-BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask,
- BOOL drop,
+bool LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask,
+ bool drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
@@ -2000,14 +2002,14 @@ BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask,
{
*accept = ACCEPT_NO;
tooltip_msg = LLTrans::getString("TooltipOutboxCannotDropOnRoot");
- return TRUE;
+ return true;
}
- BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg);
+ bool accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg);
if (accepted)
{
- mDragAndDropTarget = TRUE;
+ mDragAndDropTarget = true;
*accept = ACCEPT_YES_MULTI;
}
else
@@ -2020,13 +2022,13 @@ BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask,
getRoot()->autoOpenTest(this);
}
- return TRUE;
+ return true;
}
-BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask )
+bool LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask )
{
- BOOL handled = FALSE;
+ bool handled = false;
if( isOpen() )
{
@@ -2040,11 +2042,11 @@ BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask )
}
-BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask)
+bool LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask)
{
mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight));
- BOOL handled = LLView::handleHover(x, y, mask);
+ bool handled = LLView::handleHover(x, y, mask);
if (!handled)
{
@@ -2055,9 +2057,9 @@ BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask)
return handled;
}
-BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask )
+bool LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask )
{
- BOOL handled = FALSE;
+ bool handled = false;
if( isOpen() )
{
handled = childrenHandleMouseDown(x,y,mask) != NULL;
@@ -2068,7 +2070,7 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask )
&& !mSingleFolderMode)
{
toggleOpen();
- handled = TRUE;
+ handled = true;
}
else
{
@@ -2080,9 +2082,9 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask )
return handled;
}
-BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
+bool LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
{
- BOOL handled = FALSE;
+ bool handled = false;
if(mSingleFolderMode)
{
static LLUICachedControl<bool> double_click_new_window("SingleModeDoubleClickOpenWindow", false);
@@ -2099,7 +2101,7 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
getViewModelItem()->navigateToFolder(false);
});
}
- return TRUE;
+ return true;
}
if( isOpen() )
@@ -2114,12 +2116,12 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
if (double_click_action == 1)
{
getViewModelItem()->navigateToFolder(true);
- return TRUE;
+ return true;
}
if (double_click_action == 2)
{
getViewModelItem()->navigateToFolder(false, true);
- return TRUE;
+ return true;
}
}
if(mIndentation < x && x < mIndentation + (isCollapsed() ? 0 : mArrowSize) + mTextPad)
@@ -2130,10 +2132,10 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
}
else
{
- getRoot()->setSelection(this, FALSE);
+ getRoot()->setSelection(this, false);
toggleOpen();
}
- handled = TRUE;
+ handled = true;
}
return handled;
}
@@ -2150,19 +2152,19 @@ void LLFolderViewFolder::draw()
LLView::draw();
}
- mExpanderHighlighted = FALSE;
+ mExpanderHighlighted = false;
}
// this does prefix traversal, as folders are listed above their contents
-LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, BOOL include_children )
+LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, bool include_children )
{
- BOOL found_item = FALSE;
+ bool found_item = false;
LLFolderViewItem* result = NULL;
// when not starting from a given item, start at beginning
if(item == NULL)
{
- found_item = TRUE;
+ found_item = true;
}
// find current item among children
@@ -2180,16 +2182,16 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item,
{
if(item == (*fit))
{
- found_item = TRUE;
+ found_item = true;
// if we are on downwards traversal
if (include_children && (*fit)->isOpen())
{
// look for first descendant
- return (*fit)->getNextFromChild(NULL, TRUE);
+ return (*fit)->getNextFromChild(NULL, true);
}
// otherwise advance to next folder
++fit;
- include_children = TRUE;
+ include_children = true;
break;
}
}
@@ -2201,7 +2203,7 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item,
{
if(item == (*iit))
{
- found_item = TRUE;
+ found_item = true;
// point to next item
++iit;
break;
@@ -2214,7 +2216,7 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item,
{
// you should never call this method with an item that isn't a child
// so we should always find something
- llassert(FALSE);
+ llassert(false);
return NULL;
}
@@ -2252,22 +2254,22 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item,
{
// If there are no siblings or children to go to, recurse up one level in the tree
// and skip children for this folder, as we've already discounted them
- result = mParentFolder->getNextFromChild(this, FALSE);
+ result = mParentFolder->getNextFromChild(this, false);
}
return result;
}
// this does postfix traversal, as folders are listed above their contents
-LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* item, BOOL include_children )
+LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* item, bool include_children )
{
- BOOL found_item = FALSE;
+ bool found_item = false;
LLFolderViewItem* result = NULL;
// when not starting from a given item, start at end
if(item == NULL)
{
- found_item = TRUE;
+ found_item = true;
}
// find current item among children
@@ -2285,7 +2287,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it
{
if(item == (*iit))
{
- found_item = TRUE;
+ found_item = true;
// point to next item
++iit;
break;
@@ -2299,7 +2301,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it
{
if(item == (*fit))
{
- found_item = TRUE;
+ found_item = true;
// point to next folder
++fit;
break;
@@ -2312,7 +2314,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it
{
// you should never call this method with an item that isn't a child
// so we should always find something
- llassert(FALSE);
+ llassert(false);
return NULL;
}