00001
00032 #include "llfloaterproperties.h"
00033 #include "llwearable.h"
00034 #include "llviewercontrol.h"
00035 #include "llcallingcard.h"
00036
00037 enum EInventoryIcon
00038 {
00039 TEXTURE_ICON_NAME,
00040 SOUND_ICON_NAME,
00041 CALLINGCARD_ONLINE_ICON_NAME,
00042 CALLINGCARD_OFFLINE_ICON_NAME,
00043 LANDMARK_ICON_NAME,
00044 LANDMARK_VISITED_ICON_NAME,
00045 SCRIPT_ICON_NAME,
00046 CLOTHING_ICON_NAME,
00047 OBJECT_ICON_NAME,
00048 OBJECT_MULTI_ICON_NAME,
00049 NOTECARD_ICON_NAME,
00050 BODYPART_ICON_NAME,
00051 SNAPSHOT_ICON_NAME,
00052
00053 BODYPART_SHAPE_ICON_NAME,
00054 BODYPART_SKIN_ICON_NAME,
00055 BODYPART_HAIR_ICON_NAME,
00056 BODYPART_EYES_ICON_NAME,
00057 CLOTHING_SHIRT_ICON_NAME,
00058 CLOTHING_PANTS_ICON_NAME,
00059 CLOTHING_SHOES_ICON_NAME,
00060 CLOTHING_SOCKS_ICON_NAME,
00061 CLOTHING_JACKET_ICON_NAME,
00062 CLOTHING_GLOVES_ICON_NAME,
00063 CLOTHING_UNDERSHIRT_ICON_NAME,
00064 CLOTHING_UNDERPANTS_ICON_NAME,
00065 CLOTHING_SKIRT_ICON_NAME,
00066
00067 ANIMATION_ICON_NAME,
00068 GESTURE_ICON_NAME,
00069
00070 ICON_NAME_COUNT
00071 };
00072
00073 extern const char* ICON_NAME[ICON_NAME_COUNT];
00074
00075 typedef std::pair<LLUUID, LLUUID> two_uuids_t;
00076 typedef std::list<two_uuids_t> two_uuids_list_t;
00077 typedef std::pair<LLUUID, two_uuids_list_t> uuid_move_list_t;
00078
00079 struct LLMoveInv
00080 {
00081 LLUUID mObjectID;
00082 LLUUID mCategoryID;
00083 two_uuids_list_t mMoveList;
00084 void (*mCallback)(S32, void*);
00085 void* mUserData;
00086 };
00087
00088 struct LLAttachmentRezAction
00089 {
00090 LLUUID mItemID;
00091 S32 mAttachPt;
00092 };
00093
00094
00095
00096 class LLShowProps
00097 {
00098 public:
00099
00100 static void showProperties(const LLUUID& uuid)
00101 {
00102 if(!LLFloaterProperties::show(uuid, LLUUID::null))
00103 {
00104 S32 left, top;
00105 gFloaterView->getNewFloaterPosition(&left, &top);
00106 LLRect rect = gSavedSettings.getRect("PropertiesRect");
00107 rect.translate( left - rect.mLeft, top - rect.mTop );
00108 LLFloaterProperties* floater;
00109 floater = new LLFloaterProperties("item properties",
00110 rect,
00111 "Inventory Item Properties",
00112 uuid,
00113 LLUUID::null);
00114
00115 gFloaterView->adjustToFitScreen(floater, FALSE);
00116 }
00117 }
00118 };
00119
00120
00121
00122
00123
00124
00125 class LLInventoryPanelObserver : public LLInventoryObserver
00126 {
00127 public:
00128 LLInventoryPanelObserver(LLInventoryPanel* ip) : mIP(ip) {}
00129 virtual ~LLInventoryPanelObserver() {}
00130 virtual void changed(U32 mask) { mIP->modelChanged(mask); }
00131 protected:
00132 LLInventoryPanel* mIP;
00133 };
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 class LLInvFVBridge : public LLFolderViewEventListener
00147 {
00148 public:
00149
00150
00151 static LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
00152 LLInventoryType::EType inv_type,
00153 LLInventoryPanel* inventory,
00154 const LLUUID& uuid,
00155 U32 flags = 0x00);
00156 virtual ~LLInvFVBridge() {}
00157
00158 virtual const LLUUID& getUUID() const { return mUUID; }
00159
00160 virtual const LLString& getPrefix() { return LLString::null; }
00161 virtual void restoreItem() {}
00162
00163
00164 virtual const LLString& getName() const;
00165 virtual const LLString& getDisplayName() const;
00166 virtual PermissionMask getPermissionMask() const;
00167 virtual U32 getCreationDate() const;
00168 virtual LLFontGL::StyleFlags getLabelStyle() const
00169 {
00170 return LLFontGL::NORMAL;
00171 }
00172 virtual LLString getLabelSuffix() const { return LLString::null; }
00173 virtual void openItem() {}
00174 virtual void previewItem() {openItem();}
00175 virtual void showProperties();
00176 virtual BOOL isItemRenameable() const { return TRUE; }
00177
00178 virtual BOOL isItemRemovable();
00179 virtual BOOL isItemMovable();
00180
00181 virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch);
00182 virtual void move(LLFolderViewEventListener* new_parent_bridge) {}
00183 virtual BOOL isItemCopyable() const { return FALSE; }
00184 virtual BOOL copyToClipboard() const { return FALSE; }
00185 virtual void cutToClipboard() {}
00186 virtual BOOL isClipboardPasteable() const;
00187 virtual void pasteFromClipboard() {}
00188 void getClipboardEntries(bool show_asset_id, std::vector<LLString> &items,
00189 std::vector<LLString> &disabled_items, U32 flags);
00190 virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00191 virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
00192 virtual BOOL dragOrDrop(MASK mask, BOOL drop,
00193 EDragAndDropType cargo_type,
00194 void* cargo_data) { return FALSE; }
00195 virtual LLInventoryType::EType getInventoryType() const { return mInvType; }
00196
00197
00198 virtual void clearDisplayName() {}
00199
00200 protected:
00201 LLInvFVBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
00202 mInventoryPanel(inventory), mUUID(uuid), mInvType(LLInventoryType::IT_NONE) {}
00203
00204 LLInventoryObject* getInventoryObject() const;
00205 BOOL isInTrash() const;
00206
00207
00208 BOOL isAgentInventory() const;
00209 virtual BOOL isItemPermissive() const;
00210 static void changeItemParent(LLInventoryModel* model,
00211 LLViewerInventoryItem* item,
00212 const LLUUID& new_parent,
00213 BOOL restamp);
00214 static void changeCategoryParent(LLInventoryModel* model,
00215 LLViewerInventoryCategory* item,
00216 const LLUUID& new_parent,
00217 BOOL restamp);
00218 void removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch);
00219
00220 protected:
00221 LLInventoryPanel* mInventoryPanel;
00222 LLUUID mUUID;
00223 LLInventoryType::EType mInvType;
00224 };
00225
00226
00227 class LLItemBridge : public LLInvFVBridge
00228 {
00229 public:
00230 LLItemBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
00231 LLInvFVBridge(inventory, uuid) {}
00232
00233 virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action);
00234
00235 virtual void selectItem();
00236 virtual void restoreItem();
00237
00238 virtual LLUIImagePtr getIcon() const;
00239 virtual const LLString& getDisplayName() const;
00240 virtual LLString getLabelSuffix() const;
00241 virtual PermissionMask getPermissionMask() const;
00242 virtual U32 getCreationDate() const;
00243 virtual BOOL isItemRenameable() const;
00244 virtual BOOL renameItem(const LLString& new_name);
00245 virtual BOOL removeItem();
00246 virtual BOOL isItemCopyable() const;
00247 virtual BOOL copyToClipboard() const;
00248 virtual BOOL hasChildren() const { return FALSE; }
00249 virtual BOOL isUpToDate() const { return TRUE; }
00250
00251
00252 virtual void clearDisplayName() { mDisplayName.clear(); }
00253
00254 LLViewerInventoryItem* getItem() const;
00255
00256 protected:
00257 virtual BOOL isItemPermissive() const;
00258 static void buildDisplayName(LLInventoryItem* item, LLString& name);
00259 mutable LLString mDisplayName;
00260 };
00261
00262
00263 class LLFolderBridge : public LLInvFVBridge
00264 {
00265 friend class LLInvFVBridge;
00266 public:
00267 BOOL dragItemIntoFolder(LLInventoryItem* inv_item,
00268 BOOL drop);
00269 BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category,
00270 BOOL drop);
00271 virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action);
00272 virtual void openItem();
00273 virtual BOOL isItemRenameable() const;
00274 virtual void selectItem();
00275 virtual void restoreItem();
00276
00277
00278 virtual LLUIImagePtr getIcon() const;
00279 virtual BOOL renameItem(const LLString& new_name);
00280 virtual BOOL removeItem();
00281 virtual BOOL isClipboardPasteable() const;
00282 virtual void pasteFromClipboard();
00283 virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00284 virtual BOOL hasChildren() const;
00285 virtual BOOL dragOrDrop(MASK mask, BOOL drop,
00286 EDragAndDropType cargo_type,
00287 void* cargo_data);
00288
00289 virtual BOOL isItemRemovable();
00290 virtual BOOL isItemMovable();
00291 virtual BOOL isUpToDate() const;
00292
00293 static void createWearable(LLFolderBridge* bridge, EWearableType type);
00294 static void createWearable(LLUUID parent_folder_id, EWearableType type);
00295
00296 LLViewerInventoryCategory* getCategory() const;
00297
00298 protected:
00299 LLFolderBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
00300 LLInvFVBridge(inventory, uuid), mCallingCards(FALSE), mWearables(FALSE) {}
00301
00302
00303 static void pasteClipboard(void* user_data);
00304 static void createNewCategory(void* user_data);
00305
00306 static void createNewShirt(void* user_data);
00307 static void createNewPants(void* user_data);
00308 static void createNewShoes(void* user_data);
00309 static void createNewSocks(void* user_data);
00310 static void createNewJacket(void* user_data);
00311 static void createNewSkirt(void* user_data);
00312 static void createNewGloves(void* user_data);
00313 static void createNewUndershirt(void* user_data);
00314 static void createNewUnderpants(void* user_data);
00315 static void createNewShape(void* user_data);
00316 static void createNewSkin(void* user_data);
00317 static void createNewHair(void* user_data);
00318 static void createNewEyes(void* user_data);
00319
00320 BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck);
00321
00322 void modifyOutfit(BOOL append);
00323 public:
00324 static LLFolderBridge* sSelf;
00325 static void staticFolderOptionsMenu();
00326 void folderOptionsMenu();
00327 private:
00328 BOOL mCallingCards;
00329 BOOL mWearables;
00330 LLMenuGL* mMenu;
00331 std::vector<LLString> mItems;
00332 std::vector<LLString> mDisabledItems;
00333 };
00334
00335
00336 class LLScriptBridge : public LLItemBridge
00337 {
00338 friend class LLInvFVBridge;
00339 public:
00340 LLUIImagePtr getIcon() const;
00341
00342 protected:
00343 LLScriptBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) :
00344 LLItemBridge(inventory, uuid) {}
00345 };
00346
00347
00348 class LLTextureBridge : public LLItemBridge
00349 {
00350 friend class LLInvFVBridge;
00351 public:
00352 virtual const LLString& getPrefix() { return sPrefix; }
00353
00354 virtual LLUIImagePtr getIcon() const;
00355 virtual void openItem();
00356
00357 protected:
00358 LLTextureBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type) :
00359 LLItemBridge(inventory, uuid), mInvType(type) {}
00360 static LLString sPrefix;
00361 LLInventoryType::EType mInvType;
00362 };
00363
00364 class LLSoundBridge : public LLItemBridge
00365 {
00366 friend class LLInvFVBridge;
00367 public:
00368 virtual const LLString& getPrefix() { return sPrefix; }
00369
00370 virtual LLUIImagePtr getIcon() const;
00371 virtual void openItem();
00372 virtual void previewItem();
00373 virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00374 static void openSoundPreview(void*);
00375
00376 protected:
00377 LLSoundBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
00378 LLItemBridge(inventory, uuid) {}
00379 static LLString sPrefix;
00380 };
00381
00382 class LLLandmarkBridge : public LLItemBridge
00383 {
00384 friend class LLInvFVBridge;
00385 public:
00386 static const LLString& prefix() { return sPrefix; }
00387 virtual const LLString& getPrefix() { return sPrefix; }
00388 virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action);
00389 virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00390 virtual LLUIImagePtr getIcon() const;
00391 virtual void openItem();
00392
00393 protected:
00394 LLLandmarkBridge(LLInventoryPanel* inventory, const LLUUID& uuid, U32 flags = 0x00) :
00395 LLItemBridge(inventory, uuid)
00396 {
00397 mVisited = FALSE;
00398 if (flags & LLInventoryItem::II_FLAGS_LANDMARK_VISITED)
00399 {
00400 mVisited = TRUE;
00401 }
00402 }
00403
00404 protected:
00405 static LLString sPrefix;
00406 BOOL mVisited;
00407 };
00408
00409 class LLCallingCardBridge;
00410
00411 class LLCallingCardObserver : public LLFriendObserver
00412 {
00413 public:
00414 LLCallingCardObserver(LLCallingCardBridge* bridge) : mBridgep(bridge) {}
00415 virtual ~LLCallingCardObserver() { mBridgep = NULL; }
00416 virtual void changed(U32 mask);
00417
00418 protected:
00419 LLCallingCardBridge* mBridgep;
00420 };
00421
00422 class LLCallingCardBridge : public LLItemBridge
00423 {
00424 friend class LLInvFVBridge;
00425 public:
00426 virtual const LLString& getPrefix() { return sPrefix; }
00427
00428 virtual LLString getLabelSuffix() const;
00429
00430 virtual LLUIImagePtr getIcon() const;
00431 virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action);
00432 virtual void openItem();
00433 virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00434
00435
00436 virtual BOOL dragOrDrop(MASK mask, BOOL drop,
00437 EDragAndDropType cargo_type,
00438 void* cargo_data);
00439 void refreshFolderViewItem();
00440
00441 protected:
00442 LLCallingCardBridge( LLInventoryPanel* inventory, const LLUUID& uuid );
00443 ~LLCallingCardBridge();
00444
00445 protected:
00446 static LLString sPrefix;
00447 LLCallingCardObserver* mObserver;
00448 };
00449
00450
00451 class LLNotecardBridge : public LLItemBridge
00452 {
00453 friend class LLInvFVBridge;
00454 public:
00455 virtual const LLString& getPrefix() { return sPrefix; }
00456
00457 virtual LLUIImagePtr getIcon() const;
00458 virtual void openItem();
00459
00460 protected:
00461 LLNotecardBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
00462 LLItemBridge(inventory, uuid) {}
00463
00464 protected:
00465 static LLString sPrefix;
00466 };
00467
00468 class LLGestureBridge : public LLItemBridge
00469 {
00470 friend class LLInvFVBridge;
00471 public:
00472 virtual const LLString& getPrefix() { return sPrefix; }
00473
00474 virtual LLUIImagePtr getIcon() const;
00475
00476
00477
00478 virtual LLFontGL::StyleFlags getLabelStyle() const;
00479 virtual LLString getLabelSuffix() const;
00480
00481 virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action);
00482 virtual void openItem();
00483 virtual BOOL removeItem();
00484
00485 virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00486
00487 protected:
00488 LLGestureBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
00489 : LLItemBridge(inventory, uuid) {}
00490
00491 protected:
00492 static LLString sPrefix;
00493 };
00494
00495
00496 class LLAnimationBridge : public LLItemBridge
00497 {
00498 friend class LLInvFVBridge;
00499 public:
00500 virtual const LLString& getPrefix() { return sPrefix; }
00501 virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action);
00502 virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00503
00504 virtual LLUIImagePtr getIcon() const;
00505 virtual void openItem();
00506
00507 protected:
00508 LLAnimationBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
00509 LLItemBridge(inventory, uuid) {}
00510
00511 protected:
00512 static LLString sPrefix;
00513 };
00514
00515
00516 class LLObjectBridge : public LLItemBridge
00517 {
00518 friend class LLInvFVBridge;
00519 public:
00520 virtual const LLString& getPrefix() { return sPrefix; }
00521
00522 virtual LLUIImagePtr getIcon() const;
00523 virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action);
00524 virtual void openItem();
00525 virtual LLFontGL::StyleFlags getLabelStyle() const;
00526 virtual LLString getLabelSuffix() const;
00527 virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00528 virtual BOOL isItemRemovable();
00529 virtual BOOL renameItem(const LLString& new_name);
00530
00531 protected:
00532 LLObjectBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type, U32 flags) :
00533 LLItemBridge(inventory, uuid), mInvType(type)
00534 {
00535 mAttachPt = (flags & 0xff);
00536
00537 mIsMultiObject = ( flags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE;
00538 }
00539
00540 protected:
00541 static LLString sPrefix;
00542 static LLUUID sContextMenuItemID;
00543 LLInventoryType::EType mInvType;
00544 U32 mAttachPt;
00545 BOOL mIsMultiObject;
00546 };
00547
00548
00549 class LLLSLTextBridge : public LLItemBridge
00550 {
00551 friend class LLInvFVBridge;
00552 public:
00553 virtual const LLString& getPrefix() { return sPrefix; }
00554
00555 virtual LLUIImagePtr getIcon() const;
00556 virtual void openItem();
00557
00558 protected:
00559 LLLSLTextBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) :
00560 LLItemBridge(inventory, uuid) {}
00561
00562 protected:
00563 static LLString sPrefix;
00564 };
00565
00566
00567 class LLWearableBridge : public LLItemBridge
00568 {
00569 friend class LLInvFVBridge;
00570 public:
00571 virtual LLUIImagePtr getIcon() const;
00572 virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action);
00573 virtual void openItem();
00574 virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00575 virtual LLFontGL::StyleFlags getLabelStyle() const;
00576 virtual LLString getLabelSuffix() const;
00577 virtual BOOL isItemRemovable();
00578 virtual BOOL renameItem(const LLString& new_name);
00579
00580 static void onWearOnAvatar( void* userdata );
00581 static BOOL canWearOnAvatar( void* userdata );
00582 static void onWearOnAvatarArrived( LLWearable* wearable, void* userdata );
00583 void wearOnAvatar();
00584
00585 static BOOL canEditOnAvatar( void* userdata );
00586 static void onEditOnAvatar( void* userdata );
00587 void editOnAvatar();
00588
00589 static BOOL canRemoveFromAvatar( void* userdata );
00590 static void onRemoveFromAvatar( void* userdata );
00591 static void onRemoveFromAvatarArrived( LLWearable* wearable, void* userdata );
00592
00593 protected:
00594 LLWearableBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLAssetType::EType asset_type, LLInventoryType::EType inv_type, EWearableType wearable_type) :
00595 LLItemBridge(inventory, uuid),
00596 mAssetType( asset_type ),
00597 mInvType(inv_type),
00598 mWearableType(wearable_type)
00599 {}
00600
00601 protected:
00602 LLAssetType::EType mAssetType;
00603 LLInventoryType::EType mInvType;
00604 EWearableType mWearableType;
00605 };