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.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 5cdc5dfd38..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");
@@ -2025,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());
}