diff options
Diffstat (limited to 'indra/newview/llfolderview.cpp')
-rw-r--r-- | indra/newview/llfolderview.cpp | 136 |
1 files changed, 38 insertions, 98 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index d71e288ffe..8d4d6a178a 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -2,25 +2,31 @@ * @file llfolderview.cpp * @brief Implementation of the folder view collection of classes. * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -82,10 +88,6 @@ const S32 MIN_ITEM_WIDTH_VISIBLE = LLFolderViewItem::ICON_WIDTH + /*first few characters*/ 40; const S32 MINIMUM_RENAMER_WIDTH = 80; -// *TODO: move in params in xml if necessary. Requires modification of LLFolderView & LLInventoryPanel Params. -const S32 STATUS_TEXT_HPAD = 6; -const S32 STATUS_TEXT_VPAD = 8; - enum { SIGNAL_NO_KEYBOARD_FOCUS = 1, SIGNAL_KEYBOARD_FOCUS = 2 @@ -179,7 +181,6 @@ LLFolderView::LLFolderView(const Params& p) mRenameItem( NULL ), mNeedsScroll( FALSE ), mEnableScroll( true ), - mUseLabelSuffix(p.use_label_suffix), mPinningSelectedItem(FALSE), mNeedsAutoSelect( FALSE ), mAutoSelectOverride(FALSE), @@ -245,10 +246,6 @@ LLFolderView::LLFolderView(const Params& p) text_p.font(font); text_p.visible(false); text_p.allow_html(true); - text_p.wrap(true); // allow multiline text. See EXT-7564, EXT-7047 - // set text padding the same as in People panel. EXT-7047, EXT-4837 - text_p.h_pad(STATUS_TEXT_HPAD); - text_p.v_pad(STATUS_TEXT_VPAD); mStatusTextBox = LLUICtrlFactory::create<LLTextBox> (text_p); mStatusTextBox->setFollowsLeft(); mStatusTextBox->setFollowsTop(); @@ -849,16 +846,16 @@ void LLFolderView::clearSelection() mSelectThisID.setNull(); } -std::set<LLUUID> LLFolderView::getSelectionList() const +BOOL LLFolderView::getSelectionList(std::set<LLUUID> &selection) const { - std::set<LLUUID> selection; for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) { selection.insert((*item_it)->getListener()->getUUID()); } - return selection; + + return (selection.size() != 0); } BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source) @@ -949,31 +946,12 @@ void LLFolderView::draw() } else { - LLStringUtil::format_map_t args; - args["[SEARCH_TERM]"] = LLURI::escape(getFilter()->getFilterSubStringOrig()); - mStatusText = LLTrans::getString(getFilter()->getEmptyLookupMessage(), args); + mStatusText = LLTrans::getString(getFilter()->getEmptyLookupMessage()); //font->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } mStatusTextBox->setValue(mStatusText); mStatusTextBox->setVisible( TRUE ); - // firstly reshape message textbox with current size. This is necessary to - // LLTextBox::getTextPixelHeight works properly - const LLRect local_rect = getLocalRect(); - mStatusTextBox->setShape(local_rect); - - // get preferable text height... - S32 pixel_height = mStatusTextBox->getTextPixelHeight(); - bool height_changed = local_rect.getHeight() != pixel_height; - if (height_changed) - { - // ... if it does not match current height, lets rearrange current view. - // This will indirectly call ::arrange and reshape of the status textbox. - // We should call this method to also notify parent about required rect. - // See EXT-7564, EXT-7047. - arrangeFromRoot(); - } - } LLFolderViewFolder::draw(); @@ -1189,7 +1167,7 @@ void LLFolderView::propertiesSelectedItems( void ) void LLFolderView::changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type) { - LLFolderBridge *folder_bridge = LLFolderBridge::sSelf.get(); + LLFolderBridge *folder_bridge = LLFolderBridge::sSelf; if (!folder_bridge) return; LLViewerInventoryCategory *cat = folder_bridge->getCategory(); @@ -1438,8 +1416,8 @@ void LLFolderView::startRenamingSelectedItem( void ) mRenamer->setVisible( TRUE ); // set focus will fail unless item is visible mRenamer->setFocus( TRUE ); - mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this, _1)); - mRenamer->setFocusLostCallback(boost::bind(&LLFolderView::onRenamerLost, this, _1)); + mRenamer->setTopLostCallback(boost::bind(onRenamerLost, _1)); + mRenamer->setFocusLostCallback(boost::bind(onRenamerLost, _1)); gViewerWindow->addPopup(mRenamer); } } @@ -1764,8 +1742,6 @@ BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) mParentPanel->setFocus(TRUE); - LLEditMenuHandler::gEditMenuHandler = this; - return LLView::handleMouseDown( x, y, mask ); } @@ -1862,24 +1838,18 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) LLView::child_list_t::const_iterator menu_itor; for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor) { - (*menu_itor)->setVisible(FALSE); - (*menu_itor)->pushVisible(TRUE); + (*menu_itor)->setVisible(TRUE); (*menu_itor)->setEnabled(TRUE); } // Successively filter out invalid options - + selected_items_t::iterator item_itor; U32 flags = FIRST_SELECTED_ITEM; - for (selected_items_t::iterator item_itor = mSelectedItems.begin(); - item_itor != mSelectedItems.end(); - ++item_itor) + for (item_itor = mSelectedItems.begin(); item_itor != mSelectedItems.end(); ++item_itor) { - LLFolderViewItem* selected_item = (*item_itor); - selected_item->buildContextMenu(*menu, flags); + (*item_itor)->buildContextMenu(*menu, flags); flags = 0x0; } - - addNoOptions(menu); menu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(this, menu, x, y); @@ -1888,7 +1858,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) } else { - if (menu && menu->getVisible()) + if(menu && menu->getVisible()) { menu->setVisible(FALSE); } @@ -1897,37 +1867,6 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) return handled; } -// Add "--no options--" if the menu is completely blank. -BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const -{ - const std::string nooptions_str = "--no options--"; - LLView *nooptions_item = NULL; - - const LLView::child_list_t *list = menu->getChildList(); - for (LLView::child_list_t::const_iterator itor = list->begin(); - itor != list->end(); - ++itor) - { - LLView *menu_item = (*itor); - if (menu_item->getVisible()) - { - return FALSE; - } - std::string name = menu_item->getName(); - if (menu_item->getName() == nooptions_str) - { - nooptions_item = menu_item; - } - } - if (nooptions_item) - { - nooptions_item->setVisible(TRUE); - nooptions_item->setEnabled(FALSE); - return TRUE; - } - return FALSE; -} - BOOL LLFolderView::handleHover( S32 x, S32 y, MASK mask ) { return LLView::handleHover( x, y, mask ); @@ -2129,7 +2068,8 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata) } - std::set<LLUUID> selected_items = getSelectionList(); + std::set<LLUUID> selected_items; + getSelectionList(selected_items); LLMultiPreview* multi_previewp = NULL; LLMultiProperties* multi_propertiesp = NULL; @@ -2367,7 +2307,7 @@ void LLFolderView::updateRenamerPosition() bool LLFolderView::selectFirstItem() { for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();++iter) + iter != mFolders.end();) { LLFolderViewFolder* folder = (*iter ); if (folder->getVisible()) @@ -2404,7 +2344,7 @@ bool LLFolderView::selectLastItem() } } for (folders_t::reverse_iterator iter = mFolders.rbegin(); - iter != mFolders.rend();++iter) + iter != mFolders.rend();) { LLFolderViewFolder* folder = (*iter); if (folder->getVisible()) @@ -2446,9 +2386,9 @@ S32 LLFolderView::notify(const LLSD& info) /// Local function definitions ///---------------------------------------------------------------------------- +//static void LLFolderView::onRenamerLost( LLFocusableElement* renamer) { - mRenameItem = NULL; LLUICtrl* uictrl = dynamic_cast<LLUICtrl*>(renamer); if (uictrl) { |