don't you be reverting my changes, boy

This commit is contained in:
Hazim Gazov
2010-05-16 02:43:17 -03:00
16 changed files with 5034 additions and 4984 deletions

View File

@@ -1,415 +1,431 @@
/** /**
* @file dofloaterhex.h * @file dofloaterhex.h
* @brief Hex Editor Floater made by Day * @brief Hex Editor Floater made by Day
* @author Day Oh * @author Day Oh
* *
* $LicenseInfo:firstyear=2009&license=WTFPLV2$ * $LicenseInfo:firstyear=2009&license=WTFPLV2$
* *
*/ */
// <edit> // <edit>
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "dofloaterhex.h" #include "dofloaterhex.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llinventorybackup.h" // for downloading #include "llinventorybackup.h" // for downloading
#include "llviewercontrol.h" // gSavedSettings #include "llviewercontrol.h" // gSavedSettings
#include "llviewerwindow.h" // alertXML #include "llviewerwindow.h" // alertXML
#include "llagent.h" // gAgent getID #include "llagent.h" // gAgent getID
#include "llviewermenufile.h" #include "llviewermenufile.h"
#include "llviewerregion.h" // getCapability #include "llviewerregion.h" // getCapability
#include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder #include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder
#include "llinventorymodel.h" // gInventory.updateItem #include "llinventorymodel.h" // gInventory.updateItem
#include "llappviewer.h" // gLocalInventoryRoot #include "llappviewer.h" // gLocalInventoryRoot
#include "llfloaterperms.h" //get default perms #include "llfloaterperms.h" //get default perms
std::list<DOFloaterHex*> DOFloaterHex::sInstances;
std::list<DOFloaterHex*> DOFloaterHex::sInstances; S32 DOFloaterHex::sUploadAmount = 10;
S32 DOFloaterHex::sUploadAmount = 10;
DOFloaterHex::DOFloaterHex(LLInventoryItem* item)
DOFloaterHex::DOFloaterHex(LLInventoryItem* item) : LLFloater()
: LLFloater() {
{ sInstances.push_back(this);
sInstances.push_back(this); mItem = item;
mItem = item; LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hex.xml");
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hex.xml"); }
}
// static
// static void DOFloaterHex::show(LLUUID item_id)
void DOFloaterHex::show(LLUUID item_id) {
{ LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id);
LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id); if(item)
if(item) {
{ S32 left, top;
S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top);
gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("FloaterHexRect");
LLRect rect = gSavedSettings.getRect("FloaterHexRect"); rect.translate(left - rect.mLeft, top - rect.mTop);
rect.translate(left - rect.mLeft, top - rect.mTop); DOFloaterHex* floaterp = new DOFloaterHex(item);
DOFloaterHex* floaterp = new DOFloaterHex(item); floaterp->setRect(rect);
floaterp->setRect(rect); gFloaterView->adjustToFitScreen(floaterp, FALSE);
gFloaterView->adjustToFitScreen(floaterp, FALSE); }
} }
}
DOFloaterHex::~DOFloaterHex()
DOFloaterHex::~DOFloaterHex() {
{ sInstances.remove(this);
sInstances.remove(this); }
}
void DOFloaterHex::close(bool app_quitting)
void DOFloaterHex::close(bool app_quitting) {
{ LLFloater::close(app_quitting);
LLFloater::close(app_quitting); }
}
BOOL DOFloaterHex::postBuild(void)
BOOL DOFloaterHex::postBuild(void) {
{ DOHexEditor* editor = getChild<DOHexEditor>("hex");
DOHexEditor* editor = getChild<DOHexEditor>("hex"); mEditor = editor;
mEditor = editor; #ifndef COLUMN_SPAN
// Set number of columns
// Set number of columns U8 columns = U8(gSavedSettings.getU32("HexEditorColumns"));
U8 columns = U8(gSavedSettings.getU32("HexEditorColumns")); editor->setColumns(columns);
editor->setColumns(columns); // Reflect clamped U8ness in settings
// Reflect clamped U8ness in settings gSavedSettings.setU32("HexEditorColumns", U32(columns));
gSavedSettings.setU32("HexEditorColumns", U32(columns)); #endif
handleSizing();
// Reshape a little based on columns
S32 min_width = S32(editor->getSuggestedWidth()) + 20; childSetEnabled("upload_btn", false);
setResizeLimits(min_width, getMinHeight()); childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload"));
if(getRect().getWidth() < min_width) childSetAction("upload_btn", onClickUpload, this);
{ childSetEnabled("save_btn", false);
//LLRect rect = getRect(); childSetAction("save_btn", onClickSave, this);
//rect.setOriginAndSize(rect.mLeft, rect.mBottom, min_width, rect.getHeight());
//setRect(rect); if(mItem)
{
reshape(min_width, getRect().getHeight(), FALSE); std::string title = "Hex editor: " + mItem->getName();
editor->reshape(editor->getRect().getWidth(), editor->getRect().getHeight(), TRUE); const char* asset_type_name = LLAssetType::lookup(mItem->getType());
} if(asset_type_name)
{
childSetEnabled("upload_btn", false); title.append(" (" + std::string(asset_type_name) + ")");
childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload")); }
childSetAction("upload_btn", onClickUpload, this); setTitle(title);
childSetEnabled("save_btn", false); }
childSetAction("save_btn", onClickSave, this); #if OPENSIM_RULES!=1
if(mItem->getCreatorUUID() == gAgentID)
if(mItem) {
{ #endif /* OPENSIM_RULES!=1 */
std::string title = "Hex editor: " + mItem->getName(); // Load the asset
const char* asset_type_name = LLAssetType::lookup(mItem->getType()); editor->setVisible(FALSE);
if(asset_type_name) childSetText("status_text", std::string("Loading..."));
{ LLInventoryBackup::download(mItem, this, imageCallback, assetCallback);
title.append(" (" + std::string(asset_type_name) + ")"); #if OPENSIM_RULES!=1
} } else {
setTitle(title); this->close(false);
} }
#if OPENSIM_RULES!=1 #endif /* OPENSIM_RULES!=1 */
if(mItem->getCreatorUUID() == gAgentID)
{ return TRUE;
#endif /* OPENSIM_RULES!=1 */ }
// Load the asset
editor->setVisible(FALSE); // static
childSetText("status_text", std::string("Loading...")); void DOFloaterHex::imageCallback(BOOL success,
LLInventoryBackup::download(mItem, this, imageCallback, assetCallback); LLViewerImage *src_vi,
#if OPENSIM_RULES!=1 LLImageRaw* src,
} else { LLImageRaw* aux_src,
this->close(false); S32 discard_level,
} BOOL final,
#endif /* OPENSIM_RULES!=1 */ void* userdata)
{
return TRUE; if(final)
} {
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
// static DOFloaterHex* floater = (DOFloaterHex*)(data->floater);
void DOFloaterHex::imageCallback(BOOL success, if(!floater) return;
LLViewerImage *src_vi, if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
LLImageRaw* src, //LLInventoryItem* item = data->item;
LLImageRaw* aux_src,
S32 discard_level, if(!success)
BOOL final, {
void* userdata) floater->childSetText("status_text", std::string("Unable to download asset."));
{ return;
if(final) }
{
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata); U8* src_data = src->getData();
DOFloaterHex* floater = (DOFloaterHex*)(data->floater); S32 size = src->getDataSize();
if(!floater) return; std::vector<U8> new_data;
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash for(S32 i = 0; i < size; i++)
//LLInventoryItem* item = data->item; new_data.push_back(src_data[i]);
if(!success) floater->mEditor->setValue(new_data);
{ floater->mEditor->setVisible(TRUE);
floater->childSetText("status_text", std::string("Unable to download asset.")); floater->childSetText("status_text", std::string("Note: Image data shown isn't the actual asset data, yet"));
return;
} floater->childSetEnabled("save_btn", false);
floater->childSetEnabled("upload_btn", true);
U8* src_data = src->getData(); floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
S32 size = src->getDataSize(); }
std::vector<U8> new_data; else
for(S32 i = 0; i < size; i++) {
new_data.push_back(src_data[i]); src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI);
}
floater->mEditor->setValue(new_data); }
floater->mEditor->setVisible(TRUE);
floater->childSetText("status_text", std::string("Note: Image data shown isn't the actual asset data, yet")); // static
void DOFloaterHex::assetCallback(LLVFS *vfs,
floater->childSetEnabled("save_btn", false); const LLUUID& asset_uuid,
floater->childSetEnabled("upload_btn", true); LLAssetType::EType type,
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); void* user_data, S32 status, LLExtStat ext_status)
} {
else LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
{ DOFloaterHex* floater = (DOFloaterHex*)(data->floater);
src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI); if(!floater) return;
} if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
} LLInventoryItem* item = data->item;
// static if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD)
void DOFloaterHex::assetCallback(LLVFS *vfs, {
const LLUUID& asset_uuid, floater->childSetText("status_text", std::string("Unable to download asset."));
LLAssetType::EType type, return;
void* user_data, S32 status, LLExtStat ext_status) }
{
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data); // Todo: this doesn't work for static vfs shit
DOFloaterHex* floater = (DOFloaterHex*)(data->floater); LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
if(!floater) return; S32 size = file.getSize();
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
LLInventoryItem* item = data->item; char* buffer = new char[size];
if (buffer == NULL)
if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD) {
{ llerrs << "Memory Allocation Failed" << llendl;
floater->childSetText("status_text", std::string("Unable to download asset.")); return;
return; }
}
file.read((U8*)buffer, size);
// Todo: this doesn't work for static vfs shit
LLVFile file(vfs, asset_uuid, type, LLVFile::READ); std::vector<U8> new_data;
S32 size = file.getSize(); for(S32 i = 0; i < size; i++)
new_data.push_back(buffer[i]);
char* buffer = new char[size];
if (buffer == NULL) delete[] buffer;
{
llerrs << "Memory Allocation Failed" << llendl; floater->mEditor->setValue(new_data);
return; floater->mEditor->setVisible(TRUE);
} floater->childSetText("status_text", std::string(""));
file.read((U8*)buffer, size); floater->childSetEnabled("upload_btn", true);
floater->childSetEnabled("save_btn", false);
std::vector<U8> new_data; if(item->getPermissions().allowModifyBy(gAgent.getID()))
for(S32 i = 0; i < size; i++) {
new_data.push_back(buffer[i]); switch(item->getType())
{
delete[] buffer; case LLAssetType::AT_TEXTURE:
case LLAssetType::AT_ANIMATION:
floater->mEditor->setValue(new_data); case LLAssetType::AT_SOUND:
floater->mEditor->setVisible(TRUE); floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
floater->childSetText("status_text", std::string("")); break;
case LLAssetType::AT_LANDMARK:
floater->childSetEnabled("upload_btn", true); case LLAssetType::AT_CALLINGCARD:
floater->childSetEnabled("save_btn", false); floater->childSetEnabled("upload_btn", false);
if(item->getPermissions().allowModifyBy(gAgent.getID())) floater->childSetEnabled("save_btn", false);
{ break;
switch(item->getType()) default:
{ floater->childSetEnabled("save_btn", true);
case LLAssetType::AT_TEXTURE: break;
case LLAssetType::AT_ANIMATION: }
case LLAssetType::AT_SOUND: }
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); else
break; {
case LLAssetType::AT_LANDMARK: switch(item->getType())
case LLAssetType::AT_CALLINGCARD: {
floater->childSetEnabled("upload_btn", false); case LLAssetType::AT_TEXTURE:
floater->childSetEnabled("save_btn", false); case LLAssetType::AT_ANIMATION:
break; case LLAssetType::AT_SOUND:
default: floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
floater->childSetEnabled("save_btn", true); break;
break; default:
} break;
} }
else }
{
switch(item->getType()) // Never enable save if it's a pretend item
{ if(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot))
case LLAssetType::AT_TEXTURE: {
case LLAssetType::AT_ANIMATION: floater->childSetEnabled("save_btn", false);
case LLAssetType::AT_SOUND: }
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); }
break;
default: // static
break; void DOFloaterHex::onClickUpload(void* user_data)
} {
} DOFloaterHex* floater = (DOFloaterHex*)user_data;
LLInventoryItem* item = floater->mItem;
// Never enable save if it's a pretend item
if(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot)) LLTransactionID transaction_id;
{ transaction_id.generate();
floater->childSetEnabled("save_btn", false); LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
}
} std::vector<U8> value = floater->mEditor->getValue();
int size = value.size();
// static U8* buffer = new U8[size];
void DOFloaterHex::onClickUpload(void* user_data) for(int i = 0; i < size; i++)
{ buffer[i] = value[i];
DOFloaterHex* floater = (DOFloaterHex*)user_data; value.clear();
LLInventoryItem* item = floater->mItem;
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
LLTransactionID transaction_id; file.setMaxSize(size);
transaction_id.generate(); if (!file.write(buffer, size))
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID()); {
LLSD args;
std::vector<U8> value = floater->mEditor->getValue(); args["ERROR_MESSAGE"] = "Couldn't write data to file";
int size = value.size(); LLNotifications::instance().add("ErrorMessage", args);
U8* buffer = new U8[size]; return;
for(int i = 0; i < size; i++) }
buffer[i] = value[i]; delete[] buffer;
value.clear();
LLAssetStorage::LLStoreAssetCallback callback = NULL;
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND); void *fake_user_data = NULL;
file.setMaxSize(size);
if (!file.write(buffer, size)) if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT
{ && item->getType() != LLAssetType::AT_NOTECARD)
LLSD args; {
args["ERROR_MESSAGE"] = "Couldn't write data to file"; upload_new_resource(transaction_id,
LLNotifications::instance().add("ErrorMessage", args); item->getType(),
return; item->getName(),
} item->getDescription(),
delete[] buffer; 0,
item->getType(),
LLAssetStorage::LLStoreAssetCallback callback = NULL; item->getInventoryType(),
void *fake_user_data = NULL; LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
item->getName(),
if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT callback,
&& item->getType() != LLAssetType::AT_NOTECARD) sUploadAmount,
{ fake_user_data);
upload_new_resource(transaction_id, }
item->getType(), else // gestures and scripts, create an item first
item->getName(), { // AND notecards
item->getDescription(), //if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true;
0, create_inventory_item( gAgent.getID(),
item->getType(), gAgent.getSessionID(),
item->getInventoryType(), item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()),
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), LLTransactionID::tnull,
item->getName(), item->getName(),
callback, fake_asset_id.asString(),
sUploadAmount, item->getType(),
fake_user_data); item->getInventoryType(),
} (EWearableType)item->getFlags(),
else // gestures and scripts, create an item first PERM_ITEM_UNRESTRICTED,
{ // AND notecards new NewResourceItemCallback);
//if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true; }
create_inventory_item( gAgent.getID(), }
gAgent.getSessionID(),
item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()), struct LLSaveInfo
LLTransactionID::tnull, {
item->getName(), LLSaveInfo(DOFloaterHex* floater, LLTransactionID transaction_id)
fake_asset_id.asString(), : mFloater(floater), mTransactionID(transaction_id)
item->getType(), {
item->getInventoryType(), }
(EWearableType)item->getFlags(),
PERM_ITEM_UNRESTRICTED, DOFloaterHex* mFloater;
new NewResourceItemCallback); LLTransactionID mTransactionID;
} };
}
// static
struct LLSaveInfo void DOFloaterHex::onClickSave(void* user_data)
{ {
LLSaveInfo(DOFloaterHex* floater, LLTransactionID transaction_id) DOFloaterHex* floater = (DOFloaterHex*)user_data;
: mFloater(floater), mTransactionID(transaction_id) LLInventoryItem* item = floater->mItem;
{
} LLTransactionID transaction_id;
transaction_id.generate();
DOFloaterHex* mFloater; LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
LLTransactionID mTransactionID;
}; std::vector<U8> value = floater->mEditor->getValue();
int size = value.size();
// static U8* buffer = new U8[size];
void DOFloaterHex::onClickSave(void* user_data) for(int i = 0; i < size; i++)
{ buffer[i] = value[i];
DOFloaterHex* floater = (DOFloaterHex*)user_data; value.clear();
LLInventoryItem* item = floater->mItem;
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
LLTransactionID transaction_id; file.setMaxSize(size);
transaction_id.generate(); if (!file.write(buffer, size))
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID()); {
LLSD args;
std::vector<U8> value = floater->mEditor->getValue(); args["ERROR_MESSAGE"] = "Couldn't write data to file";
int size = value.size(); LLNotifications::instance().add("ErrorMessage", args);
U8* buffer = new U8[size]; return;
for(int i = 0; i < size; i++) }
buffer[i] = value[i]; delete[] buffer;
value.clear();
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND); bool caps = false;
file.setMaxSize(size); std::string url;
if (!file.write(buffer, size)) LLSD body;
{ body["item_id"] = item->getUUID();
LLSD args;
args["ERROR_MESSAGE"] = "Couldn't write data to file"; switch(item->getType())
LLNotifications::instance().add("ErrorMessage", args); {
return; case LLAssetType::AT_GESTURE:
} url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory");
delete[] buffer; caps = true;
break;
case LLAssetType::AT_LSL_TEXT:
bool caps = false; url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
std::string url; body["target"] = "mono";
LLSD body; caps = true;
body["item_id"] = item->getUUID(); break;
case LLAssetType::AT_NOTECARD:
switch(item->getType()) url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory");
{ caps = true;
case LLAssetType::AT_GESTURE: break;
url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory"); default: // wearables & notecards, Oct 12 2009
caps = true; // ONLY WEARABLES, Oct 15 2009
break; floater->childSetText("status_text", std::string("Saving..."));
case LLAssetType::AT_LSL_TEXT: LLSaveInfo* info = new LLSaveInfo(floater, transaction_id);
url = gAgent.getRegion()->getCapability("UpdateScriptAgent"); gAssetStorage->storeAssetData(transaction_id, item->getType(), onSaveComplete, info);
body["target"] = "mono"; caps = false;
caps = true; break;
break; }
case LLAssetType::AT_NOTECARD:
url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory"); if(caps)
caps = true; {
break; LLHTTPClient::post(url, body,
default: // wearables & notecards, Oct 12 2009 new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType()));
// ONLY WEARABLES, Oct 15 2009 }
floater->childSetText("status_text", std::string("Saving...")); }
LLSaveInfo* info = new LLSaveInfo(floater, transaction_id);
gAssetStorage->storeAssetData(transaction_id, item->getType(), onSaveComplete, info); void DOFloaterHex::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status)
caps = false; {
break; LLSaveInfo* info = (LLSaveInfo*)user_data;
} DOFloaterHex* floater = info->mFloater;
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
if(caps) LLInventoryItem* item = floater->mItem;
{
LLHTTPClient::post(url, body, floater->childSetText("status_text", std::string(""));
new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType()));
} if(item && (status == 0))
} {
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
void DOFloaterHex::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) new_item->setDescription(item->getDescription());
{ new_item->setTransactionID(info->mTransactionID);
LLSaveInfo* info = (LLSaveInfo*)user_data; new_item->setAssetUUID(asset_uuid);
DOFloaterHex* floater = info->mFloater; new_item->updateServer(FALSE);
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash gInventory.updateItem(new_item);
LLInventoryItem* item = floater->mItem; gInventory.notifyObservers();
}
floater->childSetText("status_text", std::string("")); else
{
if(item && (status == 0)) LLSD args;
{ args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status);
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); LLNotifications::instance().add("ErrorMessage", args);
new_item->setDescription(item->getDescription()); }
new_item->setTransactionID(info->mTransactionID); }
new_item->setAssetUUID(asset_uuid);
new_item->updateServer(FALSE); void DOFloaterHex::onCommitColumnCount(LLUICtrl *control, void *user_data)
gInventory.updateItem(new_item); {
gInventory.notifyObservers(); if(control && user_data)
} {
else DOFloaterHex *instance = (DOFloaterHex *)user_data;
{ U8 columns = llclamp<U8>((U8)llfloor(control->getValue().asReal()), 0x00, 0xFF);
LLSD args; instance->mEditor->setColumns(columns);
args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status); gSavedSettings.setU32("HexEditorColumns", (U32)instance->mEditor->getColumns());
LLNotifications::instance().add("ErrorMessage", args); instance->handleSizing();
} }
} }
// </edit> void DOFloaterHex::handleSizing()
{
// Reshape a little based on columns
S32 min_width = S32(mEditor->getSuggestedWidth(MIN_COLS)) + 20;
setResizeLimits(min_width, getMinHeight());
if(getRect().getWidth() < min_width)
{
//LLRect rect = getRect();
//rect.setOriginAndSize(rect.mLeft, rect.mBottom, min_width, rect.getHeight());
//setRect(rect);
reshape(min_width, getRect().getHeight(), FALSE);
mEditor->reshape(mEditor->getRect().getWidth(), mEditor->getRect().getHeight(), TRUE);
}
}
// </edit>

