Hex editor is a cat face
This commit is contained in:
@@ -1,415 +1,431 @@
|
||||
/**
|
||||
* @file dofloaterhex.h
|
||||
* @brief Hex Editor Floater made by Day
|
||||
* @author Day Oh
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
// <edit>
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "dofloaterhex.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llinventorybackup.h" // for downloading
|
||||
#include "llviewercontrol.h" // gSavedSettings
|
||||
#include "llviewerwindow.h" // alertXML
|
||||
#include "llagent.h" // gAgent getID
|
||||
#include "llviewermenufile.h"
|
||||
#include "llviewerregion.h" // getCapability
|
||||
#include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder
|
||||
#include "llinventorymodel.h" // gInventory.updateItem
|
||||
#include "llappviewer.h" // gLocalInventoryRoot
|
||||
#include "llfloaterperms.h" //get default perms
|
||||
|
||||
|
||||
std::list<DOFloaterHex*> DOFloaterHex::sInstances;
|
||||
S32 DOFloaterHex::sUploadAmount = 10;
|
||||
|
||||
DOFloaterHex::DOFloaterHex(LLInventoryItem* item)
|
||||
: LLFloater()
|
||||
{
|
||||
sInstances.push_back(this);
|
||||
mItem = item;
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hex.xml");
|
||||
}
|
||||
|
||||
// static
|
||||
void DOFloaterHex::show(LLUUID item_id)
|
||||
{
|
||||
LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id);
|
||||
if(item)
|
||||
{
|
||||
S32 left, top;
|
||||
gFloaterView->getNewFloaterPosition(&left, &top);
|
||||
LLRect rect = gSavedSettings.getRect("FloaterHexRect");
|
||||
rect.translate(left - rect.mLeft, top - rect.mTop);
|
||||
DOFloaterHex* floaterp = new DOFloaterHex(item);
|
||||
floaterp->setRect(rect);
|
||||
gFloaterView->adjustToFitScreen(floaterp, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
DOFloaterHex::~DOFloaterHex()
|
||||
{
|
||||
sInstances.remove(this);
|
||||
}
|
||||
|
||||
void DOFloaterHex::close(bool app_quitting)
|
||||
{
|
||||
LLFloater::close(app_quitting);
|
||||
}
|
||||
|
||||
BOOL DOFloaterHex::postBuild(void)
|
||||
{
|
||||
DOHexEditor* editor = getChild<DOHexEditor>("hex");
|
||||
mEditor = editor;
|
||||
|
||||
// Set number of columns
|
||||
U8 columns = U8(gSavedSettings.getU32("HexEditorColumns"));
|
||||
editor->setColumns(columns);
|
||||
// Reflect clamped U8ness in settings
|
||||
gSavedSettings.setU32("HexEditorColumns", U32(columns));
|
||||
|
||||
// Reshape a little based on columns
|
||||
S32 min_width = S32(editor->getSuggestedWidth()) + 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);
|
||||
editor->reshape(editor->getRect().getWidth(), editor->getRect().getHeight(), TRUE);
|
||||
}
|
||||
|
||||
childSetEnabled("upload_btn", false);
|
||||
childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload"));
|
||||
childSetAction("upload_btn", onClickUpload, this);
|
||||
childSetEnabled("save_btn", false);
|
||||
childSetAction("save_btn", onClickSave, this);
|
||||
|
||||
if(mItem)
|
||||
{
|
||||
std::string title = "Hex editor: " + mItem->getName();
|
||||
const char* asset_type_name = LLAssetType::lookup(mItem->getType());
|
||||
if(asset_type_name)
|
||||
{
|
||||
title.append(" (" + std::string(asset_type_name) + ")");
|
||||
}
|
||||
setTitle(title);
|
||||
}
|
||||
#if OPENSIM_RULES!=1
|
||||
if(mItem->getCreatorUUID() == gAgentID)
|
||||
{
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
// Load the asset
|
||||
editor->setVisible(FALSE);
|
||||
childSetText("status_text", std::string("Loading..."));
|
||||
LLInventoryBackup::download(mItem, this, imageCallback, assetCallback);
|
||||
#if OPENSIM_RULES!=1
|
||||
} else {
|
||||
this->close(false);
|
||||
}
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// static
|
||||
void DOFloaterHex::imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata)
|
||||
{
|
||||
if(final)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
|
||||
DOFloaterHex* floater = (DOFloaterHex*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
//LLInventoryItem* item = data->item;
|
||||
|
||||
if(!success)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
U8* src_data = src->getData();
|
||||
S32 size = src->getDataSize();
|
||||
std::vector<U8> new_data;
|
||||
for(S32 i = 0; i < size; i++)
|
||||
new_data.push_back(src_data[i]);
|
||||
|
||||
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"));
|
||||
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void DOFloaterHex::assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
|
||||
DOFloaterHex* floater = (DOFloaterHex*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = data->item;
|
||||
|
||||
if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Todo: this doesn't work for static vfs shit
|
||||
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
|
||||
S32 size = file.getSize();
|
||||
|
||||
char* buffer = new char[size];
|
||||
if (buffer == NULL)
|
||||
{
|
||||
llerrs << "Memory Allocation Failed" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
file.read((U8*)buffer, size);
|
||||
|
||||
std::vector<U8> new_data;
|
||||
for(S32 i = 0; i < size; i++)
|
||||
new_data.push_back(buffer[i]);
|
||||
|
||||
delete[] buffer;
|
||||
|
||||
floater->mEditor->setValue(new_data);
|
||||
floater->mEditor->setVisible(TRUE);
|
||||
floater->childSetText("status_text", std::string(""));
|
||||
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
if(item->getPermissions().allowModifyBy(gAgent.getID()))
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
case LLAssetType::AT_LANDMARK:
|
||||
case LLAssetType::AT_CALLINGCARD:
|
||||
floater->childSetEnabled("upload_btn", false);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
break;
|
||||
default:
|
||||
floater->childSetEnabled("save_btn", true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Never enable save if it's a pretend item
|
||||
if(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot))
|
||||
{
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void DOFloaterHex::onClickUpload(void* user_data)
|
||||
{
|
||||
DOFloaterHex* floater = (DOFloaterHex*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
std::vector<U8> value = floater->mEditor->getValue();
|
||||
int size = value.size();
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = value[i];
|
||||
value.clear();
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
delete[] buffer;
|
||||
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
void *fake_user_data = NULL;
|
||||
|
||||
if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT
|
||||
&& item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
upload_new_resource(transaction_id,
|
||||
item->getType(),
|
||||
item->getName(),
|
||||
item->getDescription(),
|
||||
0,
|
||||
item->getType(),
|
||||
item->getInventoryType(),
|
||||
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
|
||||
item->getName(),
|
||||
callback,
|
||||
sUploadAmount,
|
||||
fake_user_data);
|
||||
}
|
||||
else // gestures and scripts, create an item first
|
||||
{ // AND notecards
|
||||
//if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true;
|
||||
create_inventory_item( gAgent.getID(),
|
||||
gAgent.getSessionID(),
|
||||
item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()),
|
||||
LLTransactionID::tnull,
|
||||
item->getName(),
|
||||
fake_asset_id.asString(),
|
||||
item->getType(),
|
||||
item->getInventoryType(),
|
||||
(EWearableType)item->getFlags(),
|
||||
PERM_ITEM_UNRESTRICTED,
|
||||
new NewResourceItemCallback);
|
||||
}
|
||||
}
|
||||
|
||||
struct LLSaveInfo
|
||||
{
|
||||
LLSaveInfo(DOFloaterHex* floater, LLTransactionID transaction_id)
|
||||
: mFloater(floater), mTransactionID(transaction_id)
|
||||
{
|
||||
}
|
||||
|
||||
DOFloaterHex* mFloater;
|
||||
LLTransactionID mTransactionID;
|
||||
};
|
||||
|
||||
// static
|
||||
void DOFloaterHex::onClickSave(void* user_data)
|
||||
{
|
||||
DOFloaterHex* floater = (DOFloaterHex*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
std::vector<U8> value = floater->mEditor->getValue();
|
||||
int size = value.size();
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = value[i];
|
||||
value.clear();
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
delete[] buffer;
|
||||
|
||||
|
||||
bool caps = false;
|
||||
std::string url;
|
||||
LLSD body;
|
||||
body["item_id"] = item->getUUID();
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_GESTURE:
|
||||
url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_LSL_TEXT:
|
||||
url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
|
||||
body["target"] = "mono";
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_NOTECARD:
|
||||
url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
default: // wearables & notecards, Oct 12 2009
|
||||
// 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);
|
||||
caps = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(caps)
|
||||
{
|
||||
LLHTTPClient::post(url, body,
|
||||
new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType()));
|
||||
}
|
||||
}
|
||||
|
||||
void DOFloaterHex::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLSaveInfo* info = (LLSaveInfo*)user_data;
|
||||
DOFloaterHex* floater = info->mFloater;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
floater->childSetText("status_text", std::string(""));
|
||||
|
||||
if(item && (status == 0))
|
||||
{
|
||||
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
|
||||
new_item->setDescription(item->getDescription());
|
||||
new_item->setTransactionID(info->mTransactionID);
|
||||
new_item->setAssetUUID(asset_uuid);
|
||||
new_item->updateServer(FALSE);
|
||||
gInventory.updateItem(new_item);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status);
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
}
|
||||
}
|
||||
|
||||
// </edit>
|
||||
/**
|
||||
* @file dofloaterhex.h
|
||||
* @brief Hex Editor Floater made by Day
|
||||
* @author Day Oh
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
// <edit>
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "dofloaterhex.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llinventorybackup.h" // for downloading
|
||||
#include "llviewercontrol.h" // gSavedSettings
|
||||
#include "llviewerwindow.h" // alertXML
|
||||
#include "llagent.h" // gAgent getID
|
||||
#include "llviewermenufile.h"
|
||||
#include "llviewerregion.h" // getCapability
|
||||
#include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder
|
||||
#include "llinventorymodel.h" // gInventory.updateItem
|
||||
#include "llappviewer.h" // gLocalInventoryRoot
|
||||
#include "llfloaterperms.h" //get default perms
|
||||
|
||||
std::list<DOFloaterHex*> DOFloaterHex::sInstances;
|
||||
S32 DOFloaterHex::sUploadAmount = 10;
|
||||
|
||||
DOFloaterHex::DOFloaterHex(LLInventoryItem* item)
|
||||
: LLFloater()
|
||||
{
|
||||
sInstances.push_back(this);
|
||||
mItem = item;
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hex.xml");
|
||||
}
|
||||
|
||||
// static
|
||||
void DOFloaterHex::show(LLUUID item_id)
|
||||
{
|
||||
LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id);
|
||||
if(item)
|
||||
{
|
||||
S32 left, top;
|
||||
gFloaterView->getNewFloaterPosition(&left, &top);
|
||||
LLRect rect = gSavedSettings.getRect("FloaterHexRect");
|
||||
rect.translate(left - rect.mLeft, top - rect.mTop);
|
||||
DOFloaterHex* floaterp = new DOFloaterHex(item);
|
||||
floaterp->setRect(rect);
|
||||
gFloaterView->adjustToFitScreen(floaterp, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
DOFloaterHex::~DOFloaterHex()
|
||||
{
|
||||
sInstances.remove(this);
|
||||
}
|
||||
|
||||
void DOFloaterHex::close(bool app_quitting)
|
||||
{
|
||||
LLFloater::close(app_quitting);
|
||||
}
|
||||
|
||||
BOOL DOFloaterHex::postBuild(void)
|
||||
{
|
||||
DOHexEditor* editor = getChild<DOHexEditor>("hex");
|
||||
mEditor = editor;
|
||||
#ifndef COLUMN_SPAN
|
||||
// Set number of columns
|
||||
U8 columns = U8(gSavedSettings.getU32("HexEditorColumns"));
|
||||
editor->setColumns(columns);
|
||||
// Reflect clamped U8ness in settings
|
||||
gSavedSettings.setU32("HexEditorColumns", U32(columns));
|
||||
#endif
|
||||
handleSizing();
|
||||
|
||||
childSetEnabled("upload_btn", false);
|
||||
childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload"));
|
||||
childSetAction("upload_btn", onClickUpload, this);
|
||||
childSetEnabled("save_btn", false);
|
||||
childSetAction("save_btn", onClickSave, this);
|
||||
|
||||
if(mItem)
|
||||
{
|
||||
std::string title = "Hex editor: " + mItem->getName();
|
||||
const char* asset_type_name = LLAssetType::lookup(mItem->getType());
|
||||
if(asset_type_name)
|
||||
{
|
||||
title.append(" (" + std::string(asset_type_name) + ")");
|
||||
}
|
||||
setTitle(title);
|
||||
}
|
||||
#if OPENSIM_RULES!=1
|
||||
if(mItem->getCreatorUUID() == gAgentID)
|
||||
{
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
// Load the asset
|
||||
editor->setVisible(FALSE);
|
||||
childSetText("status_text", std::string("Loading..."));
|
||||
LLInventoryBackup::download(mItem, this, imageCallback, assetCallback);
|
||||
#if OPENSIM_RULES!=1
|
||||
} else {
|
||||
this->close(false);
|
||||
}
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// static
|
||||
void DOFloaterHex::imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata)
|
||||
{
|
||||
if(final)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
|
||||
DOFloaterHex* floater = (DOFloaterHex*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
//LLInventoryItem* item = data->item;
|
||||
|
||||
if(!success)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
U8* src_data = src->getData();
|
||||
S32 size = src->getDataSize();
|
||||
std::vector<U8> new_data;
|
||||
for(S32 i = 0; i < size; i++)
|
||||
new_data.push_back(src_data[i]);
|
||||
|
||||
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"));
|
||||
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void DOFloaterHex::assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
|
||||
DOFloaterHex* floater = (DOFloaterHex*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = data->item;
|
||||
|
||||
if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Todo: this doesn't work for static vfs shit
|
||||
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
|
||||
S32 size = file.getSize();
|
||||
|
||||
char* buffer = new char[size];
|
||||
if (buffer == NULL)
|
||||
{
|
||||
llerrs << "Memory Allocation Failed" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
file.read((U8*)buffer, size);
|
||||
|
||||
std::vector<U8> new_data;
|
||||
for(S32 i = 0; i < size; i++)
|
||||
new_data.push_back(buffer[i]);
|
||||
|
||||
delete[] buffer;
|
||||
|
||||
floater->mEditor->setValue(new_data);
|
||||
floater->mEditor->setVisible(TRUE);
|
||||
floater->childSetText("status_text", std::string(""));
|
||||
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
if(item->getPermissions().allowModifyBy(gAgent.getID()))
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
case LLAssetType::AT_LANDMARK:
|
||||
case LLAssetType::AT_CALLINGCARD:
|
||||
floater->childSetEnabled("upload_btn", false);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
break;
|
||||
default:
|
||||
floater->childSetEnabled("save_btn", true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Never enable save if it's a pretend item
|
||||
if(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot))
|
||||
{
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void DOFloaterHex::onClickUpload(void* user_data)
|
||||
{
|
||||
DOFloaterHex* floater = (DOFloaterHex*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
std::vector<U8> value = floater->mEditor->getValue();
|
||||
int size = value.size();
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = value[i];
|
||||
value.clear();
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
delete[] buffer;
|
||||
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
void *fake_user_data = NULL;
|
||||
|
||||
if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT
|
||||
&& item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
upload_new_resource(transaction_id,
|
||||
item->getType(),
|
||||
item->getName(),
|
||||
item->getDescription(),
|
||||
0,
|
||||
item->getType(),
|
||||
item->getInventoryType(),
|
||||
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
|
||||
item->getName(),
|
||||
callback,
|
||||
sUploadAmount,
|
||||
fake_user_data);
|
||||
}
|
||||
else // gestures and scripts, create an item first
|
||||
{ // AND notecards
|
||||
//if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true;
|
||||
create_inventory_item( gAgent.getID(),
|
||||
gAgent.getSessionID(),
|
||||
item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()),
|
||||
LLTransactionID::tnull,
|
||||
item->getName(),
|
||||
fake_asset_id.asString(),
|
||||
item->getType(),
|
||||
item->getInventoryType(),
|
||||
(EWearableType)item->getFlags(),
|
||||
PERM_ITEM_UNRESTRICTED,
|
||||
new NewResourceItemCallback);
|
||||
}
|
||||
}
|
||||
|
||||
struct LLSaveInfo
|
||||
{
|
||||
LLSaveInfo(DOFloaterHex* floater, LLTransactionID transaction_id)
|
||||
: mFloater(floater), mTransactionID(transaction_id)
|
||||
{
|
||||
}
|
||||
|
||||
DOFloaterHex* mFloater;
|
||||
LLTransactionID mTransactionID;
|
||||
};
|
||||
|
||||
// static
|
||||
void DOFloaterHex::onClickSave(void* user_data)
|
||||
{
|
||||
DOFloaterHex* floater = (DOFloaterHex*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
std::vector<U8> value = floater->mEditor->getValue();
|
||||
int size = value.size();
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = value[i];
|
||||
value.clear();
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
delete[] buffer;
|
||||
|
||||
|
||||
bool caps = false;
|
||||
std::string url;
|
||||
LLSD body;
|
||||
body["item_id"] = item->getUUID();
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_GESTURE:
|
||||
url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_LSL_TEXT:
|
||||
url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
|
||||
body["target"] = "mono";
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_NOTECARD:
|
||||
url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
default: // wearables & notecards, Oct 12 2009
|
||||
// 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);
|
||||
caps = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(caps)
|
||||
{
|
||||
LLHTTPClient::post(url, body,
|
||||
new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType()));
|
||||
}
|
||||
}
|
||||
|
||||
void DOFloaterHex::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLSaveInfo* info = (LLSaveInfo*)user_data;
|
||||
DOFloaterHex* floater = info->mFloater;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
floater->childSetText("status_text", std::string(""));
|
||||
|
||||
if(item && (status == 0))
|
||||
{
|
||||
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
|
||||
new_item->setDescription(item->getDescription());
|
||||
new_item->setTransactionID(info->mTransactionID);
|
||||
new_item->setAssetUUID(asset_uuid);
|
||||
new_item->updateServer(FALSE);
|
||||
gInventory.updateItem(new_item);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status);
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
}
|
||||
}
|
||||
|
||||
void DOFloaterHex::onCommitColumnCount(LLUICtrl *control, void *user_data)
|
||||
{
|
||||
if(control && user_data)
|
||||
{
|
||||
DOFloaterHex *instance = (DOFloaterHex *)user_data;
|
||||
U8 columns = llclamp<U8>((U8)llfloor(control->getValue().asReal()), 0x00, 0xFF);
|
||||
instance->mEditor->setColumns(columns);
|
||||
gSavedSettings.setU32("HexEditorColumns", (U32)instance->mEditor->getColumns());
|
||||
instance->handleSizing();
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
@@ -1,44 +1,46 @@
|
||||
// <edit>
|
||||
|
||||
|
||||
#ifndef LL_LLFLOATERHEX_H
|
||||
#define LL_LLFLOATERHEX_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "dohexeditor.h"
|
||||
#include "llinventory.h"
|
||||
#include "llviewerimage.h"
|
||||
|
||||
class DOFloaterHex
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
DOFloaterHex(LLInventoryItem* item);
|
||||
static void show(LLUUID item_id);
|
||||
BOOL postBuild(void);
|
||||
void close(bool app_quitting);
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
static void onClickSave(void* user_data);
|
||||
static void onClickUpload(void* user_data);
|
||||
static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status);
|
||||
LLInventoryItem* mItem;
|
||||
DOHexEditor* mEditor;
|
||||
static std::list<DOFloaterHex*> sInstances;
|
||||
private:
|
||||
virtual ~DOFloaterHex();
|
||||
protected:
|
||||
static S32 sUploadAmount;
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
// <edit>
|
||||
|
||||
|
||||
#ifndef LL_LLFLOATERHEX_H
|
||||
#define LL_LLFLOATERHEX_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "dohexeditor.h"
|
||||
#include "llinventory.h"
|
||||
#include "llviewerimage.h"
|
||||
|
||||
class DOFloaterHex
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
DOFloaterHex(LLInventoryItem* item);
|
||||
static void show(LLUUID item_id);
|
||||
BOOL postBuild(void);
|
||||
void close(bool app_quitting);
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
static void onClickSave(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 onCommitColumnCount(LLUICtrl *control, void *user_data);
|
||||
void handleSizing();
|
||||
LLInventoryItem* mItem;
|
||||
DOHexEditor* mEditor;
|
||||
static std::list<DOFloaterHex*> sInstances;
|
||||
private:
|
||||
virtual ~DOFloaterHex();
|
||||
protected:
|
||||
static S32 sUploadAmount;
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,152 +1,159 @@
|
||||
/**
|
||||
* @file dohexeditor.h
|
||||
* @brief DOHexEditor Widget
|
||||
* @author Day Oh
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
// <edit>
|
||||
#ifndef DO_DOHEXEDITOR_H
|
||||
#define DO_DOHEXEDITOR_H
|
||||
|
||||
#include "lluictrl.h"
|
||||
#include "llscrollbar.h"
|
||||
#include "llviewborder.h"
|
||||
#include "llundo.h"
|
||||
#include "lleditmenuhandler.h"
|
||||
|
||||
class DOHexEditor : public LLUICtrl, public LLEditMenuHandler
|
||||
{
|
||||
public:
|
||||
DOHexEditor(const std::string& name, const LLRect& rect);
|
||||
~DOHexEditor();
|
||||
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
|
||||
void setValue(const LLSD& value);
|
||||
LLSD getValue() const;
|
||||
void setColumns(U8 columns);
|
||||
U8 getColumns(U8 columns) { return mColumns; };
|
||||
U32 getLineCount();
|
||||
F32 getSuggestedWidth();
|
||||
U32 getProperSelectionStart();
|
||||
U32 getProperSelectionEnd();
|
||||
void reshape(S32 width, S32 height, BOOL called_from_parent);
|
||||
void setFocus(BOOL b);
|
||||
|
||||
BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
|
||||
BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
||||
BOOL handleHover(S32 x, S32 y, MASK mask);
|
||||
BOOL handleMouseUp(S32 x, S32 y, MASK mask);
|
||||
|
||||
BOOL handleKeyHere(KEY key, MASK mask);
|
||||
BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
|
||||
BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
|
||||
BOOL handleUnicodeCharHere(llwchar uni_char);
|
||||
|
||||
void draw();
|
||||
|
||||
void moveCursor(U32 pos, BOOL second_nibble);
|
||||
|
||||
void insert(U32 pos, std::vector<U8> new_data, BOOL undoable);
|
||||
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 cut();
|
||||
virtual BOOL canCut() const;
|
||||
|
||||
virtual void copy();
|
||||
virtual BOOL canCopy() const;
|
||||
|
||||
virtual void paste();
|
||||
virtual BOOL canPaste() const;
|
||||
|
||||
virtual void doDelete();
|
||||
virtual BOOL canDoDelete() const;
|
||||
|
||||
virtual void selectAll();
|
||||
virtual BOOL canSelectAll() const;
|
||||
|
||||
virtual void deselect();
|
||||
virtual BOOL canDeselect() const;
|
||||
|
||||
virtual void undo();
|
||||
virtual BOOL canUndo() const;
|
||||
|
||||
virtual void redo();
|
||||
virtual BOOL canRedo() const;
|
||||
|
||||
private:
|
||||
std::vector<U8> mValue;
|
||||
U8 mColumns;
|
||||
|
||||
U32 mCursorPos;
|
||||
BOOL mSecondNibble;
|
||||
BOOL mInData;
|
||||
BOOL mSelecting;
|
||||
BOOL mHasSelection;
|
||||
U32 mSelectionStart;
|
||||
U32 mSelectionEnd;
|
||||
|
||||
LLFontGL* mGLFont;
|
||||
LLRect mTextRect;
|
||||
LLScrollbar* mScrollbar;
|
||||
LLViewBorder* mBorder;
|
||||
|
||||
LLUndoBuffer* mUndoBuffer;
|
||||
|
||||
void changedLength();
|
||||
void getPosAndContext(S32 x, S32 y, BOOL force_context, U32& pos, BOOL& in_data, BOOL& second_nibble);
|
||||
};
|
||||
|
||||
class DOUndoHex : public LLUndoBuffer::LLUndoAction
|
||||
{
|
||||
protected:
|
||||
DOUndoHex() { }
|
||||
DOHexEditor* mHexEditor;
|
||||
U32 mFirstPos;
|
||||
U32 mLastPos;
|
||||
std::vector<U8> mOldData;
|
||||
std::vector<U8> mNewData;
|
||||
public:
|
||||
static LLUndoAction* create() { return new DOUndoHex(); }
|
||||
virtual void set(DOHexEditor* hex_editor,
|
||||
void (*undo_action)(DOUndoHex*),
|
||||
void (*redo_action)(DOUndoHex*),
|
||||
U32 first_pos,
|
||||
U32 last_pos,
|
||||
std::vector<U8> old_data,
|
||||
std::vector<U8> new_data);
|
||||
void (*mUndoAction)(DOUndoHex*);
|
||||
void (*mRedoAction)(DOUndoHex*);
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
|
||||
static void undoInsert(DOUndoHex* action);
|
||||
static void redoInsert(DOUndoHex* action);
|
||||
static void undoOverwrite(DOUndoHex* action);
|
||||
static void redoOverwrite(DOUndoHex* action);
|
||||
static void undoDel(DOUndoHex* action);
|
||||
static void redoDel(DOUndoHex* action);
|
||||
};
|
||||
|
||||
class DOHexInsert : public DOUndoHex
|
||||
{
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
};
|
||||
|
||||
class DOHexOverwrite : public DOUndoHex
|
||||
{
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
};
|
||||
|
||||
class DOHexDel : public DOUndoHex
|
||||
{
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
/**
|
||||
* @file dohexeditor.h
|
||||
* @brief DOHexEditor Widget
|
||||
* @author Day Oh
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
// <edit>
|
||||
#ifndef DO_DOHEXEDITOR_H
|
||||
#define DO_DOHEXEDITOR_H
|
||||
|
||||
#define MIN_COLS 8
|
||||
#define MAX_COLS 48
|
||||
|
||||
#ifndef COLUMN_SPAN
|
||||
#define COLUMN_SPAN
|
||||
#endif
|
||||
|
||||
#include "lluictrl.h"
|
||||
#include "llscrollbar.h"
|
||||
#include "llviewborder.h"
|
||||
#include "llundo.h"
|
||||
#include "lleditmenuhandler.h"
|
||||
|
||||
class DOHexEditor : public LLUICtrl, public LLEditMenuHandler
|
||||
{
|
||||
public:
|
||||
DOHexEditor(const std::string& name, const LLRect& rect);
|
||||
~DOHexEditor();
|
||||
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
|
||||
void setValue(const LLSD& value);
|
||||
LLSD getValue() const;
|
||||
void setColumns(U8 columns);
|
||||
U8 getColumns() { return mColumns; };
|
||||
U32 getLineCount();
|
||||
F32 getSuggestedWidth(U8 cols = -1);
|
||||
U32 getProperSelectionStart();
|
||||
U32 getProperSelectionEnd();
|
||||
void reshape(S32 width, S32 height, BOOL called_from_parent);
|
||||
void setFocus(BOOL b);
|
||||
|
||||
BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
|
||||
BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
||||
BOOL handleHover(S32 x, S32 y, MASK mask);
|
||||
BOOL handleMouseUp(S32 x, S32 y, MASK mask);
|
||||
|
||||
BOOL handleKeyHere(KEY key, MASK mask);
|
||||
BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
|
||||
BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
|
||||
BOOL handleUnicodeCharHere(llwchar uni_char);
|
||||
|
||||
void draw();
|
||||
|
||||
void moveCursor(U32 pos, BOOL second_nibble);
|
||||
|
||||
void insert(U32 pos, std::vector<U8> new_data, BOOL undoable);
|
||||
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 cut();
|
||||
virtual BOOL canCut() const;
|
||||
|
||||
virtual void copy();
|
||||
virtual BOOL canCopy() const;
|
||||
|
||||
virtual void paste();
|
||||
virtual BOOL canPaste() const;
|
||||
|
||||
virtual void doDelete();
|
||||
virtual BOOL canDoDelete() const;
|
||||
|
||||
virtual void selectAll();
|
||||
virtual BOOL canSelectAll() const;
|
||||
|
||||
virtual void deselect();
|
||||
virtual BOOL canDeselect() const;
|
||||
|
||||
virtual void undo();
|
||||
virtual BOOL canUndo() const;
|
||||
|
||||
virtual void redo();
|
||||
virtual BOOL canRedo() const;
|
||||
|
||||
private:
|
||||
std::vector<U8> mValue;
|
||||
U8 mColumns;
|
||||
|
||||
U32 mCursorPos;
|
||||
BOOL mSecondNibble;
|
||||
BOOL mInData;
|
||||
BOOL mSelecting;
|
||||
BOOL mHasSelection;
|
||||
U32 mSelectionStart;
|
||||
U32 mSelectionEnd;
|
||||
|
||||
LLFontGL* mGLFont;
|
||||
LLRect mTextRect;
|
||||
LLScrollbar* mScrollbar;
|
||||
LLViewBorder* mBorder;
|
||||
|
||||
LLUndoBuffer* mUndoBuffer;
|
||||
|
||||
void changedLength();
|
||||
void getPosAndContext(S32 x, S32 y, BOOL force_context, U32& pos, BOOL& in_data, BOOL& second_nibble);
|
||||
};
|
||||
|
||||
class DOUndoHex : public LLUndoBuffer::LLUndoAction
|
||||
{
|
||||
protected:
|
||||
DOUndoHex() { }
|
||||
DOHexEditor* mHexEditor;
|
||||
U32 mFirstPos;
|
||||
U32 mLastPos;
|
||||
std::vector<U8> mOldData;
|
||||
std::vector<U8> mNewData;
|
||||
public:
|
||||
static LLUndoAction* create() { return new DOUndoHex(); }
|
||||
virtual void set(DOHexEditor* hex_editor,
|
||||
void (*undo_action)(DOUndoHex*),
|
||||
void (*redo_action)(DOUndoHex*),
|
||||
U32 first_pos,
|
||||
U32 last_pos,
|
||||
std::vector<U8> old_data,
|
||||
std::vector<U8> new_data);
|
||||
void (*mUndoAction)(DOUndoHex*);
|
||||
void (*mRedoAction)(DOUndoHex*);
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
|
||||
static void undoInsert(DOUndoHex* action);
|
||||
static void redoInsert(DOUndoHex* action);
|
||||
static void undoOverwrite(DOUndoHex* action);
|
||||
static void redoOverwrite(DOUndoHex* action);
|
||||
static void undoDel(DOUndoHex* action);
|
||||
static void redoDel(DOUndoHex* action);
|
||||
};
|
||||
|
||||
class DOHexInsert : public DOUndoHex
|
||||
{
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
};
|
||||
|
||||
class DOHexOverwrite : public DOUndoHex
|
||||
{
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
};
|
||||
|
||||
class DOHexDel : public DOUndoHex
|
||||
{
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
|
||||
@@ -1,398 +1,398 @@
|
||||
/**
|
||||
* @file hgfloatertexteditor.cpp
|
||||
* @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh)
|
||||
* @author Hazim Gazov
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
// <edit>
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "hgfloatertexteditor.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llinventorybackup.h" // for downloading
|
||||
#include "llviewercontrol.h" // gSavedSettings
|
||||
#include "llviewerwindow.h" // alertXML
|
||||
#include "llagent.h" // gAgent getID
|
||||
#include "llviewermenufile.h"
|
||||
#include "llviewerregion.h" // getCapability
|
||||
#include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder
|
||||
#include "llinventorymodel.h" // gInventory.updateItem
|
||||
#include "llappviewer.h" // gLocalInventoryRoot
|
||||
#include "llfloaterperms.h" //get default perms
|
||||
#include "lllocalinventory.h"
|
||||
|
||||
std::list<HGFloaterTextEditor*> HGFloaterTextEditor::sInstances;
|
||||
S32 HGFloaterTextEditor::sUploadAmount = 10;
|
||||
|
||||
HGFloaterTextEditor::HGFloaterTextEditor(LLInventoryItem* item)
|
||||
: LLFloater()
|
||||
{
|
||||
sInstances.push_back(this);
|
||||
mItem = item;
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_asset_text_editor.xml");
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::show(LLUUID item_id)
|
||||
{
|
||||
LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id);
|
||||
if(item)
|
||||
{
|
||||
S32 left, top;
|
||||
gFloaterView->getNewFloaterPosition(&left, &top);
|
||||
LLRect rect = gSavedSettings.getRect("FloaterAssetTextEditorRect");
|
||||
rect.translate(left - rect.mLeft, top - rect.mTop);
|
||||
HGFloaterTextEditor* floaterp = new HGFloaterTextEditor(item);
|
||||
floaterp->setRect(rect);
|
||||
gFloaterView->adjustToFitScreen(floaterp, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
HGFloaterTextEditor::~HGFloaterTextEditor()
|
||||
{
|
||||
sInstances.remove(this);
|
||||
}
|
||||
|
||||
void HGFloaterTextEditor::close(bool app_quitting)
|
||||
{
|
||||
LLFloater::close(app_quitting);
|
||||
}
|
||||
|
||||
BOOL HGFloaterTextEditor::postBuild(void)
|
||||
{
|
||||
LLTextEditor* editor = getChild<LLTextEditor>("text_editor");
|
||||
mEditor = editor;
|
||||
|
||||
childSetEnabled("upload_btn", false);
|
||||
childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload"));
|
||||
childSetAction("upload_btn", onClickUpload, this);
|
||||
childSetEnabled("save_btn", false);
|
||||
childSetAction("save_btn", onClickSave, this);
|
||||
|
||||
if(mItem)
|
||||
{
|
||||
std::string title = "Text editor: " + mItem->getName();
|
||||
const char* asset_type_name = LLAssetType::lookup(mItem->getType());
|
||||
if(asset_type_name)
|
||||
{
|
||||
title.append(" (" + std::string(asset_type_name) + ")");
|
||||
}
|
||||
setTitle(title);
|
||||
}
|
||||
#if OPENSIM_RULES!=1
|
||||
if(mItem->getCreatorUUID() == gAgentID)
|
||||
{
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
// Load the asset
|
||||
editor->setVisible(FALSE);
|
||||
childSetText("status_text", std::string("Loading..."));
|
||||
LLInventoryBackup::download(mItem, this, imageCallback, assetCallback);
|
||||
#if OPENSIM_RULES!=1
|
||||
} else {
|
||||
this->close(false);
|
||||
}
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata)
|
||||
{
|
||||
if(final)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
//LLInventoryItem* item = data->item;
|
||||
|
||||
if(!success)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
U8* src_data = src->getData();
|
||||
S32 size = src->getDataSize();
|
||||
std::string new_data;
|
||||
for(S32 i = 0; i < size; i++)
|
||||
new_data += (char)src_data[i];
|
||||
|
||||
delete[] src_data;
|
||||
|
||||
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"));
|
||||
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = data->item;
|
||||
|
||||
if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Todo: this doesn't work for static vfs shit
|
||||
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
|
||||
S32 size = file.getSize();
|
||||
|
||||
std::string new_data("");
|
||||
if(size > 0)
|
||||
{
|
||||
char* buffer = new char[size + 1];
|
||||
if (buffer == NULL)
|
||||
{
|
||||
llerrs << "Memory Allocation Failed" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
file.read((U8*)buffer, size);
|
||||
buffer[size - 1] = 0;
|
||||
|
||||
new_data = std::string(buffer);
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
|
||||
floater->mEditor->setText(LLStringExplicit(new_data));
|
||||
floater->mEditor->setVisible(TRUE);
|
||||
floater->childSetText("status_text", llformat("File Size: %d", size));
|
||||
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
if(item->getPermissions().allowModifyBy(gAgent.getID()))
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
case LLAssetType::AT_LANDMARK:
|
||||
case LLAssetType::AT_CALLINGCARD:
|
||||
floater->childSetEnabled("upload_btn", false);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
break;
|
||||
default:
|
||||
floater->childSetEnabled("save_btn", true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Never enable save if it's a pretend item
|
||||
if(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot))
|
||||
{
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::onClickUpload(void* user_data)
|
||||
{
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
const char* value = floater->mEditor->getText().c_str();
|
||||
int size = strlen(value);
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = (U8)value[i];
|
||||
|
||||
delete[] value;
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
void *fake_user_data = NULL;
|
||||
|
||||
if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT
|
||||
&& item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
upload_new_resource(transaction_id,
|
||||
item->getType(),
|
||||
item->getName(),
|
||||
item->getDescription(),
|
||||
0,
|
||||
item->getType(),
|
||||
item->getInventoryType(),
|
||||
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
|
||||
item->getName(),
|
||||
callback,
|
||||
sUploadAmount,
|
||||
fake_user_data);
|
||||
}
|
||||
else // gestures and scripts, create an item first
|
||||
{ // AND notecards
|
||||
//if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true;
|
||||
create_inventory_item( gAgent.getID(),
|
||||
gAgent.getSessionID(),
|
||||
item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()),
|
||||
LLTransactionID::tnull,
|
||||
item->getName(),
|
||||
fake_asset_id.asString(),
|
||||
item->getType(),
|
||||
item->getInventoryType(),
|
||||
(EWearableType)item->getFlags(),
|
||||
PERM_ITEM_UNRESTRICTED,
|
||||
new NewResourceItemCallback);
|
||||
}
|
||||
}
|
||||
|
||||
struct LLSaveInfo
|
||||
{
|
||||
LLSaveInfo(HGFloaterTextEditor* floater, LLTransactionID transaction_id)
|
||||
: mFloater(floater), mTransactionID(transaction_id)
|
||||
{
|
||||
}
|
||||
|
||||
HGFloaterTextEditor* mFloater;
|
||||
LLTransactionID mTransactionID;
|
||||
};
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::onClickSave(void* user_data)
|
||||
{
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
const char* value = floater->mEditor->getText().c_str();
|
||||
int size = strlen(value);
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = (U8)value[i];
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
bool caps = false;
|
||||
std::string url;
|
||||
LLSD body;
|
||||
body["item_id"] = item->getUUID();
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_GESTURE:
|
||||
url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_LSL_TEXT:
|
||||
url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
|
||||
body["target"] = "mono";
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_NOTECARD:
|
||||
url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
default: // wearables & notecards, Oct 12 2009
|
||||
// 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);
|
||||
caps = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(caps)
|
||||
{
|
||||
LLHTTPClient::post(url, body,
|
||||
new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType()));
|
||||
}
|
||||
}
|
||||
|
||||
void HGFloaterTextEditor::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLSaveInfo* info = (LLSaveInfo*)user_data;
|
||||
HGFloaterTextEditor* floater = info->mFloater;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
floater->childSetText("status_text", std::string(""));
|
||||
|
||||
if(item && (status == 0))
|
||||
{
|
||||
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
|
||||
new_item->setDescription(item->getDescription());
|
||||
new_item->setTransactionID(info->mTransactionID);
|
||||
new_item->setAssetUUID(asset_uuid);
|
||||
new_item->updateServer(FALSE);
|
||||
gInventory.updateItem(new_item);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status);
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
}
|
||||
}
|
||||
|
||||
// </edit>
|
||||
/**
|
||||
* @file hgfloatertexteditor.cpp
|
||||
* @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh)
|
||||
* @author Hazim Gazov
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
// <edit>
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "hgfloatertexteditor.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llinventorybackup.h" // for downloading
|
||||
#include "llviewercontrol.h" // gSavedSettings
|
||||
#include "llviewerwindow.h" // alertXML
|
||||
#include "llagent.h" // gAgent getID
|
||||
#include "llviewermenufile.h"
|
||||
#include "llviewerregion.h" // getCapability
|
||||
#include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder
|
||||
#include "llinventorymodel.h" // gInventory.updateItem
|
||||
#include "llappviewer.h" // gLocalInventoryRoot
|
||||
#include "llfloaterperms.h" //get default perms
|
||||
#include "lllocalinventory.h"
|
||||
|
||||
std::list<HGFloaterTextEditor*> HGFloaterTextEditor::sInstances;
|
||||
S32 HGFloaterTextEditor::sUploadAmount = 10;
|
||||
|
||||
HGFloaterTextEditor::HGFloaterTextEditor(LLInventoryItem* item)
|
||||
: LLFloater()
|
||||
{
|
||||
sInstances.push_back(this);
|
||||
mItem = item;
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_asset_text_editor.xml");
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::show(LLUUID item_id)
|
||||
{
|
||||
LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id);
|
||||
if(item)
|
||||
{
|
||||
S32 left, top;
|
||||
gFloaterView->getNewFloaterPosition(&left, &top);
|
||||
LLRect rect = gSavedSettings.getRect("FloaterAssetTextEditorRect");
|
||||
rect.translate(left - rect.mLeft, top - rect.mTop);
|
||||
HGFloaterTextEditor* floaterp = new HGFloaterTextEditor(item);
|
||||
floaterp->setRect(rect);
|
||||
gFloaterView->adjustToFitScreen(floaterp, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
HGFloaterTextEditor::~HGFloaterTextEditor()
|
||||
{
|
||||
sInstances.remove(this);
|
||||
}
|
||||
|
||||
void HGFloaterTextEditor::close(bool app_quitting)
|
||||
{
|
||||
LLFloater::close(app_quitting);
|
||||
}
|
||||
|
||||
BOOL HGFloaterTextEditor::postBuild(void)
|
||||
{
|
||||
LLTextEditor* editor = getChild<LLTextEditor>("text_editor");
|
||||
mEditor = editor;
|
||||
|
||||
childSetEnabled("upload_btn", false);
|
||||
childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload"));
|
||||
childSetAction("upload_btn", onClickUpload, this);
|
||||
childSetEnabled("save_btn", false);
|
||||
childSetAction("save_btn", onClickSave, this);
|
||||
|
||||
if(mItem)
|
||||
{
|
||||
std::string title = "Text editor: " + mItem->getName();
|
||||
const char* asset_type_name = LLAssetType::lookup(mItem->getType());
|
||||
if(asset_type_name)
|
||||
{
|
||||
title.append(" (" + std::string(asset_type_name) + ")");
|
||||
}
|
||||
setTitle(title);
|
||||
}
|
||||
#if OPENSIM_RULES!=1
|
||||
if(mItem->getCreatorUUID() == gAgentID)
|
||||
{
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
// Load the asset
|
||||
editor->setVisible(FALSE);
|
||||
childSetText("status_text", std::string("Loading..."));
|
||||
LLInventoryBackup::download(mItem, this, imageCallback, assetCallback);
|
||||
#if OPENSIM_RULES!=1
|
||||
} else {
|
||||
this->close(false);
|
||||
}
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata)
|
||||
{
|
||||
if(final)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
//LLInventoryItem* item = data->item;
|
||||
|
||||
if(!success)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
U8* src_data = src->getData();
|
||||
S32 size = src->getDataSize();
|
||||
std::string new_data;
|
||||
for(S32 i = 0; i < size; i++)
|
||||
new_data += (char)src_data[i];
|
||||
|
||||
delete[] src_data;
|
||||
|
||||
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"));
|
||||
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = data->item;
|
||||
|
||||
if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Todo: this doesn't work for static vfs shit
|
||||
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
|
||||
S32 size = file.getSize();
|
||||
|
||||
std::string new_data("");
|
||||
if(size > 0)
|
||||
{
|
||||
char* buffer = new char[size + 1];
|
||||
if (buffer == NULL)
|
||||
{
|
||||
llerrs << "Memory Allocation Failed" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
file.read((U8*)buffer, size);
|
||||
buffer[size - 1] = 0;
|
||||
|
||||
new_data = std::string(buffer);
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
|
||||
floater->mEditor->setText(LLStringExplicit(new_data));
|
||||
floater->mEditor->setVisible(TRUE);
|
||||
floater->childSetText("status_text", llformat("File Size: %d", size));
|
||||
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
if(item->getPermissions().allowModifyBy(gAgent.getID()))
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
case LLAssetType::AT_LANDMARK:
|
||||
case LLAssetType::AT_CALLINGCARD:
|
||||
floater->childSetEnabled("upload_btn", false);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
break;
|
||||
default:
|
||||
floater->childSetEnabled("save_btn", true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Never enable save if it's a pretend item
|
||||
if(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot))
|
||||
{
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::onClickUpload(void* user_data)
|
||||
{
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
const char* value = floater->mEditor->getText().c_str();
|
||||
int size = strlen(value);
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = (U8)value[i];
|
||||
|
||||
delete[] value;
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
void *fake_user_data = NULL;
|
||||
|
||||
if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT
|
||||
&& item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
upload_new_resource(transaction_id,
|
||||
item->getType(),
|
||||
item->getName(),
|
||||
item->getDescription(),
|
||||
0,
|
||||
item->getType(),
|
||||
item->getInventoryType(),
|
||||
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
|
||||
item->getName(),
|
||||
callback,
|
||||
sUploadAmount,
|
||||
fake_user_data);
|
||||
}
|
||||
else // gestures and scripts, create an item first
|
||||
{ // AND notecards
|
||||
//if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true;
|
||||
create_inventory_item( gAgent.getID(),
|
||||
gAgent.getSessionID(),
|
||||
item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()),
|
||||
LLTransactionID::tnull,
|
||||
item->getName(),
|
||||
fake_asset_id.asString(),
|
||||
item->getType(),
|
||||
item->getInventoryType(),
|
||||
(EWearableType)item->getFlags(),
|
||||
PERM_ITEM_UNRESTRICTED,
|
||||
new NewResourceItemCallback);
|
||||
}
|
||||
}
|
||||
|
||||
struct LLSaveInfo
|
||||
{
|
||||
LLSaveInfo(HGFloaterTextEditor* floater, LLTransactionID transaction_id)
|
||||
: mFloater(floater), mTransactionID(transaction_id)
|
||||
{
|
||||
}
|
||||
|
||||
HGFloaterTextEditor* mFloater;
|
||||
LLTransactionID mTransactionID;
|
||||
};
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::onClickSave(void* user_data)
|
||||
{
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
const char* value = floater->mEditor->getText().c_str();
|
||||
int size = strlen(value);
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = (U8)value[i];
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
bool caps = false;
|
||||
std::string url;
|
||||
LLSD body;
|
||||
body["item_id"] = item->getUUID();
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_GESTURE:
|
||||
url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_LSL_TEXT:
|
||||
url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
|
||||
body["target"] = "mono";
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_NOTECARD:
|
||||
url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
default: // wearables & notecards, Oct 12 2009
|
||||
// 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);
|
||||
caps = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(caps)
|
||||
{
|
||||
LLHTTPClient::post(url, body,
|
||||
new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType()));
|
||||
}
|
||||
}
|
||||
|
||||
void HGFloaterTextEditor::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLSaveInfo* info = (LLSaveInfo*)user_data;
|
||||
HGFloaterTextEditor* floater = info->mFloater;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
floater->childSetText("status_text", std::string(""));
|
||||
|
||||
if(item && (status == 0))
|
||||
{
|
||||
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
|
||||
new_item->setDescription(item->getDescription());
|
||||
new_item->setTransactionID(info->mTransactionID);
|
||||
new_item->setAssetUUID(asset_uuid);
|
||||
new_item->updateServer(FALSE);
|
||||
gInventory.updateItem(new_item);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status);
|
||||
LLNotifications::instance().add("ErrorMessage", args);
|
||||
}
|
||||
}
|
||||
|
||||
// </edit>
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
/**
|
||||
* @file hgfloatertexteditor.h
|
||||
* @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh)
|
||||
* @author Hazim Gazov
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HG_HGFLOATERTEXT_H
|
||||
#define HG_HGFLOATERTEXT_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "lltexteditor.h"
|
||||
#include "llinventory.h"
|
||||
#include "llviewerimage.h"
|
||||
|
||||
class HGFloaterTextEditor
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
HGFloaterTextEditor(LLInventoryItem* item);
|
||||
static void show(LLUUID item_id);
|
||||
BOOL postBuild(void);
|
||||
void close(bool app_quitting);
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
static void onClickSave(void* user_data);
|
||||
static void onClickUpload(void* user_data);
|
||||
static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status);
|
||||
LLInventoryItem* mItem;
|
||||
LLTextEditor* mEditor;
|
||||
static std::list<HGFloaterTextEditor*> sInstances;
|
||||
private:
|
||||
virtual ~HGFloaterTextEditor();
|
||||
protected:
|
||||
static S32 sUploadAmount;
|
||||
};
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @file hgfloatertexteditor.h
|
||||
* @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh)
|
||||
* @author Hazim Gazov
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HG_HGFLOATERTEXT_H
|
||||
#define HG_HGFLOATERTEXT_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "lltexteditor.h"
|
||||
#include "llinventory.h"
|
||||
#include "llviewerimage.h"
|
||||
|
||||
class HGFloaterTextEditor
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
HGFloaterTextEditor(LLInventoryItem* item);
|
||||
static void show(LLUUID item_id);
|
||||
BOOL postBuild(void);
|
||||
void close(bool app_quitting);
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
static void onClickSave(void* user_data);
|
||||
static void onClickUpload(void* user_data);
|
||||
static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status);
|
||||
LLInventoryItem* mItem;
|
||||
LLTextEditor* mEditor;
|
||||
static std::list<HGFloaterTextEditor*> sInstances;
|
||||
private:
|
||||
virtual ~HGFloaterTextEditor();
|
||||
protected:
|
||||
static S32 sUploadAmount;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -86,12 +86,12 @@
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llselectmgr.h"
|
||||
|
||||
// <edit>
|
||||
#include "lllocalinventory.h"
|
||||
#include "llinventorybackup.h"
|
||||
//#include "llcheats.h"
|
||||
//#include "llnotecardmagic.h"
|
||||
// </edit>
|
||||
// <edit>
|
||||
#include "lllocalinventory.h"
|
||||
#include "llinventorybackup.h"
|
||||
//#include "llcheats.h"
|
||||
//#include "llnotecardmagic.h"
|
||||
// </edit>
|
||||
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_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not)
|
||||
@@ -118,49 +118,49 @@ bool doToSelected(LLFolderView* folder, std::string action)
|
||||
{
|
||||
LLInventoryClipboard::instance().reset();
|
||||
}
|
||||
// <edit>
|
||||
if("save_as" == action)
|
||||
{
|
||||
LLInventoryBackup::save(folder);
|
||||
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;
|
||||
// <edit>
|
||||
if("save_as" == action)
|
||||
{
|
||||
LLInventoryBackup::save(folder);
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
*/
|
||||
// </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;
|
||||
folder->getSelectionList(selected_items);
|
||||
@@ -521,36 +521,36 @@ class LLDoCreateFloater : public inventory_listener_t
|
||||
LLInventoryModel* model = mPtr->getPanel()->getModel();
|
||||
if(!model) return false;
|
||||
std::string type = userdata.asString();
|
||||
// <edit>
|
||||
if(type == "pretend")
|
||||
{
|
||||
LLFloaterNewLocalInventory* floater = new LLFloaterNewLocalInventory();
|
||||
floater->center();
|
||||
}
|
||||
else
|
||||
// </edit>
|
||||
// <edit>
|
||||
if(type == "pretend")
|
||||
{
|
||||
LLFloaterNewLocalInventory* floater = new LLFloaterNewLocalInventory();
|
||||
floater->center();
|
||||
}
|
||||
else
|
||||
// </edit>
|
||||
do_create(model, mPtr->getPanel(), type);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// <edit>
|
||||
class LLLoadInvCacheFloater : public inventory_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLInventoryModel* model = mPtr->getPanel()->getModel();
|
||||
if(!model) return false;
|
||||
LLFilePicker& file_picker = LLFilePicker::instance();
|
||||
if(file_picker.getOpenFile( LLFilePicker::FFLOAD_INVGZ ))
|
||||
{
|
||||
std::string file_name = file_picker.getFirstFile();
|
||||
LLLocalInventory::loadInvCache(file_name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// </edit>
|
||||
// <edit>
|
||||
class LLLoadInvCacheFloater : public inventory_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLInventoryModel* model = mPtr->getPanel()->getModel();
|
||||
if(!model) return false;
|
||||
LLFilePicker& file_picker = LLFilePicker::instance();
|
||||
if(file_picker.getOpenFile( LLFilePicker::FFLOAD_INVGZ ))
|
||||
{
|
||||
std::string file_name = file_picker.getFirstFile();
|
||||
LLLocalInventory::loadInvCache(file_name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// </edit>
|
||||
class LLSetSortBy : public inventory_listener_t
|
||||
{
|
||||
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 LLEmptyTrashFloater())->registerListener(floater, "Inventory.EmptyTrash");
|
||||
(new LLDoCreateFloater())->registerListener(floater, "Inventory.DoCreate");
|
||||
// <edit>
|
||||
(new LLLoadInvCacheFloater())->registerListener(floater, "Inventory.LoadInvCache");
|
||||
// </edit>
|
||||
// <edit>
|
||||
(new LLLoadInvCacheFloater())->registerListener(floater, "Inventory.LoadInvCache");
|
||||
// </edit>
|
||||
|
||||
(new LLNewWindow())->registerListener(floater, "Inventory.NewWindow");
|
||||
(new LLShowFilters())->registerListener(floater, "Inventory.ShowFilters");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,135 +1,135 @@
|
||||
// <edit>
|
||||
#ifndef LL_LLINVENTORYBACKUP_H
|
||||
#define LL_LLINVENTORYBACKUP_H
|
||||
|
||||
#if LL_WINDOWS
|
||||
#define OS_SEP "\\"
|
||||
#else
|
||||
#define OS_SEP "/"
|
||||
#endif
|
||||
|
||||
|
||||
#include "llviewerinventory.h"
|
||||
#include "llfolderview.h"
|
||||
#include "llfilepicker.h"
|
||||
#include "llviewerimage.h"
|
||||
#include "llfloater.h"
|
||||
|
||||
|
||||
class LLInventoryBackupOrder
|
||||
{
|
||||
public:
|
||||
LLInventoryBackupOrder();
|
||||
|
||||
std::string mPath;
|
||||
std::vector<LLInventoryCategory*> mCats;
|
||||
std::vector<LLInventoryItem*> mItems;
|
||||
|
||||
bool mDownloadTextures;
|
||||
bool mDownloadSounds;
|
||||
bool mDownloadCallingCards;
|
||||
bool mDownloadLandmarks;
|
||||
bool mDownloadScripts;
|
||||
bool mDownloadWearables;
|
||||
bool mDownloadObjects;
|
||||
bool mDownloadNotecards;
|
||||
bool mDownloadAnimations;
|
||||
bool mDownloadGestures;
|
||||
//bool mDownloadOthers;
|
||||
};
|
||||
|
||||
class LLFloaterInventoryBackupSettings
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterInventoryBackupSettings(LLInventoryBackupOrder* order);
|
||||
BOOL postBuild(void);
|
||||
static void onClickNext(void* userdata);
|
||||
|
||||
LLInventoryBackupOrder* mOrder;
|
||||
virtual ~LLFloaterInventoryBackupSettings();
|
||||
};
|
||||
|
||||
class LLFloaterInventoryBackup
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterInventoryBackup(std::string path, std::vector<LLInventoryCategory*> cats, std::vector<LLInventoryItem*> items);
|
||||
BOOL postBuild(void);
|
||||
|
||||
std::string mPath;
|
||||
std::vector<LLInventoryCategory*> mCats;
|
||||
std::vector<LLInventoryItem*> mItems;
|
||||
std::vector<LLInventoryItem*>::iterator mItemIter;
|
||||
int mBusy;
|
||||
|
||||
static std::list<LLFloaterInventoryBackup*> sInstances;
|
||||
|
||||
private:
|
||||
virtual ~LLFloaterInventoryBackup();
|
||||
void setStatus(LLUUID itemid, std::string status);
|
||||
void finishItem(LLUUID itemid, std::string status);
|
||||
void advance();
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
|
||||
int mItemsTotal;
|
||||
int mItemsCompleted;
|
||||
|
||||
enum LIST_COLUMN_ORDER
|
||||
{
|
||||
LIST_TYPE,
|
||||
LIST_NAME,
|
||||
LIST_STATUS
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class LLInventoryBackup
|
||||
{
|
||||
public:
|
||||
static LLFilePicker::ESaveFilter getSaveFilter(LLInventoryItem* item);
|
||||
static std::string getExtension(LLInventoryItem* item);
|
||||
static std::string getUniqueFilename(std::string filename, std::string extension);
|
||||
static std::string getUniqueDirname(std::string dirname);
|
||||
static bool itemIsFolder(LLInventoryItem* item);
|
||||
static void save(LLFolderView* folder);
|
||||
static void download(LLInventoryItem* item, LLFloater* floater, loaded_callback_func onImage, LLGetAssetCallback onAsset);
|
||||
static std::string getPath(LLInventoryCategory* cat, std::vector<LLInventoryCategory*> cats);
|
||||
|
||||
struct callbackdata
|
||||
{
|
||||
LLFloater* floater;
|
||||
LLInventoryItem* item;
|
||||
};
|
||||
|
||||
private:
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
static void climb(LLInventoryCategory* cat,
|
||||
std::vector<LLInventoryCategory*>& cats,
|
||||
std::vector<LLInventoryItem*>& items);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
// <edit>
|
||||
#ifndef LL_LLINVENTORYBACKUP_H
|
||||
#define LL_LLINVENTORYBACKUP_H
|
||||
|
||||
#if LL_WINDOWS
|
||||
#define OS_SEP "\\"
|
||||
#else
|
||||
#define OS_SEP "/"
|
||||
#endif
|
||||
|
||||
|
||||
#include "llviewerinventory.h"
|
||||
#include "llfolderview.h"
|
||||
#include "llfilepicker.h"
|
||||
#include "llviewerimage.h"
|
||||
#include "llfloater.h"
|
||||
|
||||
|
||||
class LLInventoryBackupOrder
|
||||
{
|
||||
public:
|
||||
LLInventoryBackupOrder();
|
||||
|
||||
std::string mPath;
|
||||
std::vector<LLInventoryCategory*> mCats;
|
||||
std::vector<LLInventoryItem*> mItems;
|
||||
|
||||
bool mDownloadTextures;
|
||||
bool mDownloadSounds;
|
||||
bool mDownloadCallingCards;
|
||||
bool mDownloadLandmarks;
|
||||
bool mDownloadScripts;
|
||||
bool mDownloadWearables;
|
||||
bool mDownloadObjects;
|
||||
bool mDownloadNotecards;
|
||||
bool mDownloadAnimations;
|
||||
bool mDownloadGestures;
|
||||
//bool mDownloadOthers;
|
||||
};
|
||||
|
||||
class LLFloaterInventoryBackupSettings
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterInventoryBackupSettings(LLInventoryBackupOrder* order);
|
||||
BOOL postBuild(void);
|
||||
static void onClickNext(void* userdata);
|
||||
|
||||
LLInventoryBackupOrder* mOrder;
|
||||
virtual ~LLFloaterInventoryBackupSettings();
|
||||
};
|
||||
|
||||
class LLFloaterInventoryBackup
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterInventoryBackup(std::string path, std::vector<LLInventoryCategory*> cats, std::vector<LLInventoryItem*> items);
|
||||
BOOL postBuild(void);
|
||||
|
||||
std::string mPath;
|
||||
std::vector<LLInventoryCategory*> mCats;
|
||||
std::vector<LLInventoryItem*> mItems;
|
||||
std::vector<LLInventoryItem*>::iterator mItemIter;
|
||||
int mBusy;
|
||||
|
||||
static std::list<LLFloaterInventoryBackup*> sInstances;
|
||||
|
||||
private:
|
||||
virtual ~LLFloaterInventoryBackup();
|
||||
void setStatus(LLUUID itemid, std::string status);
|
||||
void finishItem(LLUUID itemid, std::string status);
|
||||
void advance();
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
|
||||
int mItemsTotal;
|
||||
int mItemsCompleted;
|
||||
|
||||
enum LIST_COLUMN_ORDER
|
||||
{
|
||||
LIST_TYPE,
|
||||
LIST_NAME,
|
||||
LIST_STATUS
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class LLInventoryBackup
|
||||
{
|
||||
public:
|
||||
static LLFilePicker::ESaveFilter getSaveFilter(LLInventoryItem* item);
|
||||
static std::string getExtension(LLInventoryItem* item);
|
||||
static std::string getUniqueFilename(std::string filename, std::string extension);
|
||||
static std::string getUniqueDirname(std::string dirname);
|
||||
static bool itemIsFolder(LLInventoryItem* item);
|
||||
static void save(LLFolderView* folder);
|
||||
static void download(LLInventoryItem* item, LLFloater* floater, loaded_callback_func onImage, LLGetAssetCallback onAsset);
|
||||
static std::string getPath(LLInventoryCategory* cat, std::vector<LLInventoryCategory*> cats);
|
||||
|
||||
struct callbackdata
|
||||
{
|
||||
LLFloater* floater;
|
||||
LLInventoryItem* item;
|
||||
};
|
||||
|
||||
private:
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
static void climb(LLInventoryCategory* cat,
|
||||
std::vector<LLInventoryCategory*>& cats,
|
||||
std::vector<LLInventoryItem*>& items);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
|
||||
@@ -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("Rez"));
|
||||
items.push_back(std::string("Open With..."));
|
||||
// for now, disable reupload
|
||||
//if(getInventoryType() == LLInventoryType::IT_ANIMATION)
|
||||
//{
|
||||
// items.push_back(std::string("Reupload..."));
|
||||
//}
|
||||
items.push_back(std::string("Save As..."));
|
||||
items.push_back(std::string("Save InvCache..."));
|
||||
// </edit>
|
||||
// for now, disable reupload
|
||||
//if(getInventoryType() == LLInventoryType::IT_ANIMATION)
|
||||
//{
|
||||
// items.push_back(std::string("Reupload..."));
|
||||
//}
|
||||
items.push_back(std::string("Save As..."));
|
||||
items.push_back(std::string("Save InvCache..."));
|
||||
// </edit>
|
||||
|
||||
items.push_back(std::string("Copy Separator"));
|
||||
|
||||
@@ -955,98 +955,98 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model,
|
||||
return;
|
||||
}
|
||||
// <edit>
|
||||
else if("open hex" == action)
|
||||
{
|
||||
LLInventoryItem* item = model->getItem(mUUID);
|
||||
if(!item) return;
|
||||
DOFloaterHex::show(mUUID);
|
||||
}
|
||||
else if("open hex" == action)
|
||||
{
|
||||
LLInventoryItem* item = model->getItem(mUUID);
|
||||
if(!item) return;
|
||||
DOFloaterHex::show(mUUID);
|
||||
}
|
||||
else if("open text" == action)
|
||||
{
|
||||
LLInventoryItem* item = model->getItem(mUUID);
|
||||
if(!item) return;
|
||||
HGFloaterTextEditor::show(mUUID);
|
||||
}
|
||||
else if ("rez" == action)
|
||||
{
|
||||
LLInventoryItem* item = model->getItem(mUUID);
|
||||
if(!item) return;
|
||||
LLViewerRegion* regionp = gAgent.getRegion();
|
||||
if (!regionp)
|
||||
{
|
||||
llwarns << "Couldn't find region to rez object" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
//llinfos << "Rezzing object" << llendl;
|
||||
make_ui_sound("UISndObjectRezIn");
|
||||
|
||||
if (regionp
|
||||
&& (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
|
||||
{
|
||||
LLFirstUse::useSandbox();
|
||||
}
|
||||
|
||||
BOOL remove_from_inventory = !item->getPermissions().allowCopyBy(gAgent.getID());
|
||||
|
||||
LLVector3 rezpos = gAgent.getPositionAgent() + (gAgent.getAtAxis() * 5.0f);
|
||||
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessageFast(_PREHASH_RezObject);
|
||||
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
|
||||
|
||||
msg->nextBlock("RezData");
|
||||
// if it's being rezzed from task inventory, we need to enable
|
||||
// saving it back into the task inventory.
|
||||
// *FIX: We can probably compress this to a single byte, since I
|
||||
// think folderid == mSourceID. This will be a later
|
||||
// optimization.
|
||||
msg->addUUIDFast(_PREHASH_FromTaskID, LLUUID::null);
|
||||
msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE);
|
||||
msg->addVector3Fast(_PREHASH_RayStart, rezpos);
|
||||
msg->addVector3Fast(_PREHASH_RayEnd, rezpos);
|
||||
msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
|
||||
msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE);
|
||||
msg->addBOOLFast(_PREHASH_RezSelected, true);
|
||||
msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory);
|
||||
|
||||
// deal with permissions slam logic
|
||||
pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
|
||||
|
||||
LLUUID folder_id = item->getParentUUID();
|
||||
msg->nextBlockFast(_PREHASH_InventoryData);
|
||||
item->packMessage(msg);
|
||||
|
||||
msg->sendReliable(regionp->getHost());
|
||||
}
|
||||
else if("reupload" == action)
|
||||
{
|
||||
LLInventoryItem* item = model->getItem(mUUID);
|
||||
if(!item) return;
|
||||
|
||||
LLFilePicker& picker = LLFilePicker::instance();
|
||||
std::string filename;
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
if(!picker.getOpenFile(LLFilePicker::FFLOAD_IMAGE))
|
||||
return;
|
||||
filename = picker.getFirstFile();
|
||||
if(!filename.empty())
|
||||
{
|
||||
LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filename, item);
|
||||
LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ("rez" == action)
|
||||
{
|
||||
LLInventoryItem* item = model->getItem(mUUID);
|
||||
if(!item) return;
|
||||
LLViewerRegion* regionp = gAgent.getRegion();
|
||||
if (!regionp)
|
||||
{
|
||||
llwarns << "Couldn't find region to rez object" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
//llinfos << "Rezzing object" << llendl;
|
||||
make_ui_sound("UISndObjectRezIn");
|
||||
|
||||
if (regionp
|
||||
&& (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
|
||||
{
|
||||
LLFirstUse::useSandbox();
|
||||
}
|
||||
|
||||
BOOL remove_from_inventory = !item->getPermissions().allowCopyBy(gAgent.getID());
|
||||
|
||||
LLVector3 rezpos = gAgent.getPositionAgent() + (gAgent.getAtAxis() * 5.0f);
|
||||
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessageFast(_PREHASH_RezObject);
|
||||
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
|
||||
|
||||
msg->nextBlock("RezData");
|
||||
// if it's being rezzed from task inventory, we need to enable
|
||||
// saving it back into the task inventory.
|
||||
// *FIX: We can probably compress this to a single byte, since I
|
||||
// think folderid == mSourceID. This will be a later
|
||||
// optimization.
|
||||
msg->addUUIDFast(_PREHASH_FromTaskID, LLUUID::null);
|
||||
msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE);
|
||||
msg->addVector3Fast(_PREHASH_RayStart, rezpos);
|
||||
msg->addVector3Fast(_PREHASH_RayEnd, rezpos);
|
||||
msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
|
||||
msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE);
|
||||
msg->addBOOLFast(_PREHASH_RezSelected, true);
|
||||
msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory);
|
||||
|
||||
// deal with permissions slam logic
|
||||
pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
|
||||
|
||||
LLUUID folder_id = item->getParentUUID();
|
||||
msg->nextBlockFast(_PREHASH_InventoryData);
|
||||
item->packMessage(msg);
|
||||
|
||||
msg->sendReliable(regionp->getHost());
|
||||
}
|
||||
else if("reupload" == action)
|
||||
{
|
||||
LLInventoryItem* item = model->getItem(mUUID);
|
||||
if(!item) return;
|
||||
|
||||
LLFilePicker& picker = LLFilePicker::instance();
|
||||
std::string filename;
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
if(!picker.getOpenFile(LLFilePicker::FFLOAD_IMAGE))
|
||||
return;
|
||||
filename = picker.getFirstFile();
|
||||
if(!filename.empty())
|
||||
{
|
||||
LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filename, item);
|
||||
LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
|
||||
|
||||
@@ -59,12 +59,12 @@
|
||||
#include "message.h"
|
||||
#include "raytrace.h"
|
||||
#include "llsdserialize.h"
|
||||
// <edit>
|
||||
#include "lllocalinventory.h"
|
||||
#include "llfloaterimport.h"
|
||||
#include "llfloaterexport.h"
|
||||
#include "llfloaterexploreanimations.h"
|
||||
// </edit>
|
||||
// <edit>
|
||||
#include "lllocalinventory.h"
|
||||
#include "llfloaterimport.h"
|
||||
#include "llfloaterexport.h"
|
||||
#include "llfloaterexploreanimations.h"
|
||||
// </edit>
|
||||
#include "lltimer.h"
|
||||
#include "llvfile.h"
|
||||
#include "llvolumemgr.h"
|
||||
@@ -228,11 +228,11 @@
|
||||
|
||||
#include "lltexlayer.h"
|
||||
|
||||
// <edit>
|
||||
// <edit>
|
||||
#include "dofloaterhex.h"
|
||||
#include "hgfloatertexteditor.h"
|
||||
#include "llfloatermessagelog.h"
|
||||
#include "llfloatermessagebuilder.h"
|
||||
#include "llfloatermessagebuilder.h"
|
||||
// </edit>
|
||||
|
||||
using namespace LLVOAvatarDefines;
|
||||
@@ -394,12 +394,12 @@ void handle_god_mode(void*);
|
||||
// God menu
|
||||
void handle_leave_god_mode(void*);
|
||||
|
||||
// <edit>
|
||||
// <edit>
|
||||
void handle_close_all_notifications(void*);
|
||||
void handle_reopen_with_hex_editor(void*);
|
||||
void handle_open_message_log(void*);
|
||||
void handle_open_message_builder(void*);
|
||||
// </edit>
|
||||
void handle_open_message_builder(void*);
|
||||
// </edit>
|
||||
|
||||
BOOL is_inventory_visible( void* user_data );
|
||||
void handle_reset_view();
|
||||
@@ -862,9 +862,9 @@ void init_client_menu(LLMenuGL* menu)
|
||||
|
||||
|
||||
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
|
||||
// <edit>
|
||||
//if (!LLViewerLogin::getInstance()->isInProductionGrid())
|
||||
// </edit>
|
||||
// <edit>
|
||||
//if (!LLViewerLogin::getInstance()->isInProductionGrid())
|
||||
// </edit>
|
||||
{
|
||||
menu->append(new LLMenuItemCheckGL("Hacked Godmode",
|
||||
&handle_toggle_hacked_godmode,
|
||||
@@ -1034,12 +1034,12 @@ void init_client_menu(LLMenuGL* menu)
|
||||
menu->append(new LLMenuItemCallGL("Leave Admin Status",
|
||||
&handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL));
|
||||
|
||||
// <edit>
|
||||
// <edit>
|
||||
menu->appendSeparator();
|
||||
menu->append(new LLMenuItemCallGL( "Close All Dialogs",
|
||||
&handle_close_all_notifications, NULL, NULL, 'D', MASK_CONTROL | MASK_ALT | MASK_SHIFT));
|
||||
menu->append(new LLMenuItemCallGL( "Close All Dialogs",
|
||||
&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));
|
||||
|
||||
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("Edit UI...", LLFloaterEditUI::show));
|
||||
menu->append(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml));
|
||||
// <edit>
|
||||
//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));
|
||||
// </edit>
|
||||
// <edit>
|
||||
//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));
|
||||
// </edit>
|
||||
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));
|
||||
@@ -1462,14 +1462,14 @@ void init_debug_avatar_menu(LLMenuGL* menu)
|
||||
menu->append(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation));
|
||||
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 ));
|
||||
// <edit>
|
||||
//#ifndef LL_RELEASE_FOR_DOWNLOAD
|
||||
// </edit>
|
||||
// <edit>
|
||||
//#ifndef LL_RELEASE_FOR_DOWNLOAD
|
||||
// </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("Dump Local Textures", handle_dump_avatar_local_textures, NULL, NULL, 'M', MASK_SHIFT|MASK_ALT ));
|
||||
// <edit>
|
||||
//#endif
|
||||
// </edit>
|
||||
// <edit>
|
||||
//#endif
|
||||
// </edit>
|
||||
menu->createJumpKeys();
|
||||
}
|
||||
|
||||
@@ -2194,125 +2194,125 @@ class LLObjectMute : public view_listener_t
|
||||
}
|
||||
};
|
||||
|
||||
// <edit>
|
||||
class LLObjectEnableCopyUUID : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectCopyUUID : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
if(object)
|
||||
{
|
||||
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(object->getID().asString()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectEnableSaveAs : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectSaveAs : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLFloaterExport* floater = new LLFloaterExport();
|
||||
floater->center();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectEnableImport : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
if(object)
|
||||
{
|
||||
if(!object->permCopy())
|
||||
new_value = false;
|
||||
else if(!object->permModify())
|
||||
new_value = false;
|
||||
else if(!object->permMove())
|
||||
new_value = false;
|
||||
else if(object->numChildren() != 0)
|
||||
new_value = false;
|
||||
else if(object->getParent())
|
||||
new_value = false;
|
||||
}
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectImport : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
if(object)
|
||||
{
|
||||
if(!object->permCopy())
|
||||
new_value = false;
|
||||
else if(!object->permModify())
|
||||
new_value = false;
|
||||
else if(!object->permMove())
|
||||
new_value = false;
|
||||
else if(object->numChildren() != 0)
|
||||
new_value = false;
|
||||
else if(object->getParent())
|
||||
new_value = false;
|
||||
}
|
||||
if(new_value == false) return true;
|
||||
|
||||
LLFilePicker& picker = LLFilePicker::instance();
|
||||
if (!picker.getOpenFile(LLFilePicker::FFLOAD_XML))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
std::string file_name = picker.getFirstFile();
|
||||
LLXmlImportOptions* options = new LLXmlImportOptions(file_name);
|
||||
options->mSupplier = object;
|
||||
new LLFloaterXmlImportOptions(options);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLAvatarAnims : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
|
||||
if(avatar)
|
||||
{
|
||||
new LLFloaterExploreAnimations(avatar->getID()); //temporary
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// <edit>
|
||||
class LLObjectEnableCopyUUID : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectCopyUUID : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
if(object)
|
||||
{
|
||||
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(object->getID().asString()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectEnableSaveAs : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectSaveAs : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLFloaterExport* floater = new LLFloaterExport();
|
||||
floater->center();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectEnableImport : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
if(object)
|
||||
{
|
||||
if(!object->permCopy())
|
||||
new_value = false;
|
||||
else if(!object->permModify())
|
||||
new_value = false;
|
||||
else if(!object->permMove())
|
||||
new_value = false;
|
||||
else if(object->numChildren() != 0)
|
||||
new_value = false;
|
||||
else if(object->getParent())
|
||||
new_value = false;
|
||||
}
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectImport : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
if(object)
|
||||
{
|
||||
if(!object->permCopy())
|
||||
new_value = false;
|
||||
else if(!object->permModify())
|
||||
new_value = false;
|
||||
else if(!object->permMove())
|
||||
new_value = false;
|
||||
else if(object->numChildren() != 0)
|
||||
new_value = false;
|
||||
else if(object->getParent())
|
||||
new_value = false;
|
||||
}
|
||||
if(new_value == false) return true;
|
||||
|
||||
LLFilePicker& picker = LLFilePicker::instance();
|
||||
if (!picker.getOpenFile(LLFilePicker::FFLOAD_XML))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
std::string file_name = picker.getFirstFile();
|
||||
LLXmlImportOptions* options = new LLXmlImportOptions(file_name);
|
||||
options->mSupplier = object;
|
||||
new LLFloaterXmlImportOptions(options);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLAvatarAnims : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
|
||||
if(avatar)
|
||||
{
|
||||
new LLFloaterExploreAnimations(avatar->getID()); //temporary
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// </edit>
|
||||
|
||||
|
||||
bool handle_go_to()
|
||||
{
|
||||
LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal;
|
||||
@@ -3191,10 +3191,10 @@ bool handle_sit_or_stand()
|
||||
{
|
||||
LLPickInfo pick = LLToolPie::getInstance()->getPick();
|
||||
LLViewerObject *object = pick.getObject();;
|
||||
// <edit>
|
||||
//if (!object || pick.mPickType == LLPickInfo::PICK_FLORA)
|
||||
if (!object)
|
||||
// </edit>
|
||||
// <edit>
|
||||
//if (!object || pick.mPickType == LLPickInfo::PICK_FLORA)
|
||||
if (!object)
|
||||
// </edit>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -3799,12 +3799,12 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
|
||||
break;
|
||||
|
||||
default:
|
||||
// <edit>
|
||||
//if((node->mPermissions->allowTransferTo(gAgent.getID())
|
||||
// && object->permCopy())
|
||||
// || gAgent.isGodlike())
|
||||
if(1)
|
||||
// </edit>
|
||||
// <edit>
|
||||
//if((node->mPermissions->allowTransferTo(gAgent.getID())
|
||||
// && object->permCopy())
|
||||
// || gAgent.isGodlike())
|
||||
if(1)
|
||||
// </edit>
|
||||
{
|
||||
can_derez_current = TRUE;
|
||||
}
|
||||
@@ -3861,17 +3861,17 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
|
||||
LLViewerObject* object = derez_objects.get(object_index++);
|
||||
msg->nextBlockFast(_PREHASH_ObjectData);
|
||||
msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
|
||||
// <edit>
|
||||
if(!gSavedSettings.getBOOL("DisablePointAtAndBeam"))
|
||||
{
|
||||
// </edit>
|
||||
// <edit>
|
||||
if(!gSavedSettings.getBOOL("DisablePointAtAndBeam"))
|
||||
{
|
||||
// </edit>
|
||||
// VEFFECT: DerezObject
|
||||
LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
|
||||
effectp->setPositionGlobal(object->getPositionGlobal());
|
||||
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
|
||||
// <edit>
|
||||
}
|
||||
// </edit>
|
||||
// <edit>
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
msg->sendReliable(first_region->getHost());
|
||||
}
|
||||
@@ -4359,20 +4359,20 @@ BOOL sitting_on_selection()
|
||||
return (avatar->mIsSitting && avatar->getRoot() == root_object);
|
||||
}
|
||||
|
||||
class LLToolsSaveToInventory : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
// <edit>
|
||||
//if(enable_save_into_inventory(NULL))
|
||||
if(1)
|
||||
// </edit>
|
||||
{
|
||||
derez_objects(DRD_SAVE_INTO_AGENT_INVENTORY, LLUUID::null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
class LLToolsSaveToInventory : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
// <edit>
|
||||
//if(enable_save_into_inventory(NULL))
|
||||
if(1)
|
||||
// </edit>
|
||||
{
|
||||
derez_objects(DRD_SAVE_INTO_AGENT_INVENTORY, LLUUID::null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
class LLToolsSaveToObjectInventory : public view_listener_t
|
||||
{
|
||||
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 is_wearable = object_selected_and_point_valid(NULL);
|
||||
// <edit> Don't allow attaching objects while importing attachments
|
||||
if(LLXmlImport::sImportInProgress && LLXmlImport::sImportHasAttachments)
|
||||
is_wearable = false;
|
||||
// </edit>
|
||||
// <edit> Don't allow attaching objects while importing attachments
|
||||
if(LLXmlImport::sImportInProgress && LLXmlImport::sImportHasAttachments)
|
||||
is_wearable = false;
|
||||
// </edit>
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(is_wearable);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -6542,10 +6542,10 @@ class LLToolsSelectedScriptAction : public view_listener_t
|
||||
|
||||
void handle_selected_texture_info(void*)
|
||||
{
|
||||
// <edit>
|
||||
std::map<LLUUID, bool> unique_textures;
|
||||
S32 total_memory = 0;
|
||||
// </edit>
|
||||
// <edit>
|
||||
std::map<LLUUID, bool> unique_textures;
|
||||
S32 total_memory = 0;
|
||||
// </edit>
|
||||
for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
|
||||
iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
|
||||
{
|
||||
@@ -6568,33 +6568,33 @@ void handle_selected_texture_info(void*)
|
||||
LLViewerImage* img = node->getObject()->getTEImage(i);
|
||||
LLUUID image_id = img->getID();
|
||||
faces_per_texture[image_id].push_back(i);
|
||||
// <edit>
|
||||
if(!unique_textures[image_id])
|
||||
{
|
||||
unique_textures[image_id] = true;
|
||||
total_memory += (img->getWidth() * img->getHeight() * img->getComponents());
|
||||
}
|
||||
// </edit>
|
||||
// <edit>
|
||||
if(!unique_textures[image_id])
|
||||
{
|
||||
unique_textures[image_id] = true;
|
||||
total_memory += (img->getWidth() * img->getHeight() * img->getComponents());
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
// Per-texture, dump which faces are using it.
|
||||
map_t::iterator it;
|
||||
for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it)
|
||||
{
|
||||
LLUUID image_id = it->first;
|
||||
// <edit>
|
||||
std::string uuid_str;
|
||||
image_id.toString(uuid_str);
|
||||
// </edit>
|
||||
// <edit>
|
||||
std::string uuid_str;
|
||||
image_id.toString(uuid_str);
|
||||
// </edit>
|
||||
U8 te = it->second[0];
|
||||
LLViewerImage* img = node->getObject()->getTEImage(te);
|
||||
S32 height = img->getHeight();
|
||||
S32 width = img->getWidth();
|
||||
S32 components = img->getComponents();
|
||||
// <edit>
|
||||
//msg = llformat("%dx%d %s on face ",
|
||||
msg = llformat("%s, %dx%d %s on face ",
|
||||
uuid_str.c_str(),
|
||||
// </edit>
|
||||
// <edit>
|
||||
//msg = llformat("%dx%d %s on face ",
|
||||
msg = llformat("%s, %dx%d %s on face ",
|
||||
uuid_str.c_str(),
|
||||
// </edit>
|
||||
width,
|
||||
height,
|
||||
(components == 4 ? "alpha" : "opaque"));
|
||||
@@ -6605,41 +6605,41 @@ void handle_selected_texture_info(void*)
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
}
|
||||
// <edit>
|
||||
if(node->getObject()->isSculpted())
|
||||
{
|
||||
LLSculptParams *sculpt_params = (LLSculptParams *)(node->getObject()->getParameterEntry(LLNetworkData::PARAMS_SCULPT));
|
||||
LLUUID sculpt_id = sculpt_params->getSculptTexture();
|
||||
std::string uuid_str;
|
||||
sculpt_id.toString(uuid_str);
|
||||
msg.assign("Sculpt texture: ");
|
||||
msg.append(uuid_str.c_str());
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
|
||||
unique_textures[sculpt_id] = true;
|
||||
// <edit>
|
||||
if(node->getObject()->isSculpted())
|
||||
{
|
||||
LLSculptParams *sculpt_params = (LLSculptParams *)(node->getObject()->getParameterEntry(LLNetworkData::PARAMS_SCULPT));
|
||||
LLUUID sculpt_id = sculpt_params->getSculptTexture();
|
||||
std::string uuid_str;
|
||||
sculpt_id.toString(uuid_str);
|
||||
msg.assign("Sculpt texture: ");
|
||||
msg.append(uuid_str.c_str());
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
|
||||
unique_textures[sculpt_id] = true;
|
||||
}
|
||||
if(node->getObject()->isParticleSource())
|
||||
{
|
||||
//LLUUID particle_id = node->getObject()->mPartSourcep->getImage()->getID();
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
// <edit>
|
||||
typedef std::map<LLUUID, bool>::iterator map_iter;
|
||||
for(map_iter i = unique_textures.begin(); i != unique_textures.end(); ++i)
|
||||
{
|
||||
LLUUID asset_id = (*i).first;
|
||||
LLLocalInventory::addItem(asset_id.asString(), (int)LLAssetType::AT_TEXTURE, asset_id, true);
|
||||
}
|
||||
|
||||
// Show total widthxheight
|
||||
F32 memoriez = (F32)total_memory;
|
||||
memoriez = memoriez / 1000000;
|
||||
std::string msg = llformat("Total uncompressed: %f MB", memoriez);
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
// </edit>
|
||||
if(node->getObject()->isParticleSource())
|
||||
{
|
||||
//LLUUID particle_id = node->getObject()->mPartSourcep->getImage()->getID();
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
// <edit>
|
||||
typedef std::map<LLUUID, bool>::iterator map_iter;
|
||||
for(map_iter i = unique_textures.begin(); i != unique_textures.end(); ++i)
|
||||
{
|
||||
LLUUID asset_id = (*i).first;
|
||||
LLLocalInventory::addItem(asset_id.asString(), (int)LLAssetType::AT_TEXTURE, asset_id, true);
|
||||
}
|
||||
|
||||
// Show total widthxheight
|
||||
F32 memoriez = (F32)total_memory;
|
||||
memoriez = memoriez / 1000000;
|
||||
std::string msg = llformat("Total uncompressed: %f MB", memoriez);
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
// </edit>
|
||||
}
|
||||
|
||||
void handle_dump_image_list(void*)
|
||||
@@ -6872,25 +6872,25 @@ class LLToolsEnableTakeCopy : public view_listener_t
|
||||
}
|
||||
};
|
||||
|
||||
// <edit>
|
||||
class LLToolsEnableAdminDelete : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
return (object != NULL);
|
||||
}
|
||||
};
|
||||
class LLToolsAdminDelete : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLSelectMgr::getInstance()->selectForceDelete();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// <edit>
|
||||
class LLToolsEnableAdminDelete : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
return (object != NULL);
|
||||
}
|
||||
};
|
||||
class LLToolsAdminDelete : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLSelectMgr::getInstance()->selectForceDelete();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// </edit>
|
||||
|
||||
|
||||
BOOL enable_selection_you_own_all(void*)
|
||||
{
|
||||
if (LLSelectMgr::getInstance())
|
||||
@@ -8132,11 +8132,11 @@ void initialize_menus()
|
||||
addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection");
|
||||
addMenu(new LLToolsBuyOrTake(), "Tools.BuyOrTake");
|
||||
addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy");
|
||||
addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy");
|
||||
// <edit>
|
||||
addMenu(new LLToolsEnableAdminDelete(), "Tools.EnableAdminDelete");
|
||||
addMenu(new LLToolsAdminDelete(), "Tools.AdminDelete");
|
||||
// </edit>
|
||||
addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy");
|
||||
// <edit>
|
||||
addMenu(new LLToolsEnableAdminDelete(), "Tools.EnableAdminDelete");
|
||||
addMenu(new LLToolsAdminDelete(), "Tools.AdminDelete");
|
||||
// </edit>
|
||||
addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory");
|
||||
addMenu(new LLToolsSelectedScriptAction(), "Tools.SelectedScriptAction");
|
||||
|
||||
@@ -8187,11 +8187,11 @@ void initialize_menus()
|
||||
addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar");
|
||||
addMenu(new LLObjectReturn(), "Object.Return");
|
||||
addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
|
||||
addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
|
||||
// <edit>
|
||||
addMenu(new LLObjectSaveAs(), "Object.SaveAs");
|
||||
addMenu(new LLObjectImport(), "Object.Import");
|
||||
// </edit>
|
||||
addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
|
||||
// <edit>
|
||||
addMenu(new LLObjectSaveAs(), "Object.SaveAs");
|
||||
addMenu(new LLObjectImport(), "Object.Import");
|
||||
// </edit>
|
||||
addMenu(new LLObjectMute(), "Object.Mute");
|
||||
addMenu(new LLObjectBuy(), "Object.Buy");
|
||||
addMenu(new LLObjectEdit(), "Object.Edit");
|
||||
@@ -8204,10 +8204,10 @@ void initialize_menus()
|
||||
addMenu(new LLObjectEnableWear(), "Object.EnableWear");
|
||||
addMenu(new LLObjectEnableReturn(), "Object.EnableReturn");
|
||||
addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse");
|
||||
// <edit>
|
||||
addMenu(new LLObjectEnableSaveAs(), "Object.EnableSaveAs");
|
||||
addMenu(new LLObjectEnableImport(), "Object.EnableImport");
|
||||
// </edit>
|
||||
// <edit>
|
||||
addMenu(new LLObjectEnableSaveAs(), "Object.EnableSaveAs");
|
||||
addMenu(new LLObjectEnableImport(), "Object.EnableImport");
|
||||
// </edit>
|
||||
addMenu(new LLObjectEnableMute(), "Object.EnableMute");
|
||||
addMenu(new LLObjectEnableBuy(), "Object.EnableBuy");
|
||||
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
<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"
|
||||
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="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"/>
|
||||
|
||||
@@ -146,10 +146,10 @@
|
||||
<on_click filter="" function="Inventory.DoCreate" userdata="eyes" />
|
||||
</menu_item_call>
|
||||
</menu>
|
||||
<menu_item_call bottom_delta="-18" height="18" label="New Pretend Item" left="0" mouse_opaque="true"
|
||||
name="New Pretend Item" width="118">
|
||||
<on_click filter="" function="Inventory.DoCreate" userdata="pretend" />
|
||||
</menu_item_call>
|
||||
<menu_item_call bottom_delta="-18" height="18" label="New Pretend Item" left="0" mouse_opaque="true"
|
||||
name="New Pretend Item" width="118">
|
||||
<on_click filter="" function="Inventory.DoCreate" userdata="pretend" />
|
||||
</menu_item_call>
|
||||
</menu>
|
||||
<menu bottom_delta="64" drop_shadow="true" height="49"
|
||||
label="Sort" left="0" mouse_opaque="false" name="Sort" opaque="true"
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<name_editor bevel_style="in" border_style="line"
|
||||
border_thickness="1" bottom="-24" enabled="false" follows="left|top"
|
||||
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" />
|
||||
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom="-48" drop_shadow_visible="true" follows="left|top"
|
||||
@@ -110,6 +110,14 @@
|
||||
width="121">
|
||||
[FIRST] [LAST]
|
||||
</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"
|
||||
bottom="-68" drop_shadow_visible="true" follows="left|top"
|
||||
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=""
|
||||
left="70" mouse_opaque="true" name="img"
|
||||
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"
|
||||
bottom="-203" drop_shadow_visible="true" follows="left|top"
|
||||
font="SansSerifSmall" h_pad="0" halign="right" height="16" left="4"
|
||||
|
||||
2328
scripts/install.py
2328
scripts/install.py
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user