summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llpreviewscript.cpp10
-rwxr-xr-xindra/newview/llpreviewscript.h2
-rw-r--r--indra/newview/llsyntaxid.cpp113
-rw-r--r--indra/newview/llsyntaxid.h63
4 files changed, 96 insertions, 92 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 62e1d765b3..5f23249c8d 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -407,14 +407,10 @@ BOOL LLScriptEdCore::postBuild()
initMenu();
// Make this work ;-)
- mSyntaxLSL = LLSyntaxIdLSL();
-
-// mSyntaxLSL.initialise();
-// mSyntaxLSL.mKeywords = &mEditor->mKeywords;
+ mSyntaxIdLSL.initialise();
// ...
-// mSyntaxLSL->mKeywords.initialise();
-// Move into the SyntaxIdLSL class
- mEditor->mKeywords.initialise(mSyntaxLSL.filenamePath(), mSyntaxLSL.filenameCurrent());
+ mEditor->mKeywords.initialise(LL_PATH_APP_SETTINGS, "keywords_lsl_default.xml");
+// mEditor->mKeywords.initialise(mSyntaxIdLSL.getFullFileSpec());
// FIX: Refactor LLTextEditor::loadKeywords so these can be removed.
std::vector<std::string> funcs;
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index 21e33f30d5..73ccaab0b8 100755
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -150,7 +150,7 @@ private:
BOOL mEnableSave;
BOOL mHasScriptData;
LLLiveLSLFile* mLiveFile;
- LLSyntaxIdLSL mSyntaxLSL;
+ LLSyntaxIdLSL mSyntaxIdLSL;
LLScriptEdContainer* mContainer; // parent view
};
diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp
index deaa64c0e7..442793bff1 100644
--- a/indra/newview/llsyntaxid.cpp
+++ b/indra/newview/llsyntaxid.cpp
@@ -41,14 +41,17 @@
//-----------------------------------------------------------------------------
class fetchKeywordsFileResponder : public LLCurl::Responder
{
- std::string mFileSpec;
public:
+ std::string mFileSpec;
+
fetchKeywordsFileResponder(std::string filespec)
{
mFileSpec = filespec;
}
- void errorWithContent(U32 status, const std::string& reason, const LLSD& content)
+ void errorWithContent(U32 status,
+ const std::string& reason,
+ const LLSD& content)
{
LL_WARNS("")
<< "fetchKeywordsFileResponder error [status:"
@@ -58,15 +61,14 @@ public:
<< LL_ENDL;
}
- void result(LLSD& content_ref)
+ void result(const LLSD& content_ref)
{
- LLSyntaxIdLSL::setKeywordsXml(content_ref);
+ //LLSyntaxIdLSL::setKeywordsXml(content_ref);
std::stringstream str;
LLSDSerialize::toPrettyXML(content_ref, str);
LL_WARNS("")
- << "fetchKeywordsFileResponder result:"
- << str.str()
+ << "fetchKeywordsFileResponder result:" << str.str()
<< "filename: '" << mFileSpec << "'"
<< LL_ENDL;
@@ -80,20 +82,21 @@ public:
//-----------------------------------------------------------------------------
// LLSyntaxIdLSL
//-----------------------------------------------------------------------------
+/**
+ * @brief LLSyntaxIdLSL constructor
+ */
LLSyntaxIdLSL::LLSyntaxIdLSL() :
// Move these to signature?
- mFilenameDefault("keywords_lsl_default.xml"),
+ mFileNameDefault("keywords_lsl_default.xml"),
mSimulatorFeature("LSLSyntaxId"),
- mCapabilityName("LSLSyntax")
+ mCapabilityName("LSLSyntax"),
+ mFilePath(LL_PATH_APP_SETTINGS)
{
mCurrentSyntaxId = LLUUID();
- mFilenameCurrent = mFilenameDefault;
- mFilenameLocation = LL_PATH_APP_SETTINGS;
- checkSyntaxIdChange();
- //LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange(), this));
+ mFileNameCurrent = mFileNameDefault;
}
-std::string LLSyntaxIdLSL::buildFilename(LLUUID& SyntaxId)
+std::string LLSyntaxIdLSL::buildFileName(LLUUID& SyntaxId)
{
std::string filename = "keywords_lsl_" + SyntaxId.asString() + "_" + gLastVersionChannel + ".llsd.xml";
return filename;
@@ -102,23 +105,24 @@ std::string LLSyntaxIdLSL::buildFilename(LLUUID& SyntaxId)
//-----------------------------------------------------------------------------
// checkSyntaxIdChange()
//-----------------------------------------------------------------------------
-bool LLSyntaxIdLSL::checkSyntaxIdChange()
+bool LLSyntaxIdLSL::checkSyntaxIdChanged()
{
bool changed = false;
- if (mRegion)
+ LLViewerRegion* region = gAgent.getRegion();
+
+ if (region)
{
+ /*
LL_WARNS("LSLSyntax")
- << "REGION is '"
- << mRegion->getName()
- << "'"
+ << "REGION is '" << region->getName() << "'"
<< LL_ENDL;
+ */
- if (!mRegion->capabilitiesReceived())
+ if (!region->capabilitiesReceived())
{ // Shouldn't be possible, but experience shows that it's needed
-// mRegion->setCapabilitiesReceivedCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange, this));
+// region->setCapabilitiesReceivedCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange, this));
LL_WARNS("LSLSyntax")
- << "mRegion '"
- << mRegion->getName()
+ << "region '" << region->getName()
<< "' has not received capabilities yet! Setting a callback for when they arrive."
<< LL_ENDL;
}
@@ -126,23 +130,21 @@ bool LLSyntaxIdLSL::checkSyntaxIdChange()
{
// get and check the hash
LLSD simFeatures;
- mRegion->getSimulatorFeatures(simFeatures);
+ region->getSimulatorFeatures(simFeatures);
if (simFeatures.has("LSLSyntaxId"))
{
LLUUID SyntaxId = simFeatures["LSLSyntaxId"].asUUID();
if (mCurrentSyntaxId != SyntaxId)
{
// set the properties for the fetcher to use
- mFilenameCurrent = buildFilename(SyntaxId);
- mFilenameLocation = LL_PATH_CACHE;
+ mFileNameCurrent = buildFileName(SyntaxId);
+ mFilePath = LL_PATH_CACHE;
mCurrentSyntaxId = SyntaxId;
LL_WARNS("LSLSyntax")
- << "Region changed to '"
- << mRegion->getName()
+ << "Region changed to '" << region->getName()
<< "' it has LSLSyntaxId capability, and the new hash is '"
- << SyntaxId
- << "'"
+ << SyntaxId << "'"
<< LL_ENDL;
changed = true;
@@ -150,11 +152,9 @@ bool LLSyntaxIdLSL::checkSyntaxIdChange()
else
{
LL_WARNS("LSLSyntax")
- << "Region changed to '"
- << mRegion->getName()
+ << "Region changed to '" << region->getName()
<< "' it has the same LSLSyntaxId! Leaving hash as '"
- << mCurrentSyntaxId
- << "'"
+ << mCurrentSyntaxId << "'"
<< LL_ENDL;
}
}
@@ -164,17 +164,19 @@ bool LLSyntaxIdLSL::checkSyntaxIdChange()
if ( mCurrentSyntaxId.isNull() )
{
LL_WARNS("LSLSyntax")
- << "Region does not have LSLSyntaxId capability, remaining with default keywords file!"
+ << "Region changed to '" << region->getName()
+ << " it does not have LSLSyntaxId capability, remaining with default keywords file!"
<< LL_ENDL;
}
else
{
mCurrentSyntaxId = LLUUID();
- mFilenameCurrent = mFilenameDefault;
- mFilenameLocation = LL_PATH_APP_SETTINGS;
+ mFileNameCurrent = mFileNameDefault;
+ mFilePath = LL_PATH_APP_SETTINGS;
LL_WARNS("LSLSyntax")
- << "Region does not have LSLSyntaxId capability, using default keywords file!"
+ << "Region changed to '" << region->getName()
+ << " it does not have LSLSyntaxId capability, using default keywords file!"
<< LL_ENDL;
changed = true;
@@ -190,12 +192,13 @@ bool LLSyntaxIdLSL::checkSyntaxIdChange()
//-----------------------------------------------------------------------------
bool LLSyntaxIdLSL::fetchKeywordsFile()
{
+ LLViewerRegion* region = gAgent.getRegion();
bool fetched = false;
- std::string cap_url = mRegion->getCapability(mCapabilityName);
-// mResponder->setFileSpec(mFilenameSpec);
+
+ std::string cap_url = region->getCapability(mCapabilityName);
if ( !cap_url.empty() )
{
- LLHTTPClient::get(cap_url, new fetchKeywordsFileResponder(mFilenameSpec));
+ LLHTTPClient::get(cap_url, new fetchKeywordsFileResponder(mFullFileSpec));
}
return fetched;
@@ -203,26 +206,34 @@ bool LLSyntaxIdLSL::fetchKeywordsFile()
void LLSyntaxIdLSL::initialise()
{
- mRegion = gAgent.getRegion();
- if (checkSyntaxIdChange())
+ if (checkSyntaxIdChanged())
{
- mFilenameFull = gDirUtilp->getExpandedFilename(
- mFilenameLocation,
- mFilenameCurrent
- );
+ LL_WARNS("LSLSyntax")
+ << "Change to syntax, setting up new file."
+ << LL_ENDL;
+
+ setFileNameNew(gDirUtilp->getExpandedFilename(
+ mFilePath,
+ mFileNameCurrent
+ ));
if ( !mCurrentSyntaxId.isNull() )
{
- bool success = true;
- if (!gDirUtilp->fileExists(mFilenameSpec))
- {
- //mResponder = new fetchKeywordsFileResponder(mFilenameSpec);
+ bool success = false;
+ if ( !gDirUtilp->fileExists(mFullFileSpec) )
+ { // Does not exist, so fetch it from the capability
success = fetchKeywordsFile();
}
}
// TODO add a signal here to tell the editor the hash has changed?
}
+ else
+ {
+ LL_WARNS("LSLSyntax")
+ << "Apparently there is no change to Syntax!"
+ << LL_ENDL;
- mRegion = NULL;
+ }
+ //LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange(), this));
}
//-----------------------------------------------------------------------------
diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h
index e32fcf209e..f7e3d6896e 100644
--- a/indra/newview/llsyntaxid.h
+++ b/indra/newview/llsyntaxid.h
@@ -12,9 +12,6 @@
#include "llviewerregion.h"
-//class LLKeywords;
-
-
/**
* @file llsyntaxid.h
* @brief The LLSyntaxIdLSL class
@@ -22,45 +19,45 @@
class LLSyntaxIdLSL
{
public:
- /**
- * @brief LLSyntaxIdLSL constructor
- */
LLSyntaxIdLSL();
- LLUUID getSyntaxId() const { return mCurrentSyntaxId; }
+ bool checkSyntaxIdChanged();
+ std::string getFileNameCurrent() const { return mFileNameCurrent; }
+ ELLPath getFilePath() const { return mFilePath; }
+ LLUUID getSyntaxId() const { return mCurrentSyntaxId; }
+
+ void initialise();
+
+ static void setKeywordsXml(const LLSD& content) { sKeywordsXml = content; }
- bool checkSyntaxIdChange();
- std::string filenameCurrent() { return mFilenameCurrent; }
- ELLPath filenamePath() { return mFilenameLocation; }
- void initialise();
- static void setKeywordsXml(const LLSD& content) { LLSyntaxIdLSL::sKeywordsXml = content; }
protected:
- std::string buildFilename(LLUUID& SyntaxId);
- bool fetchKeywordsFile();
- void openKeywordsFile();
- void setSyntaxId(LLUUID SyntaxId) { mCurrentSyntaxId = SyntaxId; }
- void setFilenameCurrent(std::string& name) { mFilenameCurrent = name; }
- void setFilenameDefault(std::string& name) { mFilenameDefault = name; }
- void setSimulatorFeatureName(const std::string& name) { mSimulatorFeature = name; }
+ std::string buildFileName(LLUUID& SyntaxId);
+ bool fetchKeywordsFile();
+ void openKeywordsFile();
+ void setSyntaxId(LLUUID SyntaxId) { mCurrentSyntaxId = SyntaxId; }
+ void setFileNameCurrent(std::string& name) { mFileNameCurrent = name; }
+ void setFileNameDefault(std::string& name) { mFileNameDefault = name; }
+ void setFileNameNew(std::string& name) { mFileNameNew = name; }
+ void setSimulatorFeatureName(const std::string& name) { mSimulatorFeature = name; }
-public:
- static LLHTTPClient::ResponderPtr mResponder;
+
+//public:
protected:
-// LLKeywords& mKeywords;
- LLViewerRegion* mRegion;
+ LLViewerRegion* region;
+
private:
- std::string mCapabilityName;
- LLUUID mCurrentSyntaxId;
- std::string mFilenameCurrent;
- std::string mFilenameDefault;
- std::string mFilenameFull;
- ELLPath mFilenameLocation;
- std::string mFilenameSpec;
- std::string mSimulatorFeature;
-
- static LLSD sKeywordsXml;
+ std::string mCapabilityName;
+ LLUUID mCurrentSyntaxId;
+ std::string mFileNameCurrent;
+ std::string mFileNameDefault;
+ std::string mFileNameNew;
+ ELLPath mFilePath;
+ std::string mFullFileSpec;
+ std::string mSimulatorFeature;
+
+ static LLSD sKeywordsXml;
};