View File

@@ -1,44 +1,46 @@
// <edit> // <edit>
#ifndef LL_LLFLOATERHEX_H #ifndef LL_LLFLOATERHEX_H
#define LL_LLFLOATERHEX_H #define LL_LLFLOATERHEX_H
#include "llfloater.h" #include "llfloater.h"
#include "dohexeditor.h" #include "dohexeditor.h"
#include "llinventory.h" #include "llinventory.h"
#include "llviewerimage.h" #include "llviewerimage.h"
class DOFloaterHex class DOFloaterHex
: public LLFloater : public LLFloater
{ {
public: public:
DOFloaterHex(LLInventoryItem* item); DOFloaterHex(LLInventoryItem* item);
static void show(LLUUID item_id); static void show(LLUUID item_id);
BOOL postBuild(void); BOOL postBuild(void);
void close(bool app_quitting); void close(bool app_quitting);
static void imageCallback(BOOL success, static void imageCallback(BOOL success,
LLViewerImage *src_vi, LLViewerImage *src_vi,
LLImageRaw* src, LLImageRaw* src,
LLImageRaw* aux_src, LLImageRaw* aux_src,
S32 discard_level, S32 discard_level,
BOOL final, BOOL final,
void* userdata); void* userdata);
static void assetCallback(LLVFS *vfs, static void assetCallback(LLVFS *vfs,
const LLUUID& asset_uuid, const LLUUID& asset_uuid,
LLAssetType::EType type, LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status); void* user_data, S32 status, LLExtStat ext_status);
static void onClickSave(void* user_data); static void onClickSave(void* user_data);
static void onClickUpload(void* user_data); static void onClickUpload(void* user_data);
static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status);
LLInventoryItem* mItem; static void onCommitColumnCount(LLUICtrl *control, void *user_data);
DOHexEditor* mEditor; void handleSizing();
static std::list<DOFloaterHex*> sInstances; LLInventoryItem* mItem;
private: DOHexEditor* mEditor;
virtual ~DOFloaterHex(); static std::list<DOFloaterHex*> sInstances;
protected: private:
static S32 sUploadAmount; virtual ~DOFloaterHex();
}; protected:
static S32 sUploadAmount;
#endif };
// </edit>
#endif
// </edit>

File diff suppressed because it is too large Load Diff

View File

