diff options
Diffstat (limited to 'indra/newview/llwearableitemslist.h')
-rw-r--r-- | indra/newview/llwearableitemslist.h | 213 |
1 files changed, 62 insertions, 151 deletions
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index 854c37c2c1..f03336186c 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -2,25 +2,30 @@ * @file llwearableitemslist.h * @brief A flat list of wearable items. * - * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2010, Linden Research, Inc. + * * Second Life Viewer Source Code - * Copyright (C) 2010, 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. - * - * 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. - * - * 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 - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * 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 + * + * 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 + * + * 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. + * + * 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$ */ @@ -33,7 +38,6 @@ // newview #include "llinventoryitemslist.h" -#include "llinventorylistitem.h" #include "llinventorymodel.h" #include "lllistcontextmenu.h" #include "llwearabletype.h" @@ -63,7 +67,7 @@ public: protected: - LLPanelWearableListItem(LLViewerInventoryItem* item, const Params& params); + LLPanelWearableListItem(LLViewerInventoryItem* item); }; /** @@ -77,34 +81,23 @@ class LLPanelWearableOutfitItem : public LLPanelInventoryListItemBase { LOG_CLASS(LLPanelWearableOutfitItem); public: - static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item, - bool worn_indication_enabled); + static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item); /** - * Updates item name and (worn) suffix. - */ - /*virtual*/ void updateItem(const std::string& name, - EItemState item_state = IS_DEFAULT); + * Puts item on if it is not worn by agent + * otherwise takes it off on double click. + */ + /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); protected: - LLPanelWearableOutfitItem(LLViewerInventoryItem* item, - bool worn_indication_enabled, const Params& params); -private: - bool mWornIndicationEnabled; + LLPanelWearableOutfitItem(LLViewerInventoryItem* item); }; class LLPanelDeletableWearableListItem : public LLPanelWearableListItem { LOG_CLASS(LLPanelDeletableWearableListItem); public: - struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params> - { - Optional<LLButton::Params> delete_btn; - - Params(); - }; - static LLPanelDeletableWearableListItem* create(LLViewerInventoryItem* item); @@ -118,7 +111,9 @@ public: inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); } protected: - LLPanelDeletableWearableListItem(LLViewerInventoryItem* item, const Params& params); + LLPanelDeletableWearableListItem(LLViewerInventoryItem* item); + + /*virtual*/ void init(); }; /** Outfit list item for an attachment */ @@ -130,11 +125,10 @@ public: virtual ~LLPanelAttachmentListItem() {}; /** Set item title. Joint name is added to the title in parenthesis */ - /*virtual*/ void updateItem(const std::string& name, - EItemState item_state = IS_DEFAULT); + /*virtual*/ void setTitle(const std::string& title, const std::string& highlit_text); protected: - LLPanelAttachmentListItem(LLViewerInventoryItem* item, const Params& params) : LLPanelDeletableWearableListItem(item, params) {}; + LLPanelAttachmentListItem(LLViewerInventoryItem* item) : LLPanelDeletableWearableListItem(item) {}; }; /** @@ -147,18 +141,6 @@ class LLPanelClothingListItem : public LLPanelDeletableWearableListItem LOG_CLASS(LLPanelClothingListItem); public: - struct Params : public LLInitParam::Block<Params, LLPanelDeletableWearableListItem::Params> - { - Optional<LLButton::Params> up_btn, - down_btn, - edit_btn; - Optional<LLPanel::Params> lock_panel, - edit_panel; - Optional<LLIconCtrl::Params> lock_icon; - - Params(); - }; - static LLPanelClothingListItem* create(LLViewerInventoryItem* item); virtual ~LLPanelClothingListItem(); @@ -174,25 +156,18 @@ public: inline void setShowLockButton(bool show) { setShowWidget("btn_lock", show); } inline void setShowEditButton(bool show) { setShowWidget("btn_edit_panel", show); } -protected: - LLPanelClothingListItem(LLViewerInventoryItem* item, const Params& params); +protected: + LLPanelClothingListItem(LLViewerInventoryItem* item); + + /*virtual*/ void init(); }; class LLPanelBodyPartsListItem : public LLPanelWearableListItem { LOG_CLASS(LLPanelBodyPartsListItem); public: - struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params> - { - Optional<LLButton::Params> edit_btn; - Optional<LLPanel::Params> lock_panel, - edit_panel; - Optional<LLIconCtrl::Params> lock_icon; - - Params(); - }; static LLPanelBodyPartsListItem* create(LLViewerInventoryItem* item); @@ -207,7 +182,9 @@ public: inline void setShowEditButton(bool show) { setShowWidget("btn_edit_panel", show); } protected: - LLPanelBodyPartsListItem(LLViewerInventoryItem* item, const Params& params); + LLPanelBodyPartsListItem(LLViewerInventoryItem* item); + + /*virtual*/ void init(); }; @@ -219,19 +196,16 @@ protected: class LLPanelDummyClothingListItem : public LLPanelWearableListItem { public: - struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params> - { - Optional<LLPanel::Params> add_panel; - Optional<LLButton::Params> add_btn; - Params(); - }; static LLPanelDummyClothingListItem* create(LLWearableType::EType w_type); + /*virtual*/ void updateItem(); /*virtual*/ BOOL postBuild(); LLWearableType::EType getWearableType() const; protected: - LLPanelDummyClothingListItem(LLWearableType::EType w_type, const Params& params); + LLPanelDummyClothingListItem(LLWearableType::EType w_type); + + /*virtual*/ void init(); static std::string wearableTypeToString(LLWearableType::EType w_type); @@ -302,76 +276,33 @@ class LLWearableItemTypeNameComparator : public LLWearableItemNameComparator LOG_CLASS(LLWearableItemTypeNameComparator); public: - - LLWearableItemTypeNameComparator(); + LLWearableItemTypeNameComparator() {}; virtual ~LLWearableItemTypeNameComparator() {}; - enum ETypeListOrder - { - ORDER_RANK_1 = 1, - ORDER_RANK_2, - ORDER_RANK_3, - ORDER_RANK_UNKNOWN - }; - - void setOrder(LLAssetType::EType items_of_type, ETypeListOrder order_priority, bool sort_items_by_name, bool sort_wearable_items_by_name); - protected: /** - * All information about sort order is stored in mWearableOrder map - * - * mWearableOrder : KYES VALUES - * [LLAssetType] [struct LLWearableTypeOrder] - * - *--------------------------------------------------------------------------------------------- - * I. Determines order (ORDER_RANK) in which items of LLAssetType should be displayed in list. - * For example by spec in MY OUTFITS the order is: - * 1. AT_CLOTHING (ORDER_RANK_1) - * 2. AT_OBJECT (ORDER_RANK_2) - * 3. AT_BODYPART (ORDER_RANK_3) - * - * II.Items of each type(LLAssetType) are sorted by name or type(LLWearableType) - * For example by spec in MY OUTFITS the order within each items type(LLAssetType) is: - * 1. AT_OBJECTS (abc order) - * 2. AT_CLOTHINGS - * - by type (types order determined in LLWearableType::EType) - * - outer layer on top - * 3. AT_BODYPARTS (abc order) - *--------------------------------------------------------------------------------------------- - * - * For each LLAssetType (KEYS in mWearableOrder) the information about: - * - * I. ORDER_RANK (the flag is LLWearableTypeOrder::mOrderPriority) - * - * II. whether items of this LLAssetType type should be ordered - * by name or by LLWearableType::EType (the flag is LLWearableTypeOrder::mSortAssetTypeByName) - * - * III.whether items of LLWearableType type within this LLAssetType - * should be ordered by name (the flag is LLWearableTypeOrder::mSortWearableTypeByName) - * - * holds in mWearableOrder map as VALUES (struct LLWearableTypeOrder). + * Returns "true" if wearable_item1 is placed before wearable_item2 sorted by the following: + * - Attachments (abc order) + * - Clothing + * - by type (types order determined in LLWearableType::EType) + * - outer layer on top + * - Body Parts (abc order), + * "false" otherwise. */ /*virtual*/ bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const; private: - - struct LLWearableTypeOrder + enum ETypeListOrder { - ETypeListOrder mOrderPriority; - bool mSortAssetTypeByName; - bool mSortWearableTypeByName; + TLO_ATTACHMENT = 0x01, + TLO_CLOTHING = 0x02, + TLO_BODYPART = 0x04, + TLO_UNKNOWN = 0x08, - LLWearableTypeOrder(ETypeListOrder order_priority, bool sort_asset_by_name, bool sort_wearable_by_name); - LLWearableTypeOrder(){}; + TLO_NOT_CLOTHING = TLO_ATTACHMENT | TLO_BODYPART | TLO_UNKNOWN }; - ETypeListOrder getTypeListOrder(LLAssetType::EType item_type) const; - - bool sortAssetTypeByName(LLAssetType::EType item_type) const; - bool sortWearableTypeByName(LLAssetType::EType item_type) const; - - typedef std::map<LLAssetType::EType,LLWearableTypeOrder> wearable_type_order_map_t; - wearable_type_order_map_t mWearableOrder; + static LLWearableItemTypeNameComparator::ETypeListOrder getTypeListOrder(LLAssetType::EType item_type); }; /** @@ -384,7 +315,6 @@ private: */ class LLWearableItemsList : public LLInventoryItemsList { - LOG_CLASS(LLWearableItemsList); public: /** * Context menu. @@ -395,10 +325,6 @@ public: */ class ContextMenu : public LLListContextMenu, public LLSingleton<ContextMenu> { - public: - ContextMenu(); - /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y); - protected: enum { MASK_CLOTHING = 0x01, @@ -414,15 +340,11 @@ public: static void setMenuItemEnabled(LLContextMenu* menu, const std::string& name, bool val); static void updateMask(U32& mask, LLAssetType::EType at); static void createNewWearable(const LLUUID& item_id); - static bool canAddWearable(const LLUUID& item_id); - - LLWearableItemsList* mParent; }; struct Params : public LLInitParam::Block<Params, LLInventoryItemsList::Params> { - Optional<bool> standalone; - Optional<bool> worn_indication_enabled; + Optional<bool> use_internal_context_menu; Params(); }; @@ -433,22 +355,11 @@ public: void updateList(const LLUUID& category_id); - /** - * Update items that match UUIDs from changed_items_uuids - * or links that point at such items. - */ - void updateChangedItems(const LLInventoryModel::changed_items_t& changed_items_uuids); - - bool isStandalone() const { return mIsStandalone; } - protected: friend class LLUICtrlFactory; LLWearableItemsList(const LLWearableItemsList::Params& p); void onRightClick(S32 x, S32 y); - - bool mIsStandalone; - bool mWornIndicationEnabled; }; #endif //LL_LLWEARABLEITEMSLIST_H |