diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 24b9929ee..9225afb0d 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -83,6 +83,17 @@ LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) : loadImage(mFilenameAndPath); } +// +LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void* item) : + LLFloaterNameDesc(filename, item) +{ + mLastMouseX = 0; + mLastMouseY = 0; + mImagep = NULL ; + loadImage(mFilenameAndPath); +} +// + //----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index 6a4de3d3c..003e57917 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -107,6 +107,9 @@ class LLFloaterImagePreview : public LLFloaterNameDesc { public: LLFloaterImagePreview(const std::string& filename); + // + LLFloaterImagePreview(const std::string& filename, void* item); + // virtual ~LLFloaterImagePreview(); virtual BOOL postBuild(); diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index acfcfab44..0e7a4403a 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -71,6 +71,9 @@ const S32 PREF_BUTTON_HEIGHT = 16; LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename ) : LLFloater(std::string("Name/Description Floater")) { + // + mItem = NULL; + // mFilenameAndPath = filename; mFilename = gDirUtilp->getBaseFileName(filename, false); // SL-5521 Maintain capitalization of filename when making the inventory item. JC @@ -78,6 +81,19 @@ LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename ) mIsAudio = FALSE; } +// +LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename, void* item ) + : LLFloater(std::string("Name/Description Floater")) +{ + mItem = item; + mFilenameAndPath = filename; + mFilename = gDirUtilp->getBaseFileName(filename, false); + // SL-5521 Maintain capitalization of filename when making the inventory item. JC + //LLStringUtil::toLower(mFilename); + mIsAudio = FALSE; +} +// + //----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index 6aa19eba4..4febf390b 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -45,6 +45,9 @@ class LLFloaterNameDesc : public LLFloater { public: LLFloaterNameDesc(const std::string& filename); + // + LLFloaterNameDesc(const std::string& filename, void* item); + // virtual ~LLFloaterNameDesc(); virtual BOOL postBuild(); @@ -57,6 +60,10 @@ protected: std::string mFilenameAndPath; std::string mFilename; + + // + void* mItem; + // static void onBtnOK(void*); static void onBtnCancel(void*); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 459ac2f07..4dbfa3511 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -923,24 +923,6 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, { restoreItem(); } - else if("open hex" == action) - { - LLInventoryItem* item = model->getItem(mUUID); - if(!item) return; -#if OPENSIM_RULES!=1 - if(item->getCreatorUUID() != gAgentID) return; -#endif /* OPENSIM_RULES!=1 */ - DOFloaterHex::show(mUUID); - } - else if("open text" == action) - { - LLInventoryItem* item = model->getItem(mUUID); - if(!item) return; -#if OPENSIM_RULES!=1 - if(item->getCreatorUUID() != gAgentID) return; -#endif /* OPENSIM_RULES!=1 */ - HGFloaterTextEditor::show(mUUID); - } else if ("copy_uuid" == action) { // Single item only @@ -970,6 +952,100 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, folder_view_itemp->getListener()->pasteFromClipboard(); return; } + // + else if("open hex" == action) + { + LLInventoryItem* item = model->getItem(mUUID); + if(!item) return; + DOFloaterHex::show(mUUID); + } + else if("open text" == action) + { + LLInventoryItem* item = model->getItem(mUUID); + if(!item) return; + HGFloaterTextEditor::show(mUUID); + } + else if ("rez" == action) + { + LLInventoryItem* item = model->getItem(mUUID); + if(!item) return; + LLViewerRegion* regionp = gAgent.getRegion(); + if (!regionp) + { + llwarns << "Couldn't find region to rez object" << llendl; + return; + } + + //llinfos << "Rezzing object" << llendl; + make_ui_sound("UISndObjectRezIn"); + + if (regionp + && (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX)) + { + LLFirstUse::useSandbox(); + } + + BOOL remove_from_inventory = !item->getPermissions().allowCopyBy(gAgent.getID()); + + LLVector3 rezpos = gAgent.getPositionAgent() + (gAgent.getAtAxis() * 5.0f); + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_RezObject); + + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID()); + + msg->nextBlock("RezData"); + // if it's being rezzed from task inventory, we need to enable + // saving it back into the task inventory. + // *FIX: We can probably compress this to a single byte, since I + // think folderid == mSourceID. This will be a later + // optimization. + msg->addUUIDFast(_PREHASH_FromTaskID, LLUUID::null); + msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE); + msg->addVector3Fast(_PREHASH_RayStart, rezpos); + msg->addVector3Fast(_PREHASH_RayEnd, rezpos); + msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null); + msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE); + msg->addBOOLFast(_PREHASH_RezSelected, true); + msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory); + + // deal with permissions slam logic + pack_permissions_slam(msg, item->getFlags(), item->getPermissions()); + + LLUUID folder_id = item->getParentUUID(); + msg->nextBlockFast(_PREHASH_InventoryData); + item->packMessage(msg); + + msg->sendReliable(regionp->getHost()); + } + else if("reupload" == action) + { + LLInventoryItem* item = model->getItem(mUUID); + if(!item) return; + + LLFilePicker& picker = LLFilePicker::instance(); + std::string filename; + + switch(item->getType()) + { + case LLAssetType::AT_TEXTURE: + if(!picker.getOpenFile(LLFilePicker::FFLOAD_IMAGE)) + return; + filename = picker.getFirstFile(); + if(!filename.empty()) + { + LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filename, item); + LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml"); + } + break; + default: + break; + } + } + // } void LLItemBridge::selectItem() diff --git a/indra/newview/skins/default/xui/en-us/floater_inventory.xml b/indra/newview/skins/default/xui/en-us/floater_inventory.xml index ed91425d3..4de856988 100644 --- a/indra/newview/skins/default/xui/en-us/floater_inventory.xml +++ b/indra/newview/skins/default/xui/en-us/floater_inventory.xml @@ -56,6 +56,10 @@ name="Empty Trash" width="128"> + + + + + + + + + + + + + + + +