@@ -1,152 +1,159 @@
/** /**
* @file dohexeditor.h * @file dohexeditor.h
* @brief DOHexEditor Widget * @brief DOHexEditor Widget
* @author Day Oh * @author Day Oh
* *
* $LicenseInfo:firstyear=2009&license=WTFPLV2$ * $LicenseInfo:firstyear=2009&license=WTFPLV2$
* *
*/ */
// <edit> // <edit>
#ifndef DO_DOHEXEDITOR_H #ifndef DO_DOHEXEDITOR_H
#define DO_DOHEXEDITOR_H #define DO_DOHEXEDITOR_H
#include "lluictrl.h" #define MIN_COLS 8
#include "llscrollbar.h" #define MAX_COLS 48
#include "llviewborder.h"
#include "llundo.h" #ifndef COLUMN_SPAN
#include "lleditmenuhandler.h" #define COLUMN_SPAN
#endif
class DOHexEditor : public LLUICtrl, public LLEditMenuHandler
{ #include "lluictrl.h"
public: #include "llscrollbar.h"
DOHexEditor(const std::string& name, const LLRect& rect); #include "llviewborder.h"
~DOHexEditor(); #include "llundo.h"
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); #include "lleditmenuhandler.h"
void setValue(const LLSD& value);
LLSD getValue() const; class DOHexEditor : public LLUICtrl, public LLEditMenuHandler
void setColumns(U8 columns); {
U8 getColumns(U8 columns) { return mColumns; }; public:
U32 getLineCount(); DOHexEditor(const std::string& name, const LLRect& rect);
F32 getSuggestedWidth(); ~DOHexEditor();
U32 getProperSelectionStart(); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
U32 getProperSelectionEnd(); void setValue(const LLSD& value);
void reshape(S32 width, S32 height, BOOL called_from_parent); LLSD getValue() const;
void setFocus(BOOL b); void setColumns(U8 columns);
U8 getColumns() { return mColumns; };
BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); U32 getLineCount();
BOOL handleMouseDown(S32 x, S32 y, MASK mask); F32 getSuggestedWidth(U8 cols = -1);
BOOL handleHover(S32 x, S32 y, MASK mask); U32 getProperSelectionStart();
BOOL handleMouseUp(S32 x, S32 y, MASK mask); U32 getProperSelectionEnd();
void reshape(S32 width, S32 height, BOOL called_from_parent);
BOOL handleKeyHere(KEY key, MASK mask); void setFocus(BOOL b);
BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
BOOL handleUnicodeCharHere(llwchar uni_char); BOOL handleMouseDown(S32 x, S32 y, MASK mask);
BOOL handleHover(S32 x, S32 y, MASK mask);
void draw(); BOOL handleMouseUp(S32 x, S32 y, MASK mask);
void moveCursor(U32 pos, BOOL second_nibble); BOOL handleKeyHere(KEY key, MASK mask);
BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
void insert(U32 pos, std::vector<U8> new_data, BOOL undoable); BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
void overwrite(U32 first_pos, U32 last_pos, std::vector<U8> new_data, BOOL undoable); BOOL handleUnicodeCharHere(llwchar uni_char);
void del(U32 first_pos, U32 last_pos, BOOL undoable);
void draw();
virtual void cut();
virtual BOOL canCut() const; void moveCursor(U32 pos, BOOL second_nibble);
virtual void copy(); void insert(U32 pos, std::vector<U8> new_data, BOOL undoable);
virtual BOOL canCopy() const; void overwrite(U32 first_pos, U32 last_pos, std::vector<U8> new_data, BOOL undoable);
void del(U32 first_pos, U32 last_pos, BOOL undoable);
virtual void paste();
virtual BOOL canPaste() const; virtual void cut();
virtual BOOL canCut() const;
virtual void doDelete();
virtual BOOL canDoDelete() const; virtual void copy();
virtual BOOL canCopy() const;
virtual void selectAll();
virtual BOOL canSelectAll() const; virtual void paste();
virtual BOOL canPaste() const;
virtual void deselect();
virtual BOOL canDeselect() const; virtual void doDelete();
virtual BOOL canDoDelete() const;
virtual void undo();
virtual BOOL canUndo() const; virtual void selectAll();
virtual BOOL canSelectAll() const;
virtual void redo();
virtual BOOL canRedo() const; virtual void deselect();
virtual BOOL canDeselect() const;
private:
std::vector<U8> mValue; virtual void undo();
U8 mColumns; virtual BOOL canUndo() const;
U32 mCursorPos; virtual void redo();
BOOL mSecondNibble; virtual BOOL canRedo() const;
BOOL mInData;
BOOL mSelecting; private:
BOOL mHasSelection; std::vector<U8> mValue;
U32 mSelectionStart; U8 mColumns;
U32 mSelectionEnd;
U32 mCursorPos;
LLFontGL* mGLFont; BOOL mSecondNibble;
LLRect mTextRect; BOOL mInData;
LLScrollbar* mScrollbar; BOOL mSelecting;
LLViewBorder* mBorder; BOOL mHasSelection;
U32 mSelectionStart;
LLUndoBuffer* mUndoBuffer; U32 mSelectionEnd;
void changedLength(); LLFontGL* mGLFont;
void getPosAndContext(S32 x, S32 y, BOOL force_context, U32& pos, BOOL& in_data, BOOL& second_nibble); LLRect mTextRect;
}; LLScrollbar* mScrollbar;
LLViewBorder* mBorder;
class DOUndoHex : public LLUndoBuffer::LLUndoAction
{ LLUndoBuffer* mUndoBuffer;
protected:
DOUndoHex() { } void changedLength();
DOHexEditor* mHexEditor; void getPosAndContext(S32 x, S32 y, BOOL force_context, U32& pos, BOOL& in_data, BOOL& second_nibble);
U32 mFirstPos; };
U32 mLastPos;
std::vector<U8> mOldData; class DOUndoHex : public LLUndoBuffer::LLUndoAction
std::vector<U8> mNewData; {
public: protected:
static LLUndoAction* create() { return new DOUndoHex(); } DOUndoHex() { }
virtual void set(DOHexEditor* hex_editor, DOHexEditor* mHexEditor;
void (*undo_action)(DOUndoHex*), U32 mFirstPos;
void (*redo_action)(DOUndoHex*), U32 mLastPos;
U32 first_pos, std::vector<U8> mOldData;
U32 last_pos, std::vector<U8> mNewData;
std::vector<U8> old_data, public:
std::vector<U8> new_data); static LLUndoAction* create() { return new DOUndoHex(); }
void (*mUndoAction)(DOUndoHex*); virtual void set(DOHexEditor* hex_editor,
void (*mRedoAction)(DOUndoHex*); void (*undo_action)(DOUndoHex*),
virtual void undo(); void (*redo_action)(DOUndoHex*),
virtual void redo(); U32 first_pos,
U32 last_pos,
static void undoInsert(DOUndoHex* action); std::vector<U8> old_data,
static void redoInsert(DOUndoHex* action); std::vector<U8> new_data);
static void undoOverwrite(DOUndoHex* action); void (*mUndoAction)(DOUndoHex*);
static void redoOverwrite(DOUndoHex* action); void (*mRedoAction)(DOUndoHex*);
static void undoDel(DOUndoHex* action); virtual void undo();
static void redoDel(DOUndoHex* action); virtual void redo();
};
static void undoInsert(DOUndoHex* action);
class DOHexInsert : public DOUndoHex static void redoInsert(DOUndoHex* action);
{ static void undoOverwrite(DOUndoHex* action);
virtual void undo(); static void redoOverwrite(DOUndoHex* action);
virtual void redo(); static void undoDel(DOUndoHex* action);
}; static void redoDel(DOUndoHex* action);
};
class DOHexOverwrite : public DOUndoHex
{ class DOHexInsert : public DOUndoHex
virtual void undo(); {
virtual void redo(); virtual void undo();
}; virtual void redo();
};
class DOHexDel : public DOUndoHex
{ class DOHexOverwrite : public DOUndoHex
virtual void undo(); {
virtual void redo(); virtual void undo();
}; virtual void redo();
};
#endif
// </edit> class DOHexDel : public DOUndoHex
{
virtual void undo();
virtual void redo();
};
#endif
// </edit>

View File

