diff options
author | Don Kjer <don@lindenlab.com> | 2007-12-05 23:43:56 +0000 |
---|---|---|
committer | Don Kjer <don@lindenlab.com> | 2007-12-05 23:43:56 +0000 |
commit | facf67ae3226105910c983a8fa8760414bf703e9 (patch) | |
tree | b5f7cd6b79a79f769080a65b6fe2cb6b97c8b6fb /indra/newview/llpreview.cpp | |
parent | 45057e8881c3166c7c0ef545c02bc177922af6fb (diff) |
EFFECTIVE MERGE: svn merge -r 71520:73420 svn+ssh://svn/svn/linden/branches/maintenance-3 into release
ACTUAL MERGE: svn merge -r 75074:75114 svn+ssh://svn/svn/linden/qa/maintenance-3-merge-75067 into release
Diffstat (limited to 'indra/newview/llpreview.cpp')
-rw-r--r-- | indra/newview/llpreview.cpp | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index e4f7d1e0b2..660de69fb0 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -66,12 +66,14 @@ LLPreview::LLPreview(const std::string& name) : mUserResized(FALSE), mCloseAfterSave(FALSE), mAssetStatus(PREVIEW_ASSET_UNLOADED), - mItem(NULL) + mItem(NULL), + mDirty(TRUE) { // don't add to instance list, since ItemID is null mAuxItem = new LLInventoryItem; // (LLPointer is auto-deleted) // don't necessarily steal focus on creation -- sometimes these guys pop up without user action mAutoFocus = FALSE; + gInventory.addObserver(this); } LLPreview::LLPreview(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const LLUUID& object_uuid, BOOL allow_resize, S32 min_width, S32 min_height, LLPointer<LLViewerInventoryItem> inv_item ) @@ -84,7 +86,8 @@ LLPreview::LLPreview(const std::string& name, const LLRect& rect, const std::str mUserResized(FALSE), mCloseAfterSave(FALSE), mAssetStatus(PREVIEW_ASSET_UNLOADED), - mItem(inv_item) + mItem(inv_item), + mDirty(TRUE) { mAuxItem = new LLInventoryItem; // don't necessarily steal focus on creation -- sometimes these guys pop up without user action @@ -94,7 +97,7 @@ LLPreview::LLPreview(const std::string& name, const LLRect& rect, const std::str { sInstances[mItemUUID] = this; } - + gInventory.addObserver(this); } LLPreview::~LLPreview() @@ -118,6 +121,7 @@ LLPreview::~LLPreview() } } } + gInventory.removeObserver(this); } void LLPreview::setItemID(const LLUUID& item_id) @@ -215,6 +219,7 @@ void LLPreview::onCommit() { new_item->updateServer(FALSE); gInventory.updateItem(new_item); + gInventory.notifyObservers(); // If the item is an attachment that is currently being worn, // update the object itself. @@ -238,6 +243,34 @@ void LLPreview::onCommit() } } +void LLPreview::changed(U32 mask) +{ + mDirty = TRUE; +} + +void LLPreview::draw() +{ + LLFloater::draw(); + if (mDirty) + { + mDirty = FALSE; + const LLViewerInventoryItem *item = getItem(); + if (item) + { + refreshFromItem(item); + } + } +} + +void LLPreview::refreshFromItem(const LLInventoryItem* item) +{ + setTitle(llformat("%s: %s",getTitleName(),item->getName().c_str())); + childSetText("desc",item->getDescription()); + + BOOL can_agent_manipulate = item->getPermissions().allowModifyBy(gAgent.getID()); + childSetEnabled("desc",can_agent_manipulate); +} + // static void LLPreview::onText(LLUICtrl*, void* userdata) { |