diff options
Diffstat (limited to 'indra/newview/llinventorybridge.h')
-rw-r--r-- | indra/newview/llinventorybridge.h | 370 |
1 files changed, 219 insertions, 151 deletions
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 6ddd77284a..e7b3785a48 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -2,25 +2,31 @@ * @file llinventorybridge.h * @brief Implementation of the Inventory-Folder-View-Bridge 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$ */ @@ -68,25 +74,21 @@ public: U32 flags = 0x00); virtual ~LLInvFVBridge() {} - BOOL canShare() const; - - //-------------------------------------------------------------------- - // LLInvFVBridge functionality - //-------------------------------------------------------------------- virtual const LLUUID& getUUID() const { return mUUID; } - virtual void clearDisplayName() {} + virtual void restoreItem() {} virtual void restoreToWorld() {} - //-------------------------------------------------------------------- - // Inherited LLFolderViewEventListener functions - //-------------------------------------------------------------------- + // LLFolderViewEventListener functions virtual const std::string& getName() const; virtual const std::string& getDisplayName() const; virtual PermissionMask getPermissionMask() const; virtual LLFolderType::EType getPreferredType() const; virtual time_t getCreationDate() const; - virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } + virtual LLFontGL::StyleFlags getLabelStyle() const + { + return LLFontGL::NORMAL; + } virtual std::string getLabelSuffix() const { return LLStringUtil::null; } virtual void openItem() {} virtual void closeItem() {} @@ -97,7 +99,7 @@ public: virtual BOOL isItemRemovable() const; virtual BOOL isItemMovable() const; virtual BOOL isItemInTrash() const; - virtual BOOL isLink() const; + //virtual BOOL removeItem() = 0; virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch); virtual void move(LLFolderViewEventListener* new_parent_bridge) {} @@ -116,7 +118,12 @@ public: EDragAndDropType cargo_type, void* cargo_data) { return FALSE; } virtual LLInventoryType::EType getInventoryType() const { return mInvType; } - virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; } + + // LLInvFVBridge functionality + virtual void clearDisplayName() {} + + // Allow context menus to be customized for side panel. + bool isInOutfitsSidePanel() const; //-------------------------------------------------------------------- // Convenience functions for adding various common menu options. @@ -126,7 +133,7 @@ protected: menuentry_vec_t &disabled_items); virtual void addDeleteContextMenuOptions(menuentry_vec_t &items, menuentry_vec_t &disabled_items); - virtual void addOpenRightClickMenuOption(menuentry_vec_t &items); + protected: LLInvFVBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid); @@ -137,7 +144,7 @@ protected: BOOL isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory? BOOL isAgentInventory() const; // false if lost or in the inventory library - BOOL isCOFFolder() const; // true if COF or descendent of + BOOL isCOFFolder() const; // true if COF or descendent of. virtual BOOL isItemPermissive() const; static void changeItemParent(LLInventoryModel* model, LLViewerInventoryItem* item, @@ -153,12 +160,11 @@ protected: LLFolderView* mRoot; const LLUUID mUUID; // item id LLInventoryType::EType mInvType; - BOOL mIsLink; void purgeItem(LLInventoryModel *model, const LLUUID &uuid); }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInvFVBridgeBuilder +// Class LLInvFVBridge // // This class intended to build Folder View Bridge via LLInvFVBridge::createBridge. // It can be overridden with another way of creation necessary Inventory-Folder-View-Bridge. @@ -176,6 +182,49 @@ public: U32 flags = 0x00) const; }; +// Used by LLItemBridge::getIcon +enum EInventoryIcon +{ + TEXTURE_ICON_NAME, + SOUND_ICON_NAME, + CALLINGCARD_ONLINE_ICON_NAME, + CALLINGCARD_OFFLINE_ICON_NAME, + LANDMARK_ICON_NAME, + LANDMARK_VISITED_ICON_NAME, + SCRIPT_ICON_NAME, + CLOTHING_ICON_NAME, + OBJECT_ICON_NAME, + OBJECT_MULTI_ICON_NAME, + NOTECARD_ICON_NAME, + BODYPART_ICON_NAME, + SNAPSHOT_ICON_NAME, + + BODYPART_SHAPE_ICON_NAME, + BODYPART_SKIN_ICON_NAME, + BODYPART_HAIR_ICON_NAME, + BODYPART_EYES_ICON_NAME, + CLOTHING_SHIRT_ICON_NAME, + CLOTHING_PANTS_ICON_NAME, + CLOTHING_SHOES_ICON_NAME, + CLOTHING_SOCKS_ICON_NAME, + CLOTHING_JACKET_ICON_NAME, + CLOTHING_GLOVES_ICON_NAME, + CLOTHING_UNDERSHIRT_ICON_NAME, + CLOTHING_UNDERPANTS_ICON_NAME, + CLOTHING_SKIRT_ICON_NAME, + CLOTHING_ALPHA_ICON_NAME, + CLOTHING_TATTOO_ICON_NAME, + + ANIMATION_ICON_NAME, + GESTURE_ICON_NAME, + + LINKITEM_ICON_NAME, + LINKFOLDER_ICON_NAME, + + ICON_NAME_COUNT +}; +extern std::string ICON_NAME[ICON_NAME_COUNT]; + class LLItemBridge : public LLInvFVBridge { public: @@ -185,6 +234,7 @@ public: LLInvFVBridge(inventory, root, uuid) {} virtual void performAction(LLInventoryModel* model, std::string action); + virtual void selectItem(); virtual void restoreItem(); virtual void restoreToWorld(); @@ -203,32 +253,28 @@ public: virtual BOOL hasChildren() const { return FALSE; } virtual BOOL isUpToDate() const { return TRUE; } - /*virtual*/ void clearDisplayName() { mDisplayName.clear(); } + // override for LLInvFVBridge + virtual void clearDisplayName() { mDisplayName.clear(); } LLViewerInventoryItem* getItem() const; + bool isAddAction(std::string action) const; bool isRemoveAction(std::string action) const; + protected: - BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response); virtual BOOL isItemPermissive() const; static void buildDisplayName(LLInventoryItem* item, std::string& name); - mutable std::string mDisplayName; }; class LLFolderBridge : public LLInvFVBridge { + friend class LLInvFVBridge; public: - LLFolderBridge(LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid) : - LLInvFVBridge(inventory, root, uuid), - mCallingCards(FALSE), - mWearables(FALSE) - {} - BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop); - BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop); - + BOOL dragItemIntoFolder(LLInventoryItem* inv_item, + BOOL drop); + BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, + BOOL drop); virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); virtual void closeItem(); @@ -263,17 +309,24 @@ public: virtual BOOL isClipboardPasteableAsLink() const; virtual BOOL copyToClipboard() const; - static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type); + static void createWearable(LLFolderBridge* bridge, EWearableType type); + static void createWearable(const LLUUID &parent_folder_id, EWearableType type); LLViewerInventoryCategory* getCategory() const; - LLHandle<LLFolderBridge> getHandle() { mHandle.bind(this); return mHandle; } protected: - //-------------------------------------------------------------------- - // Menu callbacks - //-------------------------------------------------------------------- + LLFolderBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid) : + LLInvFVBridge(inventory, root, uuid), + mCallingCards(FALSE), + mWearables(FALSE), + mMenu(NULL) {} + + // menu callbacks static void pasteClipboard(void* user_data); static void createNewCategory(void* user_data); + static void createNewShirt(void* user_data); static void createNewPants(void* user_data); static void createNewShoes(void* user_data); @@ -289,83 +342,97 @@ protected: static void createNewEyes(void* user_data); BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck); + BOOL areAnyContentsWorn(LLInventoryModel* model) const; void modifyOutfit(BOOL append); void determineFolderType(); - menuentry_vec_t getMenuItems() { return mItems; } // returns a copy of current menu items - - - //-------------------------------------------------------------------- - // Messy hacks for handling folder options - //-------------------------------------------------------------------- public: - static LLHandle<LLFolderBridge> sSelf; + static LLFolderBridge* sSelf; static void staticFolderOptionsMenu(); void folderOptionsMenu(); - private: - BOOL mCallingCards; - BOOL mWearables; - LLHandle<LLView> mMenu; - menuentry_vec_t mItems; - menuentry_vec_t mDisabledItems; - LLRootHandle<LLFolderBridge> mHandle; + BOOL mCallingCards; + BOOL mWearables; + LLMenuGL* mMenu; + menuentry_vec_t mItems; + menuentry_vec_t mDisabledItems; +}; + +// DEPRECATED +class LLScriptBridge : public LLItemBridge +{ + friend class LLInvFVBridge; +public: + LLUIImagePtr getIcon() const; + +protected: + LLScriptBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid ) : + LLItemBridge(inventory, root, uuid) {} }; class LLTextureBridge : public LLItemBridge { + friend class LLInvFVBridge; public: - LLTextureBridge(LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid, - LLInventoryType::EType type) : - LLItemBridge(inventory, root, uuid) - { - mInvType = type; - } virtual LLUIImagePtr getIcon() const; virtual void openItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual void performAction(LLInventoryModel* model, std::string action); + +protected: + LLTextureBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + LLInventoryType::EType type) : + LLItemBridge(inventory, root, uuid), + mInvType(type) + {} bool canSaveTexture(void); + LLInventoryType::EType mInvType; }; class LLSoundBridge : public LLItemBridge { + friend class LLInvFVBridge; public: - LLSoundBridge(LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid) : - LLItemBridge(inventory, root, uuid) {} + virtual LLUIImagePtr getIcon() const; virtual void openItem(); virtual void previewItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); static void openSoundPreview(void*); + +protected: + LLSoundBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid) : + LLItemBridge(inventory, root, uuid) {} }; class LLLandmarkBridge : public LLItemBridge { + friend class LLInvFVBridge; public: - LLLandmarkBridge(LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid, - U32 flags = 0x00); virtual void performAction(LLInventoryModel* model, std::string action); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual LLUIImagePtr getIcon() const; virtual void openItem(); + +protected: + LLLandmarkBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + U32 flags = 0x00); protected: BOOL mVisited; }; class LLCallingCardBridge : public LLItemBridge { + friend class LLInvFVBridge; public: - LLCallingCardBridge(LLInventoryPanel* inventory, - LLFolderView* folder, - const LLUUID& uuid ); - ~LLCallingCardBridge(); virtual std::string getLabelSuffix() const; //virtual const std::string& getDisplayName() const; virtual LLUIImagePtr getIcon() const; @@ -377,96 +444,120 @@ public: void* cargo_data); void refreshFolderViewItem(); protected: + LLCallingCardBridge(LLInventoryPanel* inventory, + LLFolderView* folder, + const LLUUID& uuid ); + ~LLCallingCardBridge(); +protected: LLCallingCardObserver* mObserver; }; + class LLNotecardBridge : public LLItemBridge { + friend class LLInvFVBridge; public: + virtual LLUIImagePtr getIcon() const; + virtual void openItem(); +protected: LLNotecardBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid) : LLItemBridge(inventory, root, uuid) {} - virtual void openItem(); }; class LLGestureBridge : public LLItemBridge { + friend class LLInvFVBridge; public: - LLGestureBridge(LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid) : - LLItemBridge(inventory, root, uuid) {} + virtual LLUIImagePtr getIcon() const; + // Only suffix for gesture items, not task items, because only // gestures in your inventory can be active. virtual LLFontGL::StyleFlags getLabelStyle() const; virtual std::string getLabelSuffix() const; + virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); virtual BOOL removeItem(); + virtual void buildContextMenu(LLMenuGL& menu, U32 flags); + static void playGesture(const LLUUID& item_id); + +protected: + LLGestureBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid) + : LLItemBridge(inventory, root, uuid) {} }; class LLAnimationBridge : public LLItemBridge { + friend class LLInvFVBridge; public: + virtual void performAction(LLInventoryModel* model, std::string action); + virtual void buildContextMenu(LLMenuGL& menu, U32 flags); + + virtual LLUIImagePtr getIcon() const; + virtual void openItem(); + +protected: LLAnimationBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid) : LLItemBridge(inventory, root, uuid) {} - virtual void performAction(LLInventoryModel* model, std::string action); - virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual void openItem(); }; class LLObjectBridge : public LLItemBridge { + friend class LLInvFVBridge; public: - LLObjectBridge(LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid, - LLInventoryType::EType type, - U32 flags); virtual LLUIImagePtr getIcon() const; virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); + virtual LLFontGL::StyleFlags getLabelStyle() const; virtual std::string getLabelSuffix() const; virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual BOOL renameItem(const std::string& new_name); + LLInventoryObject* getObject() const; protected: - static LLUUID sContextMenuItemID; // Only valid while the context menu is open. + LLObjectBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + LLInventoryType::EType type, + U32 flags); +protected: + static LLUUID sContextMenuItemID; // Only valid while the context menu is open. + LLInventoryType::EType mInvType; U32 mAttachPt; BOOL mIsMultiObject; }; class LLLSLTextBridge : public LLItemBridge { + friend class LLInvFVBridge; public: + virtual LLUIImagePtr getIcon() const; + virtual void openItem(); +protected: LLLSLTextBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid ) : LLItemBridge(inventory, root, uuid) {} - virtual void openItem(); }; class LLWearableBridge : public LLItemBridge { + friend class LLInvFVBridge; public: - LLWearableBridge(LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid, - LLAssetType::EType asset_type, - LLInventoryType::EType inv_type, - LLWearableType::EType wearable_type); virtual LLUIImagePtr getIcon() const; virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual std::string getLabelSuffix() const; virtual BOOL renameItem(const std::string& new_name); - virtual LLWearableType::EType getWearableType() const { return mWearableType; } static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu static BOOL canWearOnAvatar( void* userdata ); @@ -486,38 +577,52 @@ public: static void removeItemFromAvatar(LLViewerInventoryItem *item); static void removeAllClothesFromAvatar(); void removeFromAvatar(); + +protected: + LLWearableBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + LLAssetType::EType asset_type, + LLInventoryType::EType inv_type, + EWearableType wearable_type); protected: LLAssetType::EType mAssetType; - LLWearableType::EType mWearableType; + LLInventoryType::EType mInvType; + EWearableType mWearableType; }; class LLLinkItemBridge : public LLItemBridge { + friend class LLInvFVBridge; public: + virtual const std::string& getPrefix() { return sPrefix; } + virtual LLUIImagePtr getIcon() const; + virtual void buildContextMenu(LLMenuGL& menu, U32 flags); +protected: LLLinkItemBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid) : LLItemBridge(inventory, root, uuid) {} - virtual const std::string& getPrefix() { return sPrefix; } - virtual void buildContextMenu(LLMenuGL& menu, U32 flags); protected: static std::string sPrefix; }; class LLLinkFolderBridge : public LLItemBridge { + friend class LLInvFVBridge; public: - LLLinkFolderBridge(LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid) : - LLItemBridge(inventory, root, uuid) {} virtual const std::string& getPrefix() { return sPrefix; } virtual LLUIImagePtr getIcon() const; virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual void performAction(LLInventoryModel* model, std::string action); virtual void gotoItem(); protected: + LLLinkFolderBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid) : + LLItemBridge(inventory, root, uuid) {} const LLUUID &getFolderID() const; +protected: static std::string sPrefix; }; @@ -551,41 +656,8 @@ protected: LLInventoryModel* mModel; }; -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Recent Inventory Panel related classes -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Overridden version of the Inventory-Folder-View-Bridge for Folders -class LLRecentItemsFolderBridge : public LLFolderBridge -{ -public: - // Creates context menu for Folders related to Recent Inventory Panel. - // Uses base logic and than removes from visible items "New..." menu items. - LLRecentItemsFolderBridge(LLInventoryType::EType type, - LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid) : - LLFolderBridge(inventory, root, uuid) - { - mInvType = type; - } - /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags); -}; - -// Bridge builder to create Inventory-Folder-View-Bridge for Recent Inventory Panel -class LLRecentInventoryBridgeBuilder : public LLInventoryFVBridgeBuilder -{ -public: - // Overrides FolderBridge for Recent Inventory Panel. - // It use base functionality for bridges other than FolderBridge. - virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type, - LLAssetType::EType actual_asset_type, - LLInventoryType::EType inv_type, - LLInventoryPanel* inventory, - LLFolderView* root, - const LLUUID& uuid, - U32 flags = 0x00) const; -}; +void wear_inventory_item_on_avatar(LLInventoryItem* item); void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment); @@ -599,12 +671,8 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, void* user_data = NULL); // Utility function to hide all entries except those in the list -// Can be called multiple times on the same menu (e.g. if multiple items -// are selected). If "append" is false, then only common enabled items -// are set as enabled. void hide_context_entries(LLMenuGL& menu, const menuentry_vec_t &entries_to_show, - const menuentry_vec_t &disabled_entries, - BOOL append = FALSE); + const menuentry_vec_t &disabled_entries); #endif // LL_LLINVENTORYBRIDGE_H |