@@ -1,398 +1,398 @@
/** /**
* @file hgfloatertexteditor.cpp * @file hgfloatertexteditor.cpp
* @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh) * @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh)
* @author Hazim Gazov * @author Hazim Gazov
* *
* $LicenseInfo:firstyear=2010&license=WTFPLV2$ * $LicenseInfo:firstyear=2010&license=WTFPLV2$
* *
*/ */
// <edit> // <edit>
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "hgfloatertexteditor.h" #include "hgfloatertexteditor.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llinventorybackup.h" // for downloading #include "llinventorybackup.h" // for downloading
#include "llviewercontrol.h" // gSavedSettings #include "llviewercontrol.h" // gSavedSettings
#include "llviewerwindow.h" // alertXML #include "llviewerwindow.h" // alertXML
#include "llagent.h" // gAgent getID #include "llagent.h" // gAgent getID
#include "llviewermenufile.h" #include "llviewermenufile.h"
#include "llviewerregion.h" // getCapability #include "llviewerregion.h" // getCapability
#include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder #include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder
#include "llinventorymodel.h" // gInventory.updateItem #include "llinventorymodel.h" // gInventory.updateItem
#include "llappviewer.h" // gLocalInventoryRoot #include "llappviewer.h" // gLocalInventoryRoot
#include "llfloaterperms.h" //get default perms #include "llfloaterperms.h" //get default perms
#include "lllocalinventory.h" #include "lllocalinventory.h"
std::list<HGFloaterTextEditor*> HGFloaterTextEditor::sInstances; std::list<HGFloaterTextEditor*> HGFloaterTextEditor::sInstances;
S32 HGFloaterTextEditor::sUploadAmount = 10; S32 HGFloaterTextEditor::sUploadAmount = 10;
HGFloaterTextEditor::HGFloaterTextEditor(LLInventoryItem* item) HGFloaterTextEditor::HGFloaterTextEditor(LLInventoryItem* item)
: LLFloater() : LLFloater()
{ {
sInstances.push_back(this); sInstances.push_back(this);
mItem = item; mItem = item;
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_asset_text_editor.xml"); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_asset_text_editor.xml");
} }
// static // static
void HGFloaterTextEditor::show(LLUUID item_id) void HGFloaterTextEditor::show(LLUUID item_id)
{ {
LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id); LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id);
if(item) if(item)
{ {
S32 left, top; S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top); gFloaterView->getNewFloaterPosition(&left, &top);
LLRect rect = gSavedSettings.getRect("FloaterAssetTextEditorRect"); LLRect rect = gSavedSettings.getRect("FloaterAssetTextEditorRect");
rect.translate(left - rect.mLeft, top - rect.mTop); rect.translate(left - rect.mLeft, top - rect.mTop);
HGFloaterTextEditor* floaterp = new HGFloaterTextEditor(item); HGFloaterTextEditor* floaterp = new HGFloaterTextEditor(item);
floaterp->setRect(rect); floaterp->setRect(rect);
gFloaterView->adjustToFitScreen(floaterp, FALSE); gFloaterView->adjustToFitScreen(floaterp, FALSE);
} }
} }
HGFloaterTextEditor::~HGFloaterTextEditor() HGFloaterTextEditor::~HGFloaterTextEditor()
{ {
sInstances.remove(this); sInstances.remove(this);
} }
void HGFloaterTextEditor::close(bool app_quitting) void HGFloaterTextEditor::close(bool app_quitting)
{ {
LLFloater::close(app_quitting); LLFloater::close(app_quitting);
} }
BOOL HGFloaterTextEditor::postBuild(void) BOOL HGFloaterTextEditor::postBuild(void)
{ {
LLTextEditor* editor = getChild<LLTextEditor>("text_editor"); LLTextEditor* editor = getChild<LLTextEditor>("text_editor");
mEditor = editor; mEditor = editor;
childSetEnabled("upload_btn", false); childSetEnabled("upload_btn", false);
childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload")); childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload"));
childSetAction("upload_btn", onClickUpload, this); childSetAction("upload_btn", onClickUpload, this);
childSetEnabled("save_btn", false); childSetEnabled("save_btn", false);
childSetAction("save_btn", onClickSave, this); childSetAction("save_btn", onClickSave, this);
if(mItem) if(mItem)
{ {
std::string title = "Text editor: " + mItem->getName(); std::string title = "Text editor: " + mItem->getName();
const char* asset_type_name = LLAssetType::lookup(mItem->getType()); const char* asset_type_name = LLAssetType::lookup(mItem->getType());
if(asset_type_name) if(asset_type_name)
{ {
title.append(" (" + std::string(asset_type_name) + ")"); title.append(" (" + std::string(asset_type_name) + ")");
} }
setTitle(title); setTitle(title);
} }
#if OPENSIM_RULES!=1 #if OPENSIM_RULES!=1
if(mItem->getCreatorUUID() == gAgentID) if(mItem->getCreatorUUID() == gAgentID)
{ {
#endif /* OPENSIM_RULES!=1 */ #endif /* OPENSIM_RULES!=1 */
// Load the asset // Load the asset
editor->setVisible(FALSE); editor->setVisible(FALSE);
childSetText("status_text", std::string("Loading...")); childSetText("status_text", std::string("Loading..."));
LLInventoryBackup::download(mItem, this, imageCallback, assetCallback); LLInventoryBackup::download(mItem, this, imageCallback, assetCallback);
#if OPENSIM_RULES!=1 #if OPENSIM_RULES!=1
} else { } else {
this->close(false); this->close(false);
} }
#endif /* OPENSIM_RULES!=1 */ #endif /* OPENSIM_RULES!=1 */
return TRUE; return TRUE;
} }
// static // static
void HGFloaterTextEditor::imageCallback(BOOL success, void HGFloaterTextEditor::imageCallback(BOOL success,
LLViewerImage *src_vi, LLViewerImage *src_vi,
LLImageRaw* src, LLImageRaw* src,
LLImageRaw* aux_src, LLImageRaw* aux_src,
S32 discard_level, S32 discard_level,
BOOL final, BOOL final,
void* userdata) void* userdata)
{ {
if(final) if(final)
{ {
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata); LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater); HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater);
if(!floater) return; if(!floater) return;
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
//LLInventoryItem* item = data->item; //LLInventoryItem* item = data->item;
if(!success) if(!success)
{ {
floater->childSetText("status_text", std::string("Unable to download asset.")); floater->childSetText("status_text", std::string("Unable to download asset."));
return; return;
} }
U8* src_data = src->getData(); U8* src_data = src->getData();
S32 size = src->getDataSize(); S32 size = src->getDataSize();
std::string new_data; std::string new_data;
for(S32 i = 0; i < size; i++) for(S32 i = 0; i < size; i++)
new_data += (char)src_data[i]; new_data += (char)src_data[i];
delete[] src_data; delete[] src_data;
floater->mEditor->setValue(new_data); floater->mEditor->setValue(new_data);
floater->mEditor->setVisible(TRUE); floater->mEditor->setVisible(TRUE);
floater->childSetText("status_text", std::string("Note: Image data shown isn't the actual asset data, yet")); floater->childSetText("status_text", std::string("Note: Image data shown isn't the actual asset data, yet"));
floater->childSetEnabled("save_btn", false); floater->childSetEnabled("save_btn", false);
floater->childSetEnabled("upload_btn", true); floater->childSetEnabled("upload_btn", true);
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
} }
else else
{ {
src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI); src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI);
} }
} }
// static // static
void HGFloaterTextEditor::assetCallback(LLVFS *vfs, void HGFloaterTextEditor::assetCallback(LLVFS *vfs,
const LLUUID& asset_uuid, const LLUUID& asset_uuid,
LLAssetType::EType type, LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status) void* user_data, S32 status, LLExtStat ext_status)
{ {
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data); LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater); HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater);
if(!floater) return; if(!floater) return;
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
LLInventoryItem* item = data->item; LLInventoryItem* item = data->item;
if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD) if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD)
{ {
floater->childSetText("status_text", std::string("Unable to download asset.")); floater->childSetText("status_text", std::string("Unable to download asset."));
return; return;
} }
// Todo: this doesn't work for static vfs shit // Todo: this doesn't work for static vfs shit
LLVFile file(vfs, asset_uuid, type, LLVFile::READ); LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
S32 size = file.getSize(); S32 size = file.getSize();
std::string new_data(""); std::string new_data("");
if(size > 0) if(size > 0)
{ {
char* buffer = new char[size + 1]; char* buffer = new char[size + 1];
if (buffer == NULL) if (buffer == NULL)
{ {
llerrs << "Memory Allocation Failed" << llendl; llerrs << "Memory Allocation Failed" << llendl;
return; return;
} }
file.read((U8*)buffer, size); file.read((U8*)buffer, size);
buffer[size - 1] = 0; buffer[size - 1] = 0;
new_data = std::string(buffer); new_data = std::string(buffer);
delete[] buffer; delete[] buffer;
} }
floater->mEditor->setText(LLStringExplicit(new_data)); floater->mEditor->setText(LLStringExplicit(new_data));
floater->mEditor->setVisible(TRUE); floater->mEditor->setVisible(TRUE);
floater->childSetText("status_text", llformat("File Size: %d", size)); floater->childSetText("status_text", llformat("File Size: %d", size));
floater->childSetEnabled("upload_btn", true); floater->childSetEnabled("upload_btn", true);
floater->childSetEnabled("save_btn", false); floater->childSetEnabled("save_btn", false);
if(item->getPermissions().allowModifyBy(gAgent.getID())) if(item->getPermissions().allowModifyBy(gAgent.getID()))
{ {
switch(item->getType()) switch(item->getType())
{ {
case LLAssetType::AT_TEXTURE: case LLAssetType::AT_TEXTURE:
case LLAssetType::AT_ANIMATION: case LLAssetType::AT_ANIMATION:
case LLAssetType::AT_SOUND: case LLAssetType::AT_SOUND:
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
break; break;
case LLAssetType::AT_LANDMARK: case LLAssetType::AT_LANDMARK:
case LLAssetType::AT_CALLINGCARD: case LLAssetType::AT_CALLINGCARD:
floater->childSetEnabled("upload_btn", false); floater->childSetEnabled("upload_btn", false);
floater->childSetEnabled("save_btn", false); floater->childSetEnabled("save_btn", false);
break; break;
default: default:
floater->childSetEnabled("save_btn", true); floater->childSetEnabled("save_btn", true);
break; break;
} }
} }
else else
{ {
switch(item->getType()) switch(item->getType())
{ {
case LLAssetType::AT_TEXTURE: case LLAssetType::AT_TEXTURE:
case LLAssetType::AT_ANIMATION: case LLAssetType::AT_ANIMATION:
case LLAssetType::AT_SOUND: case LLAssetType::AT_SOUND:
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)")); floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
break; break;
default: default:
break; break;
} }
} }
// Never enable save if it's a pretend item // Never enable save if it's a pretend item
if(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot)) if(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot))
{ {
floater->childSetEnabled("save_btn", false); floater->childSetEnabled("save_btn", false);
} }
} }
// static // static
void HGFloaterTextEditor::onClickUpload(void* user_data) void HGFloaterTextEditor::onClickUpload(void* user_data)
{ {
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data; HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data;
LLInventoryItem* item = floater->mItem; LLInventoryItem* item = floater->mItem;
LLTransactionID transaction_id; LLTransactionID transaction_id;
transaction_id.generate(); transaction_id.generate();
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID()); LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
const char* value = floater->mEditor->getText().c_str(); const char* value = floater->mEditor->getText().c_str();
int size = strlen(value); int size = strlen(value);
U8* buffer = new U8[size]; U8* buffer = new U8[size];
for(int i = 0; i < size; i++) for(int i = 0; i < size; i++)
buffer[i] = (U8)value[i]; buffer[i] = (U8)value[i];
delete[] value; delete[] value;
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND); LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
file.setMaxSize(size); file.setMaxSize(size);
if (!file.write(buffer, size)) if (!file.write(buffer, size))
{ {
LLSD args; LLSD args;
args["ERROR_MESSAGE"] = "Couldn't write data to file"; args["ERROR_MESSAGE"] = "Couldn't write data to file";
LLNotifications::instance().add("ErrorMessage", args); LLNotifications::instance().add("ErrorMessage", args);
return; return;
} }
LLAssetStorage::LLStoreAssetCallback callback = NULL; LLAssetStorage::LLStoreAssetCallback callback = NULL;
void *fake_user_data = NULL; void *fake_user_data = NULL;
if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT
&& item->getType() != LLAssetType::AT_NOTECARD) && item->getType() != LLAssetType::AT_NOTECARD)
{ {
upload_new_resource(transaction_id, upload_new_resource(transaction_id,
item->getType(), item->getType(),
item->getName(), item->getName(),
item->getDescription(), item->getDescription(),
0, 0,
item->getType(), item->getType(),
item->getInventoryType(), item->getInventoryType(),
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
item->getName(), item->getName(),
callback, callback,
sUploadAmount, sUploadAmount,
fake_user_data); fake_user_data);
} }
else // gestures and scripts, create an item first else // gestures and scripts, create an item first
{ // AND notecards { // AND notecards
//if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true; //if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true;
create_inventory_item( gAgent.getID(), create_inventory_item( gAgent.getID(),
gAgent.getSessionID(), gAgent.getSessionID(),
item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()), item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()),
LLTransactionID::tnull, LLTransactionID::tnull,
item->getName(), item->getName(),
fake_asset_id.asString(), fake_asset_id.asString(),
item->getType(), item->getType(),
item->getInventoryType(), item->getInventoryType(),
(EWearableType)item->getFlags(), (EWearableType)item->getFlags(),
PERM_ITEM_UNRESTRICTED, PERM_ITEM_UNRESTRICTED,
new NewResourceItemCallback); new NewResourceItemCallback);
} }
} }
struct LLSaveInfo struct LLSaveInfo
{ {
LLSaveInfo(HGFloaterTextEditor* floater, LLTransactionID transaction_id) LLSaveInfo(HGFloaterTextEditor* floater, LLTransactionID transaction_id)
: mFloater(floater), mTransactionID(transaction_id) : mFloater(floater), mTransactionID(transaction_id)
{ {
} }
HGFloaterTextEditor* mFloater; HGFloaterTextEditor* mFloater;
LLTransactionID mTransactionID; LLTransactionID mTransactionID;
}; };
// static // static
void HGFloaterTextEditor::onClickSave(void* user_data) void HGFloaterTextEditor::onClickSave(void* user_data)
{ {
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data; HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data;
LLInventoryItem* item = floater->mItem; LLInventoryItem* item = floater->mItem;
LLTransactionID transaction_id; LLTransactionID transaction_id;
transaction_id.generate(); transaction_id.generate();
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID()); LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
const char* value = floater->mEditor->getText().c_str(); const char* value = floater->mEditor->getText().c_str();
int size = strlen(value); int size = strlen(value);
U8* buffer = new U8[size]; U8* buffer = new U8[size];
for(int i = 0; i < size; i++) for(int i = 0; i < size; i++)
buffer[i] = (U8)value[i]; buffer[i] = (U8)value[i];
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND); LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
file.setMaxSize(size); file.setMaxSize(size);
if (!file.write(buffer, size)) if (!file.write(buffer, size))
{ {
LLSD args; LLSD args;
args["ERROR_MESSAGE"] = "Couldn't write data to file"; args["ERROR_MESSAGE"] = "Couldn't write data to file";
LLNotifications::instance().add("ErrorMessage", args); LLNotifications::instance().add("ErrorMessage", args);
return; return;
} }
bool caps = false; bool caps = false;
std::string url; std::string url;
LLSD body; LLSD body;
body["item_id"] = item->getUUID(); body["item_id"] = item->getUUID();
switch(item->getType()) switch(item->getType())
{ {
case LLAssetType::AT_GESTURE: case LLAssetType::AT_GESTURE:
url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory"); url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory");
caps = true; caps = true;
break; break;
case LLAssetType::AT_LSL_TEXT: case LLAssetType::AT_LSL_TEXT:
url = gAgent.getRegion()->getCapability("UpdateScriptAgent"); url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
body["target"] = "mono"; body["target"] = "mono";
caps = true; caps = true;
break; break;
case LLAssetType::AT_NOTECARD: case LLAssetType::AT_NOTECARD:
url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory"); url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory");
caps = true; caps = true;
break; break;
default: // wearables & notecards, Oct 12 2009 default: // wearables & notecards, Oct 12 2009
// ONLY WEARABLES, Oct 15 2009 // ONLY WEARABLES, Oct 15 2009
floater->childSetText("status_text", std::string("Saving...")); floater->childSetText("status_text", std::string("Saving..."));
LLSaveInfo* info = new LLSaveInfo(floater, transaction_id); LLSaveInfo* info = new LLSaveInfo(floater, transaction_id);
gAssetStorage->storeAssetData(transaction_id, item->getType(), onSaveComplete, info); gAssetStorage->storeAssetData(transaction_id, item->getType(), onSaveComplete, info);
caps = false; caps = false;
break; break;
} }
if(caps) if(caps)
{ {
LLHTTPClient::post(url, body, LLHTTPClient::post(url, body,
new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType())); new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType()));
} }
} }
void HGFloaterTextEditor::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) void HGFloaterTextEditor::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status)
{ {
LLSaveInfo* info = (LLSaveInfo*)user_data; LLSaveInfo* info = (LLSaveInfo*)user_data;
HGFloaterTextEditor* floater = info->mFloater; HGFloaterTextEditor* floater = info->mFloater;
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
LLInventoryItem* item = floater->mItem; LLInventoryItem* item = floater->mItem;
floater->childSetText("status_text", std::string("")); floater->childSetText("status_text", std::string(""));
if(item && (status == 0)) if(item && (status == 0))
{ {
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setDescription(item->getDescription()); new_item->setDescription(item->getDescription());
new_item->setTransactionID(info->mTransactionID); new_item->setTransactionID(info->mTransactionID);
new_item->setAssetUUID(asset_uuid); new_item->setAssetUUID(asset_uuid);
new_item->updateServer(FALSE); new_item->updateServer(FALSE);
gInventory.updateItem(new_item); gInventory.updateItem(new_item);
gInventory.notifyObservers(); gInventory.notifyObservers();
} }
else else
{ {
LLSD args; LLSD args;
args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status); args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status);
LLNotifications::instance().add("ErrorMessage", args); LLNotifications::instance().add("ErrorMessage", args);
} }
} }
// </edit> // </edit>

