aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpreview.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:27 -0500
committerJacek Antonelli2008-08-15 23:45:27 -0500
commita8a62201ba762e98dff92cf49033e577fc34d8d4 (patch)
tree11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/newview/llpreview.cpp
parentSecond Life viewer sources 1.18.6.4-RC (diff)
downloadmeta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz
Second Life viewer sources 1.19.0.0
Diffstat (limited to 'linden/indra/newview/llpreview.cpp')
-rw-r--r--linden/indra/newview/llpreview.cpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/linden/indra/newview/llpreview.cpp b/linden/indra/newview/llpreview.cpp
index 0dea2ca..0549b16 100644
--- a/linden/indra/newview/llpreview.cpp
+++ b/linden/indra/newview/llpreview.cpp
@@ -12,12 +12,12 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2 15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 * 16 *
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception 20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 21 *
22 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -66,12 +66,14 @@ LLPreview::LLPreview(const std::string& name) :
66 mUserResized(FALSE), 66 mUserResized(FALSE),
67 mCloseAfterSave(FALSE), 67 mCloseAfterSave(FALSE),
68 mAssetStatus(PREVIEW_ASSET_UNLOADED), 68 mAssetStatus(PREVIEW_ASSET_UNLOADED),
69 mItem(NULL) 69 mItem(NULL),
70 mDirty(TRUE)
70{ 71{
71 // don't add to instance list, since ItemID is null 72 // don't add to instance list, since ItemID is null
72 mAuxItem = new LLInventoryItem; // (LLPointer is auto-deleted) 73 mAuxItem = new LLInventoryItem; // (LLPointer is auto-deleted)
73 // don't necessarily steal focus on creation -- sometimes these guys pop up without user action 74 // don't necessarily steal focus on creation -- sometimes these guys pop up without user action
74 mAutoFocus = FALSE; 75 mAutoFocus = FALSE;
76 gInventory.addObserver(this);
75} 77}
76 78
77LLPreview::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 ) 79LLPreview::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
84 mUserResized(FALSE), 86 mUserResized(FALSE),
85 mCloseAfterSave(FALSE), 87 mCloseAfterSave(FALSE),
86 mAssetStatus(PREVIEW_ASSET_UNLOADED), 88 mAssetStatus(PREVIEW_ASSET_UNLOADED),
87 mItem(inv_item) 89 mItem(inv_item),
90 mDirty(TRUE)
88{ 91{
89 mAuxItem = new LLInventoryItem; 92 mAuxItem = new LLInventoryItem;
90 // don't necessarily steal focus on creation -- sometimes these guys pop up without user action 93 // 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
94 { 97 {
95 sInstances[mItemUUID] = this; 98 sInstances[mItemUUID] = this;
96 } 99 }
97 100 gInventory.addObserver(this);
98} 101}
99 102
100LLPreview::~LLPreview() 103LLPreview::~LLPreview()
@@ -118,6 +121,7 @@ LLPreview::~LLPreview()
118 } 121 }
119 } 122 }
120 } 123 }
124 gInventory.removeObserver(this);
121} 125}
122 126
123void LLPreview::setItemID(const LLUUID& item_id) 127void LLPreview::setItemID(const LLUUID& item_id)
@@ -215,6 +219,7 @@ void LLPreview::onCommit()
215 { 219 {
216 new_item->updateServer(FALSE); 220 new_item->updateServer(FALSE);
217 gInventory.updateItem(new_item); 221 gInventory.updateItem(new_item);
222 gInventory.notifyObservers();
218 223
219 // If the item is an attachment that is currently being worn, 224 // If the item is an attachment that is currently being worn,
220 // update the object itself. 225 // update the object itself.
@@ -238,6 +243,34 @@ void LLPreview::onCommit()
238 } 243 }
239} 244}
240 245
246void LLPreview::changed(U32 mask)
247{
248 mDirty = TRUE;
249}
250
251void LLPreview::draw()
252{
253 LLFloater::draw();
254 if (mDirty)
255 {
256 mDirty = FALSE;
257 const LLViewerInventoryItem *item = getItem();
258 if (item)
259 {
260 refreshFromItem(item);
261 }
262 }
263}
264
265void LLPreview::refreshFromItem(const LLInventoryItem* item)
266{
267 setTitle(llformat("%s: %s",getTitleName(),item->getName().c_str()));
268 childSetText("desc",item->getDescription());
269
270 BOOL can_agent_manipulate = item->getPermissions().allowModifyBy(gAgent.getID());
271 childSetEnabled("desc",can_agent_manipulate);
272}
273
241// static 274// static
242void LLPreview::onText(LLUICtrl*, void* userdata) 275void LLPreview::onText(LLUICtrl*, void* userdata)
243{ 276{