summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rw-r--r--indra/newview/llpreviewscript.cpp51
1 files changed, 49 insertions, 2 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 2add126b2d..62281d58f8 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -325,6 +325,38 @@ void LLFloaterScriptSearch::onSearchBoxCommit()
}
/// ---------------------------------------------------------------------------
+
+class LLScriptMovedObserver : public LLInventoryObserver
+{
+ public:
+ LLScriptMovedObserver(LLPreviewLSL *floater) : mPreview(floater) { gInventory.addObserver(this); }
+ virtual ~LLScriptMovedObserver() { gInventory.removeObserver(this); }
+ virtual void changed(U32 mask);
+
+ private:
+ LLPreviewLSL *mPreview;
+};
+
+void LLScriptMovedObserver::changed(U32 mask)
+{
+ const std::set<LLUUID> &mChangedItemIDs = gInventory.getChangedIDs();
+ std::set<LLUUID>::const_iterator it;
+
+ const LLUUID &item_id = mPreview->getScriptID();
+
+ for (it = mChangedItemIDs.begin(); it != mChangedItemIDs.end(); it++)
+ {
+ if (*it == item_id)
+ {
+ if ((mask & (LLInventoryObserver::STRUCTURE)) != 0)
+ {
+ mPreview->setDirty();
+ }
+ }
+ }
+}
+
+/// ---------------------------------------------------------------------------
/// LLScriptEdCore
/// ---------------------------------------------------------------------------
@@ -1554,6 +1586,14 @@ LLPreviewLSL::LLPreviewLSL(const LLSD& key )
mPendingUploads(0)
{
mFactoryMap["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this);
+
+ mItemObserver = new LLScriptMovedObserver(this);
+}
+
+LLPreviewLSL::~LLPreviewLSL()
+{
+ delete mItemObserver;
+ mItemObserver = NULL;
}
// virtual
@@ -1584,7 +1624,12 @@ void LLPreviewLSL::draw()
setTitle(LLTrans::getString("ScriptWasDeleted"));
mScriptEd->setItemRemoved(TRUE);
}
-
+ if (mDirty)
+ {
+ std::string item_path = get_category_path(item->getParentUUID());
+ getChild<LLUICtrl>("path_txt")->setValue(item_path);
+ getChild<LLUICtrl>("path_txt")->setToolTip(item_path);
+ }
LLPreview::draw();
}
// virtual
@@ -1870,7 +1915,8 @@ LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) :
mPendingUploads(0),
mIsModifiable(FALSE),
mIsNew(false),
- mIsSaving(FALSE)
+ mIsSaving(FALSE),
+ mObjectName("")
{
mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this);
}
@@ -2007,6 +2053,7 @@ void LLLiveLSLEditor::loadAsset()
}
refreshFromItem();
+ getChild<LLUICtrl>("obj_name")->setValue(mObjectName);
// This is commented out, because we don't completely
// handle script exports yet.
/*