View File

@@ -1,50 +1,50 @@
/** /**
* @file hgfloatertexteditor.h * @file hgfloatertexteditor.h
* @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh) * @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh)
* @author Hazim Gazov * @author Hazim Gazov
* *
* $LicenseInfo:firstyear=2010&license=WTFPLV2$ * $LicenseInfo:firstyear=2010&license=WTFPLV2$
* *
*/ */
#ifndef HG_HGFLOATERTEXT_H #ifndef HG_HGFLOATERTEXT_H
#define HG_HGFLOATERTEXT_H #define HG_HGFLOATERTEXT_H
#include "llfloater.h" #include "llfloater.h"
#include "lltexteditor.h" #include "lltexteditor.h"
#include "llinventory.h" #include "llinventory.h"
#include "llviewerimage.h" #include "llviewerimage.h"
class HGFloaterTextEditor class HGFloaterTextEditor
: public LLFloater : public LLFloater
{ {
public: public:
HGFloaterTextEditor(LLInventoryItem* item); HGFloaterTextEditor(LLInventoryItem* item);
static void show(LLUUID item_id); static void show(LLUUID item_id);
BOOL postBuild(void); BOOL postBuild(void);
void close(bool app_quitting); void close(bool app_quitting);
static void imageCallback(BOOL success, static void imageCallback(BOOL success,
LLViewerImage *src_vi, LLViewerImage *src_vi,
LLImageRaw* src, LLImageRaw* src,
LLImageRaw* aux_src, LLImageRaw* aux_src,
S32 discard_level, S32 discard_level,
BOOL final, BOOL final,
void* userdata); void* userdata);
static void assetCallback(LLVFS *vfs, static void assetCallback(LLVFS *vfs,
const LLUUID& asset_uuid, const LLUUID& asset_uuid,
LLAssetType::EType type, LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status); void* user_data, S32 status, LLExtStat ext_status);
static void onClickSave(void* user_data); static void onClickSave(void* user_data);
static void onClickUpload(void* user_data); static void onClickUpload(void* user_data);
static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status);
LLInventoryItem* mItem; LLInventoryItem* mItem;
LLTextEditor* mEditor; LLTextEditor* mEditor;
static std::list<HGFloaterTextEditor*> sInstances; static std::list<HGFloaterTextEditor*> sInstances;
private: private:
virtual ~HGFloaterTextEditor(); virtual ~HGFloaterTextEditor();
protected: protected:
static S32 sUploadAmount; static S32 sUploadAmount;
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -86,12 +86,12 @@
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llselectmgr.h" #include "llselectmgr.h"
// <edit> // <edit>
#include "lllocalinventory.h" #include "lllocalinventory.h"
#include "llinventorybackup.h" #include "llinventorybackup.h"
//#include "llcheats.h" //#include "llcheats.h"
//#include "llnotecardmagic.h" //#include "llnotecardmagic.h"
// </edit> // </edit>
const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not)
const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably not) const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably not)
const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not) const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not)
@@ -118,49 +118,49 @@ bool doToSelected(LLFolderView* folder, std::string action)
{ {
LLInventoryClipboard::instance().reset(); LLInventoryClipboard::instance().reset();
} }
// <edit> // <edit>
if("save_as" == action) if("save_as" == action)
{ {
LLInventoryBackup::save(folder); LLInventoryBackup::save(folder);
return true; return true;
}
else if("save_invcache" == action)
{
LLFilePicker& file_picker = LLFilePicker::instance();
if(file_picker.getSaveFile( LLFilePicker::FFSAVE_INVGZ ))
{
std::string file_name = file_picker.getFirstFile();
LLLocalInventory::saveInvCache(file_name, folder);
}
return true;
} }
/* else if("save_invcache" == action)
else if("acquire_asset_id" == action) {
{ LLFilePicker& file_picker = LLFilePicker::instance();
if(LLCheats::cheatCodes["AcquireAssetID"].entered) if(file_picker.getSaveFile( LLFilePicker::FFSAVE_INVGZ ))
{ {
std::set<LLUUID> selected_items_set; std::string file_name = file_picker.getFirstFile();
folder->getSelectionList(selected_items_set); LLLocalInventory::saveInvCache(file_name, folder);
}
if(selected_items_set.size() > 0) return true;
{
LLAssetIDAcquirer::acquire(selected_items_set);
}
}
return true;
}
else if("magic_get" == action)
{
std::set<LLUUID> selected_items_set;
folder->getSelectionList(selected_items_set);
if(selected_items_set.size() > 0)
{
LLNotecardMagic::acquire(selected_items_set);
}
} }
*/ /*
// </edit> else if("acquire_asset_id" == action)
{
if(LLCheats::cheatCodes["AcquireAssetID"].entered)
{
std::set<LLUUID> selected_items_set;
folder->getSelectionList(selected_items_set);
if(selected_items_set.size() > 0)
{
LLAssetIDAcquirer::acquire(selected_items_set);
}
}
return true;
}
else if("magic_get" == action)
{
std::set<LLUUID> selected_items_set;
folder->getSelectionList(selected_items_set);
if(selected_items_set.size() > 0)
{
LLNotecardMagic::acquire(selected_items_set);
}
}
*/
// </edit>
std::set<LLUUID> selected_items; std::set<LLUUID> selected_items;
folder->getSelectionList(selected_items); folder->getSelectionList(selected_items);
@@ -521,36 +521,36 @@ class LLDoCreateFloater : public inventory_listener_t
LLInventoryModel* model = mPtr->getPanel()->getModel(); LLInventoryModel* model = mPtr->getPanel()->getModel();
if(!model) return false; if(!model) return false;
std::string type = userdata.asString(); std::string type = userdata.asString();
// <edit> // <edit>
if(type == "pretend") if(type == "pretend")
{ {
LLFloaterNewLocalInventory* floater = new LLFloaterNewLocalInventory(); LLFloaterNewLocalInventory* floater = new LLFloaterNewLocalInventory();
floater->center(); floater->center();
} }
else else
// </edit> // </edit>
do_create(model, mPtr->getPanel(), type); do_create(model, mPtr->getPanel(), type);
return true; return true;
} }
}; };
// <edit> // <edit>
class LLLoadInvCacheFloater : public inventory_listener_t class LLLoadInvCacheFloater : public inventory_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLInventoryModel* model = mPtr->getPanel()->getModel(); LLInventoryModel* model = mPtr->getPanel()->getModel();
if(!model) return false; if(!model) return false;
LLFilePicker& file_picker = LLFilePicker::instance(); LLFilePicker& file_picker = LLFilePicker::instance();
if(file_picker.getOpenFile( LLFilePicker::FFLOAD_INVGZ )) if(file_picker.getOpenFile( LLFilePicker::FFLOAD_INVGZ ))
{ {
std::string file_name = file_picker.getFirstFile(); std::string file_name = file_picker.getFirstFile();
LLLocalInventory::loadInvCache(file_name); LLLocalInventory::loadInvCache(file_name);
} }
return true; return true;
} }
}; };
// </edit> // </edit>
class LLSetSortBy : public inventory_listener_t class LLSetSortBy : public inventory_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -789,9 +789,9 @@ void init_inventory_actions(LLInventoryView *floater)
(new LLCloseAllFoldersFloater())->registerListener(floater, "Inventory.CloseAllFolders"); (new LLCloseAllFoldersFloater())->registerListener(floater, "Inventory.CloseAllFolders");
(new LLEmptyTrashFloater())->registerListener(floater, "Inventory.EmptyTrash"); (new LLEmptyTrashFloater())->registerListener(floater, "Inventory.EmptyTrash");
(new LLDoCreateFloater())->registerListener(floater, "Inventory.DoCreate"); (new LLDoCreateFloater())->registerListener(floater, "Inventory.DoCreate");
// <edit> // <edit>
(new LLLoadInvCacheFloater())->registerListener(floater, "Inventory.LoadInvCache"); (new LLLoadInvCacheFloater())->registerListener(floater, "Inventory.LoadInvCache");
// </edit> // </edit>
(new LLNewWindow())->registerListener(floater, "Inventory.NewWindow"); (new LLNewWindow())->registerListener(floater, "Inventory.NewWindow");
(new LLShowFilters())->registerListener(floater, "Inventory.ShowFilters"); (new LLShowFilters())->registerListener(floater, "Inventory.ShowFilters");

View File

@@ -770,4 +770,4 @@ void LLFloaterInventoryBackup::assetCallback(LLVFS *vfs,
floater->finishItem(item->getUUID(), "Done"); floater->finishItem(item->getUUID(), "Done");
} }
// </edit> // </edit>

View File

