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.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index f28ffce602..6ecc4c7fb9 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -376,7 +376,8 @@ LLScriptEdCore::LLScriptEdCore(
mLive(live),
mContainer(container),
mHasScriptData(FALSE),
- mScriptRemoved(FALSE)
+ mScriptRemoved(FALSE),
+ mSaveDialogShown(FALSE)
{
setFollowsAll();
setBorderVisible(FALSE);
@@ -584,6 +585,14 @@ void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid)
}
}
+void LLScriptEdCore::makeEditorPristine()
+{
+ if (mEditor)
+ {
+ mEditor->makePristine();
+ }
+}
+
bool LLScriptEdCore::loadScriptText(const std::string& filename)
{
if (filename.empty())
@@ -847,8 +856,12 @@ BOOL LLScriptEdCore::canClose()
}
else
{
- // Bring up view-modal dialog: Save changes? Yes, No, Cancel
- LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleSaveChangesDialog, this, _1, _2));
+ if(!mSaveDialogShown)
+ {
+ mSaveDialogShown = TRUE;
+ // Bring up view-modal dialog: Save changes? Yes, No, Cancel
+ LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleSaveChangesDialog, this, _1, _2));
+ }
return FALSE;
}
}
@@ -861,6 +874,7 @@ void LLScriptEdCore::setEnableEditing(bool enable)
bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLSD& response )
{
+ mSaveDialogShown = FALSE;
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
switch( option )
{
@@ -1200,7 +1214,7 @@ void LLScriptEdCore::onBtnLoadFromFile( void* data )
std::string filename = file_picker.getFirstFile();
- std::ifstream fin(filename.c_str());
+ llifstream fin(filename.c_str());
std::string line;
std::string text;
@@ -1238,7 +1252,7 @@ void LLScriptEdCore::onBtnSaveToFile( void* userdata )
{
std::string filename = file_picker.getFirstFile();
std::string scriptText=self->mEditor->getText();
- std::ofstream fout(filename.c_str());
+ llofstream fout(filename.c_str());
fout<<(scriptText);
fout.close();
self->mSaveCallback( self->mUserdata, FALSE );
@@ -1683,6 +1697,7 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
mScriptEd->sync();
}
+ if (!gAgent.getRegion()) return;
const LLInventoryItem *inv_item = getItem();
// save it out to asset server
std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
@@ -1870,8 +1885,14 @@ void LLLiveLSLEditor::loadAsset()
if(item)
{
- LLExperienceCache::instance().fetchAssociatedExperience(item->getParentUUID(), item->getUUID(),
- boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle<LLLiveLSLEditor>(), _1));
+ LLViewerRegion* region = object->getRegion();
+ std::string url = std::string();
+ if(region)
+ {
+ url = region->getCapability("GetMetadata");
+ }
+ LLExperienceCache::instance().fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), url,
+ boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle<LLLiveLSLEditor>(), _1));
bool isGodlike = gAgent.isGodlike();
bool copyManipulate = gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE);
@@ -2019,7 +2040,7 @@ void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType
buffer[file_length] = '\0';
mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE);
- mScriptEd->mEditor->makePristine();
+ mScriptEd->makeEditorPristine();
mScriptEd->setScriptName(getItem()->getName());
}