add extended item properties editor / viewer as per reaper's request
This commit is contained in:
@@ -59,6 +59,10 @@
|
|||||||
|
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
|
|
||||||
|
// <edit>
|
||||||
|
#include "llclipboard.h"
|
||||||
|
// </edit>
|
||||||
|
|
||||||
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Class LLPropertiesObserver
|
// Class LLPropertiesObserver
|
||||||
@@ -156,6 +160,9 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect&
|
|||||||
mItemID(item_id),
|
mItemID(item_id),
|
||||||
mObjectID(object_id),
|
mObjectID(object_id),
|
||||||
mDirty(TRUE)
|
mDirty(TRUE)
|
||||||
|
// <edit>
|
||||||
|
, mExpanded(FALSE)
|
||||||
|
// </edit>
|
||||||
{
|
{
|
||||||
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml");
|
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml");
|
||||||
|
|
||||||
@@ -194,6 +201,13 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect&
|
|||||||
childSetCommitCallback("RadioSaleType",&onCommitSaleType, this);
|
childSetCommitCallback("RadioSaleType",&onCommitSaleType, this);
|
||||||
// "Price" label for edit
|
// "Price" label for edit
|
||||||
childSetCommitCallback("EditPrice",&onCommitSaleInfo, this);
|
childSetCommitCallback("EditPrice",&onCommitSaleInfo, this);
|
||||||
|
// <edit>
|
||||||
|
childSetAction("more_btn", &onClickMore, this);
|
||||||
|
childSetAction("less_btn", &onClickLess, this);
|
||||||
|
childSetAction("copy_btn", &onClickCopy, this);
|
||||||
|
childSetAction("update_btn", &onClickUpdate, this);
|
||||||
|
setExpanded(mExpanded);
|
||||||
|
// </edit>
|
||||||
// The UI has been built, now fill in all the values
|
// The UI has been built, now fill in all the values
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
@@ -280,6 +294,28 @@ void LLFloaterProperties::draw()
|
|||||||
|
|
||||||
void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
|
void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
|
||||||
{
|
{
|
||||||
|
// <edit>
|
||||||
|
childSetText("EditItemID", item->getUUID().asString());
|
||||||
|
childSetText("EditFolderID", item->getParentUUID().asString());
|
||||||
|
childSetText("EditGroup", item->getPermissions().getGroup().asString());
|
||||||
|
childSetText("EditAssetID", item->getAssetUUID().asString());
|
||||||
|
|
||||||
|
std::string type_str = LLAssetType::lookup(item->getType());
|
||||||
|
if(type_str.c_str() == NULL) type_str = llformat("%d", item->getType());
|
||||||
|
childSetText("EditType", type_str);
|
||||||
|
|
||||||
|
std::string invtype_str = LLInventoryType::lookup(item->getInventoryType());
|
||||||
|
if(invtype_str.c_str() == NULL) invtype_str = llformat("%d", item->getInventoryType());
|
||||||
|
childSetText("EditInvType", invtype_str);
|
||||||
|
childSetText("EditFlags", llformat("%d", item->getFlags()));
|
||||||
|
|
||||||
|
std::ostringstream strm;
|
||||||
|
item->exportLegacyStream(strm, TRUE);
|
||||||
|
std::string str(strm.str());
|
||||||
|
LLStringUtil::replaceTabsWithSpaces(str, 4);
|
||||||
|
childSetText("item_text", str);
|
||||||
|
// </edit>
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// PERMISSIONS LOOKUP //
|
// PERMISSIONS LOOKUP //
|
||||||
////////////////////////
|
////////////////////////
|
||||||
@@ -944,14 +980,163 @@ void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// <edit>
|
||||||
|
void LLFloaterProperties::onClickMore(void* user_data)
|
||||||
|
{
|
||||||
|
LLFloaterProperties* floaterp = (LLFloaterProperties*)user_data;
|
||||||
|
if(floaterp)
|
||||||
|
{
|
||||||
|
LLMultiProperties* host = (LLMultiProperties*)floaterp->getHost();
|
||||||
|
if(host)
|
||||||
|
host->setExpanded(TRUE);
|
||||||
|
else
|
||||||
|
floaterp->setExpanded(TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLFloaterProperties::onClickLess(void* user_data)
|
||||||
|
{
|
||||||
|
LLFloaterProperties* floaterp = (LLFloaterProperties*)user_data;
|
||||||
|
if(floaterp)
|
||||||
|
{
|
||||||
|
LLMultiProperties* host = (LLMultiProperties*)floaterp->getHost();
|
||||||
|
if(host)
|
||||||
|
host->setExpanded(FALSE);
|
||||||
|
else
|
||||||
|
floaterp->setExpanded(FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLFloaterProperties::setExpanded(BOOL expanded)
|
||||||
|
{
|
||||||
|
mExpanded = expanded;
|
||||||
|
LLRect rect = getRect();
|
||||||
|
if(expanded)
|
||||||
|
rect.setOriginAndSize(rect.mLeft, rect.mBottom, 800, rect.getHeight());
|
||||||
|
else
|
||||||
|
rect.setOriginAndSize(rect.mLeft, rect.mBottom, 350, rect.getHeight());
|
||||||
|
setRect(rect);
|
||||||
|
childSetVisible("more_btn", !mExpanded);
|
||||||
|
childSetVisible("less_btn", mExpanded);
|
||||||
|
childSetVisible("item_text", mExpanded);
|
||||||
|
childSetVisible("copy_btn", mExpanded);
|
||||||
|
childSetVisible("update_btn", mExpanded);
|
||||||
|
if(getHost())
|
||||||
|
setCanTearOff(!expanded); // idk why it comes out ugly if expanded
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void LLFloaterProperties::onClickCopy(void* user_data)
|
||||||
|
{
|
||||||
|
LLFloaterProperties* floaterp = (LLFloaterProperties*)user_data;
|
||||||
|
if(floaterp)
|
||||||
|
{
|
||||||
|
LLViewerInventoryItem* item = (LLViewerInventoryItem*)floaterp->findItem();
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
std::string str(floaterp->childGetValue("item_text").asString());
|
||||||
|
std::string::size_type pos;
|
||||||
|
while((pos = str.find(" ")) != std::string::npos)
|
||||||
|
{
|
||||||
|
str.replace(pos, 4, "\t");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::istringstream strm(str);
|
||||||
|
LLViewerInventoryItem* temp = new LLViewerInventoryItem();
|
||||||
|
temp->importLegacyStream(strm);
|
||||||
|
std::ostringstream strm2;
|
||||||
|
temp->exportLegacyStream(strm2, TRUE);
|
||||||
|
LLWString wstr(utf8str_to_wstring(strm2.str()));
|
||||||
|
|
||||||
|
gClipboard.copyFromSubstring(wstr, 0, wstr.length());
|
||||||
|
|
||||||
|
//delete temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void LLFloaterProperties::onClickUpdate(void* user_data)
|
||||||
|
{
|
||||||
|
LLFloaterProperties* floaterp = (LLFloaterProperties*)user_data;
|
||||||
|
if(floaterp)
|
||||||
|
{
|
||||||
|
LLViewerInventoryItem* item = (LLViewerInventoryItem*)floaterp->findItem();
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
std::string str(floaterp->childGetValue("item_text").asString());
|
||||||
|
std::string::size_type pos;
|
||||||
|
while((pos = str.find(" ")) != std::string::npos)
|
||||||
|
{
|
||||||
|
str.replace(pos, 4, "\t");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::istringstream strm(str);
|
||||||
|
item->importLegacyStream(strm);
|
||||||
|
|
||||||
|
if(floaterp->mObjectID.isNull())
|
||||||
|
{
|
||||||
|
// This is in the agent's inventory.
|
||||||
|
item->updateServer(FALSE);
|
||||||
|
gInventory.updateItem(item);
|
||||||
|
gInventory.notifyObservers();
|
||||||
|
|
||||||
|
item->setComplete(FALSE);
|
||||||
|
item->fetchFromServer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This is in an object's contents.
|
||||||
|
LLViewerObject* object = gObjectList.findObject(floaterp->mObjectID);
|
||||||
|
if(object)
|
||||||
|
{
|
||||||
|
object->updateInventory(
|
||||||
|
item,
|
||||||
|
TASK_INVENTORY_ITEM_KEY,
|
||||||
|
false);
|
||||||
|
object->fetchInventoryFromServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// </edit>
|
||||||
|
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
/// LLMultiProperties
|
/// LLMultiProperties
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
|
|
||||||
LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater(std::string("Properties"), rect)
|
LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater(std::string("Properties"), rect)
|
||||||
|
// <edit>
|
||||||
|
, mExpanded(FALSE)
|
||||||
|
// </edit>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLMultiProperties::setExpanded(BOOL expanded)
|
||||||
|
{
|
||||||
|
mExpanded = expanded;
|
||||||
|
LLRect rect = getRect();
|
||||||
|
LLRect tab_rect = mTabContainer->getRect();
|
||||||
|
if(expanded)
|
||||||
|
{
|
||||||
|
rect.setOriginAndSize(rect.mLeft, rect.mBottom, 800, rect.getHeight());
|
||||||
|
tab_rect.setOriginAndSize(tab_rect.mLeft, tab_rect.mBottom, 800, tab_rect.getHeight());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect.setOriginAndSize(rect.mLeft, rect.mBottom, 350, rect.getHeight());
|
||||||
|
tab_rect.setOriginAndSize(tab_rect.mLeft, tab_rect.mBottom, 350, tab_rect.getHeight());
|
||||||
|
}
|
||||||
|
setRect(rect);
|
||||||
|
mTabContainer->setRect(tab_rect);
|
||||||
|
for (S32 i = 0; i < mTabContainer->getTabCount(); i++)
|
||||||
|
{
|
||||||
|
LLFloaterProperties* floaterp = (LLFloaterProperties*)mTabContainer->getPanelByIndex(i);
|
||||||
|
floaterp->setExpanded(expanded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
/// Local function definitions
|
/// Local function definitions
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -61,6 +61,14 @@ public:
|
|||||||
|
|
||||||
static void closeByID(const LLUUID& item_id, const LLUUID& object_id);
|
static void closeByID(const LLUUID& item_id, const LLUUID& object_id);
|
||||||
|
|
||||||
|
// <edit>
|
||||||
|
static void onClickMore(void* user_data);
|
||||||
|
static void onClickLess(void* user_data);
|
||||||
|
static void onClickCopy(void* user_data);
|
||||||
|
static void onClickUpdate(void* user_data);
|
||||||
|
void setExpanded(BOOL expanded);
|
||||||
|
// </edit>
|
||||||
|
|
||||||
LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id);
|
LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id);
|
||||||
virtual ~LLFloaterProperties();
|
virtual ~LLFloaterProperties();
|
||||||
|
|
||||||
@@ -94,6 +102,9 @@ protected:
|
|||||||
LLUUID mObjectID;
|
LLUUID mObjectID;
|
||||||
|
|
||||||
BOOL mDirty;
|
BOOL mDirty;
|
||||||
|
// <edit>
|
||||||
|
BOOL mExpanded;
|
||||||
|
// </edit>
|
||||||
|
|
||||||
typedef std::map<LLUUID, LLFloaterProperties*, lluuid_less> instance_map;
|
typedef std::map<LLUUID, LLFloaterProperties*, lluuid_less> instance_map;
|
||||||
static instance_map sInstances;
|
static instance_map sInstances;
|
||||||
@@ -105,6 +116,11 @@ class LLMultiProperties : public LLMultiFloater
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLMultiProperties(const LLRect& rect);
|
LLMultiProperties(const LLRect& rect);
|
||||||
|
// <edit>
|
||||||
|
void setExpanded(BOOL expanded);
|
||||||
|
protected:
|
||||||
|
BOOL mExpanded;
|
||||||
|
// </edit>
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLFLOATERPROPERTIES_H
|
#endif // LL_LLFLOATERPROPERTIES_H
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||||
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
|
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
|
||||||
can_resize="false" height="320" min_height="100" min_width="100"
|
can_resize="false" height="470" min_height="100" min_width="100"
|
||||||
name="item properties" rect_control="PropertiesRect"
|
name="item properties" rect_control="PropertiesRect"
|
||||||
title="Inventory Item Properties" width="350">
|
title="Inventory Item Properties" width="350">
|
||||||
<icon bottom="-21" follows="top|right" height="16" image_name="icon_lock.tga"
|
<icon bottom="-21" follows="top|right" height="16" image_name="icon_lock.tga"
|
||||||
@@ -167,6 +167,84 @@
|
|||||||
enabled="true" follows="left|top|right" font="SansSerifSmall" height="16"
|
enabled="true" follows="left|top|right" font="SansSerifSmall" height="16"
|
||||||
is_unicode="false" left_delta="56" max_length="25" mouse_opaque="true"
|
is_unicode="false" left_delta="56" max_length="25" mouse_opaque="true"
|
||||||
name="EditPrice" width="242" />
|
name="EditPrice" width="242" />
|
||||||
|
|
||||||
|
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
|
bottom_delta="-25" drop_shadow_visible="true" follows="left|top"
|
||||||
|
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
|
||||||
|
mouse_opaque="true" name="LabelItemID" v_pad="0" width="78">
|
||||||
|
ItemID:
|
||||||
|
</text>
|
||||||
|
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-4"
|
||||||
|
enabled="false" follows="left|top|right" font="SansSerifSmall" height="16"
|
||||||
|
is_unicode="false" left="88" max_length="127" mouse_opaque="true"
|
||||||
|
name="EditItemID" width="252" />
|
||||||
|
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
|
bottom_delta="-15" drop_shadow_visible="true" follows="left|top"
|
||||||
|
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
|
||||||
|
mouse_opaque="true" name="LabelFolderID" v_pad="0" width="78">
|
||||||
|
FolderID:
|
||||||
|
</text>
|
||||||
|
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-4"
|
||||||
|
enabled="false" follows="left|top|right" font="SansSerifSmall" height="16"
|
||||||
|
is_unicode="false" left="88" max_length="127" mouse_opaque="true"
|
||||||
|
name="EditFolderID" width="252" />
|
||||||
|
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
|
bottom_delta="-15" drop_shadow_visible="true" follows="left|top"
|
||||||
|
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
|
||||||
|
mouse_opaque="true" name="LabelGroup" v_pad="0" width="78">
|
||||||
|
Group:
|
||||||
|
</text>
|
||||||
|
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-4"
|
||||||
|
enabled="false" follows="left|top|right" font="SansSerifSmall" height="16"
|
||||||
|
is_unicode="false" left="88" max_length="127" mouse_opaque="true"
|
||||||
|
name="EditGroup" width="252" />
|
||||||
|
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
|
bottom_delta="-15" drop_shadow_visible="true" follows="left|top"
|
||||||
|
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
|
||||||
|
mouse_opaque="true" name="LabelAssetID" v_pad="0" width="78">
|
||||||
|
AssetID:
|
||||||
|
</text>
|
||||||
|
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-4"
|
||||||
|
enabled="false" follows="left|top|right" font="SansSerifSmall" height="16"
|
||||||
|
is_unicode="false" left="88" max_length="127" mouse_opaque="true"
|
||||||
|
name="EditAssetID" width="252" />
|
||||||
|
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
|
bottom_delta="-15" drop_shadow_visible="true" follows="left|top"
|
||||||
|
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
|
||||||
|
mouse_opaque="true" name="LabelType" v_pad="0" width="78">
|
||||||
|
Type:
|
||||||
|
</text>
|
||||||
|
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-4"
|
||||||
|
enabled="false" follows="left|top|right" font="SansSerifSmall" height="16"
|
||||||
|
is_unicode="false" left="88" max_length="127" mouse_opaque="true"
|
||||||
|
name="EditType" width="100" />
|
||||||
|
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
|
bottom_delta="4" drop_shadow_visible="true" follows="left|top"
|
||||||
|
font="SansSerifSmall" h_pad="0" halign="left" height="10" left_delta="102"
|
||||||
|
mouse_opaque="true" name="LabelInvType" v_pad="0" width="78">
|
||||||
|
InvType:
|
||||||
|
</text>
|
||||||
|
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-4"
|
||||||
|
enabled="false" follows="left|top|right" font="SansSerifSmall" height="16"
|
||||||
|
is_unicode="false" left_delta="50" max_length="127" mouse_opaque="true"
|
||||||
|
name="EditInvType" width="100" />
|
||||||
|
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
|
bottom_delta="-15" drop_shadow_visible="true" follows="left|top"
|
||||||
|
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
|
||||||
|
mouse_opaque="true" name="LabelFlags" v_pad="0" width="78">
|
||||||
|
Flags:
|
||||||
|
</text>
|
||||||
|
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-4"
|
||||||
|
enabled="false" follows="left|top|right" font="SansSerifSmall" height="16"
|
||||||
|
is_unicode="false" left="88" max_length="127" mouse_opaque="true"
|
||||||
|
name="EditFlags" width="100" />
|
||||||
|
<button name="more_btn" left="260" width="80" bottom="10" height="20" label="More >>"/>
|
||||||
|
<button name="less_btn" left="260" width="80" bottom="10" height="20" label="<< Less" visible="false"/>
|
||||||
|
|
||||||
|
<text_editor name="item_text" font="SansSerifSmall" left="350" top="-25" width="440" bottom="40" max_length="65536" type="string" ignore_tab="false" word_wrap="false" visible="false"/>
|
||||||
|
<button name="copy_btn" left="620" width="80" bottom="10" height="20" label="Copy" visible="false"/>
|
||||||
|
<button name="update_btn" left="710" width="80" bottom="10" height="20" label="Update" visible="false"/>
|
||||||
|
|
||||||
<string name="unknown">
|
<string name="unknown">
|
||||||
(unknown)
|
(unknown)
|
||||||
</string>
|
</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user