@@ -1,135 +1,135 @@
// <edit> // <edit>
#ifndef LL_LLINVENTORYBACKUP_H #ifndef LL_LLINVENTORYBACKUP_H
#define LL_LLINVENTORYBACKUP_H #define LL_LLINVENTORYBACKUP_H
#if LL_WINDOWS #if LL_WINDOWS
#define OS_SEP "\\" #define OS_SEP "\\"
#else #else
#define OS_SEP "/" #define OS_SEP "/"
#endif #endif
#include "llviewerinventory.h" #include "llviewerinventory.h"
#include "llfolderview.h" #include "llfolderview.h"
#include "llfilepicker.h" #include "llfilepicker.h"
#include "llviewerimage.h" #include "llviewerimage.h"
#include "llfloater.h" #include "llfloater.h"
class LLInventoryBackupOrder class LLInventoryBackupOrder
{ {
public: public:
LLInventoryBackupOrder(); LLInventoryBackupOrder();
std::string mPath; std::string mPath;
std::vector<LLInventoryCategory*> mCats; std::vector<LLInventoryCategory*> mCats;
std::vector<LLInventoryItem*> mItems; std::vector<LLInventoryItem*> mItems;
bool mDownloadTextures; bool mDownloadTextures;
bool mDownloadSounds; bool mDownloadSounds;
bool mDownloadCallingCards; bool mDownloadCallingCards;
bool mDownloadLandmarks; bool mDownloadLandmarks;
bool mDownloadScripts; bool mDownloadScripts;
bool mDownloadWearables; bool mDownloadWearables;
bool mDownloadObjects; bool mDownloadObjects;
bool mDownloadNotecards; bool mDownloadNotecards;
bool mDownloadAnimations; bool mDownloadAnimations;
bool mDownloadGestures; bool mDownloadGestures;
//bool mDownloadOthers; //bool mDownloadOthers;
}; };
class LLFloaterInventoryBackupSettings class LLFloaterInventoryBackupSettings
: public LLFloater : public LLFloater
{ {
public: public:
LLFloaterInventoryBackupSettings(LLInventoryBackupOrder* order); LLFloaterInventoryBackupSettings(LLInventoryBackupOrder* order);
BOOL postBuild(void); BOOL postBuild(void);
static void onClickNext(void* userdata); static void onClickNext(void* userdata);
LLInventoryBackupOrder* mOrder; LLInventoryBackupOrder* mOrder;
virtual ~LLFloaterInventoryBackupSettings(); virtual ~LLFloaterInventoryBackupSettings();
}; };
class LLFloaterInventoryBackup class LLFloaterInventoryBackup
: public LLFloater : public LLFloater
{ {
public: public:
LLFloaterInventoryBackup(std::string path, std::vector<LLInventoryCategory*> cats, std::vector<LLInventoryItem*> items); LLFloaterInventoryBackup(std::string path, std::vector<LLInventoryCategory*> cats, std::vector<LLInventoryItem*> items);
BOOL postBuild(void); BOOL postBuild(void);
std::string mPath; std::string mPath;
std::vector<LLInventoryCategory*> mCats; std::vector<LLInventoryCategory*> mCats;
std::vector<LLInventoryItem*> mItems; std::vector<LLInventoryItem*> mItems;
std::vector<LLInventoryItem*>::iterator mItemIter; std::vector<LLInventoryItem*>::iterator mItemIter;
int mBusy; int mBusy;
static std::list<LLFloaterInventoryBackup*> sInstances; static std::list<LLFloaterInventoryBackup*> sInstances;
private: private:
virtual ~LLFloaterInventoryBackup(); virtual ~LLFloaterInventoryBackup();
void setStatus(LLUUID itemid, std::string status); void setStatus(LLUUID itemid, std::string status);
void finishItem(LLUUID itemid, std::string status); void finishItem(LLUUID itemid, std::string status);
void advance(); void advance();
static void imageCallback(BOOL success, static void imageCallback(BOOL success,
LLViewerImage *src_vi, LLViewerImage *src_vi,
LLImageRaw* src, LLImageRaw* src,
LLImageRaw* aux_src, LLImageRaw* aux_src,
S32 discard_level, S32 discard_level,
BOOL final, BOOL final,
void* userdata); void* userdata);
static void assetCallback(LLVFS *vfs, static void assetCallback(LLVFS *vfs,
const LLUUID& asset_uuid, const LLUUID& asset_uuid,
LLAssetType::EType type, LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status); void* user_data, S32 status, LLExtStat ext_status);
int mItemsTotal; int mItemsTotal;
int mItemsCompleted; int mItemsCompleted;
enum LIST_COLUMN_ORDER enum LIST_COLUMN_ORDER
{ {
LIST_TYPE, LIST_TYPE,
LIST_NAME, LIST_NAME,
LIST_STATUS LIST_STATUS
}; };
}; };
class LLInventoryBackup class LLInventoryBackup
{ {
public: public:
static LLFilePicker::ESaveFilter getSaveFilter(LLInventoryItem* item); static LLFilePicker::ESaveFilter getSaveFilter(LLInventoryItem* item);
static std::string getExtension(LLInventoryItem* item); static std::string getExtension(LLInventoryItem* item);
static std::string getUniqueFilename(std::string filename, std::string extension); static std::string getUniqueFilename(std::string filename, std::string extension);
static std::string getUniqueDirname(std::string dirname); static std::string getUniqueDirname(std::string dirname);
static bool itemIsFolder(LLInventoryItem* item); static bool itemIsFolder(LLInventoryItem* item);
static void save(LLFolderView* folder); static void save(LLFolderView* folder);
static void download(LLInventoryItem* item, LLFloater* floater, loaded_callback_func onImage, LLGetAssetCallback onAsset); static void download(LLInventoryItem* item, LLFloater* floater, loaded_callback_func onImage, LLGetAssetCallback onAsset);
static std::string getPath(LLInventoryCategory* cat, std::vector<LLInventoryCategory*> cats); static std::string getPath(LLInventoryCategory* cat, std::vector<LLInventoryCategory*> cats);
struct callbackdata struct callbackdata
{ {
LLFloater* floater; LLFloater* floater;
LLInventoryItem* item; LLInventoryItem* item;
}; };
private: private:
static void imageCallback(BOOL success, static void imageCallback(BOOL success,
LLViewerImage *src_vi, LLViewerImage *src_vi,
LLImageRaw* src, LLImageRaw* src,
LLImageRaw* aux_src, LLImageRaw* aux_src,
S32 discard_level, S32 discard_level,
BOOL final, BOOL final,
void* userdata); void* userdata);
static void assetCallback(LLVFS *vfs, static void assetCallback(LLVFS *vfs,
const LLUUID& asset_uuid, const LLUUID& asset_uuid,
LLAssetType::EType type, LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status); void* user_data, S32 status, LLExtStat ext_status);
static void climb(LLInventoryCategory* cat, static void climb(LLInventoryCategory* cat,
std::vector<LLInventoryCategory*>& cats, std::vector<LLInventoryCategory*>& cats,
std::vector<LLInventoryItem*>& items); std::vector<LLInventoryItem*>& items);
}; };
#endif #endif
// </edit> // </edit>

View File

@@ -569,14 +569,14 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, std::vector<std::str
//items.push_back(std::string("Magic Get")); //items.push_back(std::string("Magic Get"));
//items.push_back(std::string("Rez")); //items.push_back(std::string("Rez"));
items.push_back(std::string("Open With...")); items.push_back(std::string("Open With..."));
// for now, disable reupload // for now, disable reupload
//if(getInventoryType() == LLInventoryType::IT_ANIMATION) //if(getInventoryType() == LLInventoryType::IT_ANIMATION)
//{ //{
// items.push_back(std::string("Reupload...")); // items.push_back(std::string("Reupload..."));
//} //}
items.push_back(std::string("Save As...")); items.push_back(std::string("Save As..."));
items.push_back(std::string("Save InvCache...")); items.push_back(std::string("Save InvCache..."));
// </edit> // </edit>
items.push_back(std::string("Copy Separator")); items.push_back(std::string("Copy Separator"));
@@ -955,98 +955,98 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model,
return; return;
} }
// <edit> // <edit>
else if("open hex" == action) else if("open hex" == action)
{ {
LLInventoryItem* item = model->getItem(mUUID); LLInventoryItem* item = model->getItem(mUUID);
if(!item) return; if(!item) return;
DOFloaterHex::show(mUUID); DOFloaterHex::show(mUUID);
} }
else if("open text" == action) else if("open text" == action)
{ {
LLInventoryItem* item = model->getItem(mUUID); LLInventoryItem* item = model->getItem(mUUID);
if(!item) return; if(!item) return;
HGFloaterTextEditor::show(mUUID); HGFloaterTextEditor::show(mUUID);
} }
else if ("rez" == action) else if ("rez" == action)
{ {
LLInventoryItem* item = model->getItem(mUUID); LLInventoryItem* item = model->getItem(mUUID);
if(!item) return; if(!item) return;
LLViewerRegion* regionp = gAgent.getRegion(); LLViewerRegion* regionp = gAgent.getRegion();
if (!regionp) if (!regionp)
{ {
llwarns << "Couldn't find region to rez object" << llendl; llwarns << "Couldn't find region to rez object" << llendl;
return; return;
} }
//llinfos << "Rezzing object" << llendl; //llinfos << "Rezzing object" << llendl;
make_ui_sound("UISndObjectRezIn"); make_ui_sound("UISndObjectRezIn");
if (regionp if (regionp
&& (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX)) && (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
{ {
LLFirstUse::useSandbox(); LLFirstUse::useSandbox();
} }
BOOL remove_from_inventory = !item->getPermissions().allowCopyBy(gAgent.getID()); BOOL remove_from_inventory = !item->getPermissions().allowCopyBy(gAgent.getID());
LLVector3 rezpos = gAgent.getPositionAgent() + (gAgent.getAtAxis() * 5.0f); LLVector3 rezpos = gAgent.getPositionAgent() + (gAgent.getAtAxis() * 5.0f);
LLMessageSystem* msg = gMessageSystem; LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RezObject); msg->newMessageFast(_PREHASH_RezObject);
msg->nextBlockFast(_PREHASH_AgentData); msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID()); msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
msg->nextBlock("RezData"); msg->nextBlock("RezData");
// if it's being rezzed from task inventory, we need to enable // if it's being rezzed from task inventory, we need to enable
// saving it back into the task inventory. // saving it back into the task inventory.
// *FIX: We can probably compress this to a single byte, since I // *FIX: We can probably compress this to a single byte, since I
// think folderid == mSourceID. This will be a later // think folderid == mSourceID. This will be a later
// optimization. // optimization.
msg->addUUIDFast(_PREHASH_FromTaskID, LLUUID::null); msg->addUUIDFast(_PREHASH_FromTaskID, LLUUID::null);
msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE); msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE);
msg->addVector3Fast(_PREHASH_RayStart, rezpos); msg->addVector3Fast(_PREHASH_RayStart, rezpos);
msg->addVector3Fast(_PREHASH_RayEnd, rezpos); msg->addVector3Fast(_PREHASH_RayEnd, rezpos);
msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null); msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE); msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE);
msg->addBOOLFast(_PREHASH_RezSelected, true); msg->addBOOLFast(_PREHASH_RezSelected, true);
msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory); msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory);
// deal with permissions slam logic // deal with permissions slam logic
pack_permissions_slam(msg, item->getFlags(), item->getPermissions()); pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
LLUUID folder_id = item->getParentUUID(); LLUUID folder_id = item->getParentUUID();
msg->nextBlockFast(_PREHASH_InventoryData); msg->nextBlockFast(_PREHASH_InventoryData);
item->packMessage(msg); item->packMessage(msg);
msg->sendReliable(regionp->getHost()); msg->sendReliable(regionp->getHost());
} }
else if("reupload" == action) else if("reupload" == action)
{ {
LLInventoryItem* item = model->getItem(mUUID); LLInventoryItem* item = model->getItem(mUUID);
if(!item) return; if(!item) return;
LLFilePicker& picker = LLFilePicker::instance(); LLFilePicker& picker = LLFilePicker::instance();
std::string filename; std::string filename;
switch(item->getType()) switch(item->getType())
{ {
case LLAssetType::AT_TEXTURE: case LLAssetType::AT_TEXTURE:
if(!picker.getOpenFile(LLFilePicker::FFLOAD_IMAGE)) if(!picker.getOpenFile(LLFilePicker::FFLOAD_IMAGE))
return; return;
filename = picker.getFirstFile(); filename = picker.getFirstFile();
if(!filename.empty()) if(!filename.empty())
{ {
LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filename, item); LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filename, item);
LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml"); LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml");
} }
break; break;
default: default:
break; break;
} }
} }
// </edit> // </edit>
} }

View File

@@ -59,12 +59,12 @@
#include "message.h" #include "message.h"
#include "raytrace.h" #include "raytrace.h"
#include "llsdserialize.h" #include "llsdserialize.h"
// <edit> // <edit>
#include "lllocalinventory.h" #include "lllocalinventory.h"
#include "llfloaterimport.h" #include "llfloaterimport.h"
#include "llfloaterexport.h" #include "llfloaterexport.h"
#include "llfloaterexploreanimations.h" #include "llfloaterexploreanimations.h"
// </edit> // </edit>
#include "lltimer.h" #include "lltimer.h"
#include "llvfile.h" #include "llvfile.h"
#include "llvolumemgr.h" #include "llvolumemgr.h"
@@ -228,11 +228,11 @@
#include "lltexlayer.h" #include "lltexlayer.h"
// <edit> // <edit>
#include "dofloaterhex.h" #include "dofloaterhex.h"
#include "hgfloatertexteditor.h" #include "hgfloatertexteditor.h"
#include "llfloatermessagelog.h" #include "llfloatermessagelog.h"
#include "llfloatermessagebuilder.h" #include "llfloatermessagebuilder.h"
// </edit> // </edit>
using namespace LLVOAvatarDefines; using namespace LLVOAvatarDefines;
@@ -394,12 +394,12 @@ void handle_god_mode(void*);
// God menu // God menu
void handle_leave_god_mode(void*); void handle_leave_god_mode(void*);
// <edit> // <edit>
void handle_close_all_notifications(void*); void handle_close_all_notifications(void*);
void handle_reopen_with_hex_editor(void*); void handle_reopen_with_hex_editor(void*);
void handle_open_message_log(void*); void handle_open_message_log(void*);
void handle_open_message_builder(void*); void handle_open_message_builder(void*);
// </edit> // </edit>
BOOL is_inventory_visible( void* user_data ); BOOL is_inventory_visible( void* user_data );
void handle_reset_view(); void handle_reset_view();
@@ -862,9 +862,9 @@ void init_client_menu(LLMenuGL* menu)
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
// <edit> // <edit>
//if (!LLViewerLogin::getInstance()->isInProductionGrid()) //if (!LLViewerLogin::getInstance()->isInProductionGrid())
// </edit> // </edit>
{ {
menu->append(new LLMenuItemCheckGL("Hacked Godmode", menu->append(new LLMenuItemCheckGL("Hacked Godmode",
&handle_toggle_hacked_godmode, &handle_toggle_hacked_godmode,
@@ -1034,12 +1034,12 @@ void init_client_menu(LLMenuGL* menu)
menu->append(new LLMenuItemCallGL("Leave Admin Status", menu->append(new LLMenuItemCallGL("Leave Admin Status",
&handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL)); &handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL));
// <edit> // <edit>
menu->appendSeparator(); menu->appendSeparator();
menu->append(new LLMenuItemCallGL( "Close All Dialogs", menu->append(new LLMenuItemCallGL( "Close All Dialogs",
&handle_close_all_notifications, NULL, NULL, 'D', MASK_CONTROL | MASK_ALT | MASK_SHIFT)); &handle_close_all_notifications, NULL, NULL, 'D', MASK_CONTROL | MASK_ALT | MASK_SHIFT));
menu->append(new LLMenuItemCallGL( "Reopen with Hex Editor", menu->append(new LLMenuItemCallGL( "Reopen with Hex Editor",
&handle_reopen_with_hex_editor, NULL)); &handle_reopen_with_hex_editor, NULL));
menu->append(new LLMenuItemCallGL( "Message Log", &handle_open_message_log, NULL)); menu->append(new LLMenuItemCallGL( "Message Log", &handle_open_message_log, NULL));
@@ -1149,10 +1149,10 @@ void init_debug_xui_menu(LLMenuGL* menu)
menu->append(new LLMenuItemCallGL("Export Menus to XML...", handle_export_menus_to_xml)); menu->append(new LLMenuItemCallGL("Export Menus to XML...", handle_export_menus_to_xml));
menu->append(new LLMenuItemCallGL("Edit UI...", LLFloaterEditUI::show)); menu->append(new LLMenuItemCallGL("Edit UI...", LLFloaterEditUI::show));
menu->append(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml)); menu->append(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml));
// <edit> // <edit>
//menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml)); //menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml));
menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml, NULL, NULL, 'X', MASK_CONTROL | MASK_ALT | MASK_SHIFT)); menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml, NULL, NULL, 'X', MASK_CONTROL | MASK_ALT | MASK_SHIFT));
// </edit> // </edit>
menu->append(new LLMenuItemCheckGL("Show XUI Names", toggle_show_xui_names, NULL, check_show_xui_names, NULL)); menu->append(new LLMenuItemCheckGL("Show XUI Names", toggle_show_xui_names, NULL, check_show_xui_names, NULL));
//menu->append(new LLMenuItemCallGL("Buy Currency...", handle_buy_currency)); //menu->append(new LLMenuItemCallGL("Buy Currency...", handle_buy_currency));
@@ -1462,14 +1462,14 @@ void init_debug_avatar_menu(LLMenuGL* menu)
menu->append(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation)); menu->append(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation));
menu->append(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments)); menu->append(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments));
menu->append(new LLMenuItemCallGL("Rebake Textures", handle_rebake_textures, NULL, NULL, 'R', MASK_ALT | MASK_CONTROL )); menu->append(new LLMenuItemCallGL("Rebake Textures", handle_rebake_textures, NULL, NULL, 'R', MASK_ALT | MASK_CONTROL ));
// <edit> // <edit>
//#ifndef LL_RELEASE_FOR_DOWNLOAD //#ifndef LL_RELEASE_FOR_DOWNLOAD
// </edit> // </edit>
menu->append(new LLMenuItemCallGL("Debug Avatar Textures", handle_debug_avatar_textures, NULL, NULL, 'A', MASK_SHIFT|MASK_CONTROL|MASK_ALT)); menu->append(new LLMenuItemCallGL("Debug Avatar Textures", handle_debug_avatar_textures, NULL, NULL, 'A', MASK_SHIFT|MASK_CONTROL|MASK_ALT));
menu->append(new LLMenuItemCallGL("Dump Local Textures", handle_dump_avatar_local_textures, NULL, NULL, 'M', MASK_SHIFT|MASK_ALT )); menu->append(new LLMenuItemCallGL("Dump Local Textures", handle_dump_avatar_local_textures, NULL, NULL, 'M', MASK_SHIFT|MASK_ALT ));
// <edit> // <edit>
//#endif //#endif
// </edit> // </edit>
menu->createJumpKeys(); menu->createJumpKeys();
} }
@@ -2194,125 +2194,125 @@ class LLObjectMute : public view_listener_t
} }
}; };
// <edit> // <edit>
class LLObjectEnableCopyUUID : public view_listener_t class LLObjectEnableCopyUUID : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
bool new_value = (object != NULL); bool new_value = (object != NULL);
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true; return true;
} }
}; };
class LLObjectCopyUUID : public view_listener_t class LLObjectCopyUUID : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
if(object) if(object)
{ {
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(object->getID().asString())); gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(object->getID().asString()));
} }
return true; return true;
} }
}; };
class LLObjectEnableSaveAs : public view_listener_t class LLObjectEnableSaveAs : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
bool new_value = (object != NULL); bool new_value = (object != NULL);
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true; return true;
} }
}; };
class LLObjectSaveAs : public view_listener_t class LLObjectSaveAs : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLFloaterExport* floater = new LLFloaterExport(); LLFloaterExport* floater = new LLFloaterExport();
floater->center(); floater->center();
return true; return true;
} }
}; };
class LLObjectEnableImport : public view_listener_t class LLObjectEnableImport : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
bool new_value = (object != NULL); bool new_value = (object != NULL);
if(object) if(object)
{ {
if(!object->permCopy()) if(!object->permCopy())
new_value = false; new_value = false;
else if(!object->permModify()) else if(!object->permModify())
new_value = false; new_value = false;
else if(!object->permMove()) else if(!object->permMove())
new_value = false; new_value = false;
else if(object->numChildren() != 0) else if(object->numChildren() != 0)
new_value = false; new_value = false;
else if(object->getParent()) else if(object->getParent())
new_value = false; new_value = false;
} }
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true; return true;
} }
}; };
class LLObjectImport : public view_listener_t class LLObjectImport : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
bool new_value = (object != NULL); bool new_value = (object != NULL);
if(object) if(object)
{ {
if(!object->permCopy()) if(!object->permCopy())
new_value = false; new_value = false;
else if(!object->permModify()) else if(!object->permModify())
new_value = false; new_value = false;
else if(!object->permMove()) else if(!object->permMove())
new_value = false; new_value = false;
else if(object->numChildren() != 0) else if(object->numChildren() != 0)
new_value = false; new_value = false;
else if(object->getParent()) else if(object->getParent())
new_value = false; new_value = false;
} }
if(new_value == false) return true; if(new_value == false) return true;
LLFilePicker& picker = LLFilePicker::instance(); LLFilePicker& picker = LLFilePicker::instance();
if (!picker.getOpenFile(LLFilePicker::FFLOAD_XML)) if (!picker.getOpenFile(LLFilePicker::FFLOAD_XML))
{ {
return true; return true;
} }
std::string file_name = picker.getFirstFile(); std::string file_name = picker.getFirstFile();
LLXmlImportOptions* options = new LLXmlImportOptions(file_name); LLXmlImportOptions* options = new LLXmlImportOptions(file_name);
options->mSupplier = object; options->mSupplier = object;
new LLFloaterXmlImportOptions(options); new LLFloaterXmlImportOptions(options);
return true; return true;
} }
}; };
class LLAvatarAnims : public view_listener_t class LLAvatarAnims : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
if(avatar) if(avatar)
{ {
new LLFloaterExploreAnimations(avatar->getID()); //temporary new LLFloaterExploreAnimations(avatar->getID()); //temporary
} }
return true; return true;
} }
}; };
// </edit> // </edit>
bool handle_go_to() bool handle_go_to()
{ {
LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal; LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal;
@@ -3191,10 +3191,10 @@ bool handle_sit_or_stand()
{ {
LLPickInfo pick = LLToolPie::getInstance()->getPick(); LLPickInfo pick = LLToolPie::getInstance()->getPick();
LLViewerObject *object = pick.getObject();; LLViewerObject *object = pick.getObject();;
// <edit> // <edit>
//if (!object || pick.mPickType == LLPickInfo::PICK_FLORA) //if (!object || pick.mPickType == LLPickInfo::PICK_FLORA)
if (!object) if (!object)
// </edit> // </edit>
{ {
return true; return true;
} }
@@ -3799,12 +3799,12 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
break; break;
default: default:
// <edit> // <edit>
//if((node->mPermissions->allowTransferTo(gAgent.getID()) //if((node->mPermissions->allowTransferTo(gAgent.getID())
// && object->permCopy()) // && object->permCopy())
// || gAgent.isGodlike()) // || gAgent.isGodlike())
if(1) if(1)
// </edit> // </edit>
{ {
can_derez_current = TRUE; can_derez_current = TRUE;
} }
@@ -3861,17 +3861,17 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
LLViewerObject* object = derez_objects.get(object_index++); LLViewerObject* object = derez_objects.get(object_index++);
msg->nextBlockFast(_PREHASH_ObjectData); msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
// <edit> // <edit>
if(!gSavedSettings.getBOOL("DisablePointAtAndBeam")) if(!gSavedSettings.getBOOL("DisablePointAtAndBeam"))
{ {
// </edit> // </edit>
// VEFFECT: DerezObject // VEFFECT: DerezObject
LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
effectp->setPositionGlobal(object->getPositionGlobal()); effectp->setPositionGlobal(object->getPositionGlobal());
effectp->setColor(LLColor4U(gAgent.getEffectColor())); effectp->setColor(LLColor4U(gAgent.getEffectColor()));
// <edit> // <edit>
} }
// </edit> // </edit>
} }
msg->sendReliable(first_region->getHost()); msg->sendReliable(first_region->getHost());
} }
@@ -4359,20 +4359,20 @@ BOOL sitting_on_selection()
return (avatar->mIsSitting && avatar->getRoot() == root_object); return (avatar->mIsSitting && avatar->getRoot() == root_object);
} }
class LLToolsSaveToInventory : public view_listener_t class LLToolsSaveToInventory : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
// <edit> // <edit>
//if(enable_save_into_inventory(NULL)) //if(enable_save_into_inventory(NULL))
if(1) if(1)
// </edit> // </edit>
{ {
derez_objects(DRD_SAVE_INTO_AGENT_INVENTORY, LLUUID::null); derez_objects(DRD_SAVE_INTO_AGENT_INVENTORY, LLUUID::null);
} }
return true; return true;
} }
}; };
class LLToolsSaveToObjectInventory : public view_listener_t class LLToolsSaveToObjectInventory : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -6368,10 +6368,10 @@ class LLObjectEnableWear : public view_listener_t
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
bool is_wearable = object_selected_and_point_valid(NULL); bool is_wearable = object_selected_and_point_valid(NULL);
// <edit> Don't allow attaching objects while importing attachments // <edit> Don't allow attaching objects while importing attachments
if(LLXmlImport::sImportInProgress && LLXmlImport::sImportHasAttachments) if(LLXmlImport::sImportInProgress && LLXmlImport::sImportHasAttachments)
is_wearable = false; is_wearable = false;
// </edit> // </edit>
gMenuHolder->findControl(userdata["control"].asString())->setValue(is_wearable); gMenuHolder->findControl(userdata["control"].asString())->setValue(is_wearable);
return TRUE; return TRUE;
} }
@@ -6542,10 +6542,10 @@ class LLToolsSelectedScriptAction : public view_listener_t
void handle_selected_texture_info(void*) void handle_selected_texture_info(void*)
{ {
// <edit> // <edit>
std::map<LLUUID, bool> unique_textures; std::map<LLUUID, bool> unique_textures;
S32 total_memory = 0; S32 total_memory = 0;
// </edit> // </edit>
for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin(); for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++) iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
{ {
@@ -6568,33 +6568,33 @@ void handle_selected_texture_info(void*)
LLViewerImage* img = node->getObject()->getTEImage(i); LLViewerImage* img = node->getObject()->getTEImage(i);
LLUUID image_id = img->getID(); LLUUID image_id = img->getID();
faces_per_texture[image_id].push_back(i); faces_per_texture[image_id].push_back(i);
// <edit> // <edit>
if(!unique_textures[image_id]) if(!unique_textures[image_id])
{ {
unique_textures[image_id] = true; unique_textures[image_id] = true;
total_memory += (img->getWidth() * img->getHeight() * img->getComponents()); total_memory += (img->getWidth() * img->getHeight() * img->getComponents());
} }
// </edit> // </edit>
} }
// Per-texture, dump which faces are using it. // Per-texture, dump which faces are using it.
map_t::iterator it; map_t::iterator it;
for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it) for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it)
{ {
LLUUID image_id = it->first; LLUUID image_id = it->first;
// <edit> // <edit>
std::string uuid_str; std::string uuid_str;
image_id.toString(uuid_str); image_id.toString(uuid_str);
// </edit> // </edit>
U8 te = it->second[0]; U8 te = it->second[0];
LLViewerImage* img = node->getObject()->getTEImage(te); LLViewerImage* img = node->getObject()->getTEImage(te);
S32 height = img->getHeight(); S32 height = img->getHeight();
S32 width = img->getWidth(); S32 width = img->getWidth();
S32 components = img->getComponents(); S32 components = img->getComponents();
// <edit> // <edit>
//msg = llformat("%dx%d %s on face ", //msg = llformat("%dx%d %s on face ",
msg = llformat("%s, %dx%d %s on face ", msg = llformat("%s, %dx%d %s on face ",
uuid_str.c_str(), uuid_str.c_str(),
// </edit> // </edit>
width, width,
height, height,
(components == 4 ? "alpha" : "opaque")); (components == 4 ? "alpha" : "opaque"));
@@ -6605,41 +6605,41 @@ void handle_selected_texture_info(void*)
LLChat chat(msg); LLChat chat(msg);
LLFloaterChat::addChat(chat); LLFloaterChat::addChat(chat);
} }
// <edit> // <edit>
if(node->getObject()->isSculpted()) if(node->getObject()->isSculpted())
{ {
LLSculptParams *sculpt_params = (LLSculptParams *)(node->getObject()->getParameterEntry(LLNetworkData::PARAMS_SCULPT)); LLSculptParams *sculpt_params = (LLSculptParams *)(node->getObject()->getParameterEntry(LLNetworkData::PARAMS_SCULPT));
LLUUID sculpt_id = sculpt_params->getSculptTexture(); LLUUID sculpt_id = sculpt_params->getSculptTexture();
std::string uuid_str; std::string uuid_str;
sculpt_id.toString(uuid_str); sculpt_id.toString(uuid_str);
msg.assign("Sculpt texture: "); msg.assign("Sculpt texture: ");
msg.append(uuid_str.c_str()); msg.append(uuid_str.c_str());
LLChat chat(msg); LLChat chat(msg);
LLFloaterChat::addChat(chat); LLFloaterChat::addChat(chat);
unique_textures[sculpt_id] = true; unique_textures[sculpt_id] = true;
} }
if(node->getObject()->isParticleSource()) if(node->getObject()->isParticleSource())
{ {
//LLUUID particle_id = node->getObject()->mPartSourcep->getImage()->getID(); //LLUUID particle_id = node->getObject()->mPartSourcep->getImage()->getID();
} }
// </edit> // </edit>
} }
// <edit> // <edit>
typedef std::map<LLUUID, bool>::iterator map_iter; typedef std::map<LLUUID, bool>::iterator map_iter;
for(map_iter i = unique_textures.begin(); i != unique_textures.end(); ++i) for(map_iter i = unique_textures.begin(); i != unique_textures.end(); ++i)
{ {
LLUUID asset_id = (*i).first; LLUUID asset_id = (*i).first;
LLLocalInventory::addItem(asset_id.asString(), (int)LLAssetType::AT_TEXTURE, asset_id, true); LLLocalInventory::addItem(asset_id.asString(), (int)LLAssetType::AT_TEXTURE, asset_id, true);
} }
// Show total widthxheight // Show total widthxheight
F32 memoriez = (F32)total_memory; F32 memoriez = (F32)total_memory;
memoriez = memoriez / 1000000; memoriez = memoriez / 1000000;
std::string msg = llformat("Total uncompressed: %f MB", memoriez); std::string msg = llformat("Total uncompressed: %f MB", memoriez);
LLChat chat(msg); LLChat chat(msg);
LLFloaterChat::addChat(chat); LLFloaterChat::addChat(chat);
// </edit> // </edit>
} }
void handle_dump_image_list(void*) void handle_dump_image_list(void*)
@@ -6872,25 +6872,25 @@ class LLToolsEnableTakeCopy : public view_listener_t
} }
}; };
// <edit> // <edit>
class LLToolsEnableAdminDelete : public view_listener_t class LLToolsEnableAdminDelete : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
return (object != NULL); return (object != NULL);
} }
}; };
class LLToolsAdminDelete : public view_listener_t class LLToolsAdminDelete : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLSelectMgr::getInstance()->selectForceDelete(); LLSelectMgr::getInstance()->selectForceDelete();
return true; return true;
} }
}; };
// </edit> // </edit>
BOOL enable_selection_you_own_all(void*) BOOL enable_selection_you_own_all(void*)
{ {
if (LLSelectMgr::getInstance()) if (LLSelectMgr::getInstance())
@@ -8132,11 +8132,11 @@ void initialize_menus()
addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection"); addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection");
addMenu(new LLToolsBuyOrTake(), "Tools.BuyOrTake"); addMenu(new LLToolsBuyOrTake(), "Tools.BuyOrTake");
addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy"); addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy");
addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy"); addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy");
// <edit> // <edit>
addMenu(new LLToolsEnableAdminDelete(), "Tools.EnableAdminDelete"); addMenu(new LLToolsEnableAdminDelete(), "Tools.EnableAdminDelete");
addMenu(new LLToolsAdminDelete(), "Tools.AdminDelete"); addMenu(new LLToolsAdminDelete(), "Tools.AdminDelete");
// </edit> // </edit>
addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory"); addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory");
addMenu(new LLToolsSelectedScriptAction(), "Tools.SelectedScriptAction"); addMenu(new LLToolsSelectedScriptAction(), "Tools.SelectedScriptAction");
@@ -8187,11 +8187,11 @@ void initialize_menus()
addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar"); addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar");
addMenu(new LLObjectReturn(), "Object.Return"); addMenu(new LLObjectReturn(), "Object.Return");
addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse"); addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse"); addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
// <edit> // <edit>
addMenu(new LLObjectSaveAs(), "Object.SaveAs"); addMenu(new LLObjectSaveAs(), "Object.SaveAs");
addMenu(new LLObjectImport(), "Object.Import"); addMenu(new LLObjectImport(), "Object.Import");
// </edit> // </edit>
addMenu(new LLObjectMute(), "Object.Mute"); addMenu(new LLObjectMute(), "Object.Mute");
addMenu(new LLObjectBuy(), "Object.Buy"); addMenu(new LLObjectBuy(), "Object.Buy");
addMenu(new LLObjectEdit(), "Object.Edit"); addMenu(new LLObjectEdit(), "Object.Edit");
@@ -8204,10 +8204,10 @@ void initialize_menus()
addMenu(new LLObjectEnableWear(), "Object.EnableWear"); addMenu(new LLObjectEnableWear(), "Object.EnableWear");
addMenu(new LLObjectEnableReturn(), "Object.EnableReturn"); addMenu(new LLObjectEnableReturn(), "Object.EnableReturn");
addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse"); addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse");
// <edit> // <edit>
addMenu(new LLObjectEnableSaveAs(), "Object.EnableSaveAs"); addMenu(new LLObjectEnableSaveAs(), "Object.EnableSaveAs");
addMenu(new LLObjectEnableImport(), "Object.EnableImport"); addMenu(new LLObjectEnableImport(), "Object.EnableImport");
// </edit> // </edit>
addMenu(new LLObjectEnableMute(), "Object.EnableMute"); addMenu(new LLObjectEnableMute(), "Object.EnableMute");
addMenu(new LLObjectEnableBuy(), "Object.EnableBuy"); addMenu(new LLObjectEnableBuy(), "Object.EnableBuy");

View File

@@ -2,7 +2,12 @@
<floater can_close="true" can_drag_on_left="false" can_minimize="true" <floater can_close="true" can_drag_on_left="false" can_minimize="true"
can_resize="true" height="200" width="580" min_width="580" min_height="128" can_resize="true" height="200" width="580" min_width="580" min_height="128"
name="floater_hex" title="Hex Editor" rect_control="FloaterHexRect"> name="floater_hex" title="Hex Editor" rect_control="FloaterHexRect">
<text name="status_text" follows="left|top" left="10" top="-25" height="20">Loading...</text> <text name="status_text" follows="left|top" left="120" top="-25" height="20">Loading...</text>
<slider can_edit_text="false" top="-25" control_name="column_count"
decimal_digits="3" follows="left|top" height="16" increment="1"
initial_val="16" label="Columns" left="10" max_val="48" min_val="8"
mouse_opaque="true" name="column_count" show_text="false" value="16"
width="100" />
<button name="upload_btn" follows="right|top" top="-25" right="-120" width="100" bottom="155" label="[UPLOAD]" enabled="false"/> <button name="upload_btn" follows="right|top" top="-25" right="-120" width="100" bottom="155" label="[UPLOAD]" enabled="false"/>
<button name="save_btn" follows="right|top" top="-25" right="-10" width="100" bottom="155" label="Save" enabled="false"/> <button name="save_btn" follows="right|top" top="-25" right="-10" width="100" bottom="155" label="Save" enabled="false"/>
<hex_editor name="hex" follows="left|top|right|bottom" left="10" top="-50" right="-10" bottom="10" visible="false"/> <hex_editor name="hex" follows="left|top|right|bottom" left="10" top="-50" right="-10" bottom="10" visible="false"/>

View File

@@ -146,10 +146,10 @@
<on_click filter="" function="Inventory.DoCreate" userdata="eyes" /> <on_click filter="" function="Inventory.DoCreate" userdata="eyes" />
</menu_item_call> </menu_item_call>
</menu> </menu>
<menu_item_call bottom_delta="-18" height="18" label="New Pretend Item" left="0" mouse_opaque="true" <menu_item_call bottom_delta="-18" height="18" label="New Pretend Item" left="0" mouse_opaque="true"
name="New Pretend Item" width="118"> name="New Pretend Item" width="118">
<on_click filter="" function="Inventory.DoCreate" userdata="pretend" /> <on_click filter="" function="Inventory.DoCreate" userdata="pretend" />
</menu_item_call> </menu_item_call>
</menu> </menu>
<menu bottom_delta="64" drop_shadow="true" height="49" <menu bottom_delta="64" drop_shadow="true" height="49"
label="Sort" left="0" mouse_opaque="false" name="Sort" opaque="true" label="Sort" left="0" mouse_opaque="false" name="Sort" opaque="true"

View File

@@ -45,7 +45,7 @@
<name_editor bevel_style="in" border_style="line" <name_editor bevel_style="in" border_style="line"
border_thickness="1" bottom="-24" enabled="false" follows="left|top" border_thickness="1" bottom="-24" enabled="false" follows="left|top"
font="SansSerifSmall" height="16" is_unicode="false" left_delta="75" font="SansSerifSmall" height="16" is_unicode="false" left_delta="75"
max_length="254" mouse_opaque="false" name="avatar_key" max_length="254" mouse_opaque="false" name="key_"
width="256" /> width="256" />
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-48" drop_shadow_visible="true" follows="left|top" bottom="-48" drop_shadow_visible="true" follows="left|top"
@@ -110,6 +110,14 @@
width="121"> width="121">
[FIRST] [LAST] [FIRST] [LAST]
</line_editor> </line_editor>
<button bottom_delta="0" follows="left|top" font="SansSerif" halign="center"
height="23" label="" left="40" bottom="-42" width="24"
image_selected="icon_avatar_expand.png"
image_unselected="icon_avatar_expand.png"
image_hover_selected="icon_avatar_expand.png"
image_hover_unselected="icon_avatar_expand.png"
mouse_opaque="true"
name="bigimg"/>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-68" drop_shadow_visible="true" follows="left|top" bottom="-68" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="right" height="16" left="4" font="SansSerifSmall" h_pad="0" halign="right" height="16" left="4"
@@ -371,6 +379,14 @@
default_image_name="None" follows="left|top" height="151" label="" default_image_name="None" follows="left|top" height="151" label=""
left="70" mouse_opaque="true" name="img" left="70" mouse_opaque="true" name="img"
tool_tip="Click to choose a picture" width="135" /> tool_tip="Click to choose a picture" width="135" />
<button bottom_delta="0" follows="left|top" font="SansSerif" halign="center"
height="23" label="" left="30" bottom="-42" width="24"
image_selected="icon_avatar_expand.png"
image_unselected="icon_avatar_expand.png"
image_hover_selected="icon_avatar_expand.png"
image_hover_unselected="icon_avatar_expand.png"
mouse_opaque="true"
name="flbigimg"/>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-203" drop_shadow_visible="true" follows="left|top" bottom="-203" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="right" height="16" left="4" font="SansSerifSmall" h_pad="0" halign="right" height="16" left="4"

File diff suppressed because it is too large Load Diff