diff options
author | Cinder <cinder.roxley@phoenixviewer.com> | 2014-05-06 11:09:50 -0600 |
---|---|---|
committer | Cinder <cinder.roxley@phoenixviewer.com> | 2014-05-06 11:09:50 -0600 |
commit | e8422e5bed6c593c8a26b533f33103911a1d3da6 (patch) | |
tree | ce8140d0741ad88482961ca4a4bfc159db2829cf /indra/newview | |
parent | 9353868d91dfe2c4539c81c0b96bfe9efb497b2c (diff) |
Let's get started: some code policy cleanup, reference arguments where we can, correct spelling
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/app_settings/keywords_lsl_default.xml | 20 | ||||
-rwxr-xr-x | indra/newview/llpreviewscript.cpp | 79 | ||||
-rwxr-xr-x | indra/newview/llpreviewscript.h | 1 | ||||
-rw-r--r-- | indra/newview/llsyntaxid.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llsyntaxid.h | 8 |
5 files changed, 57 insertions, 68 deletions
diff --git a/indra/newview/app_settings/keywords_lsl_default.xml b/indra/newview/app_settings/keywords_lsl_default.xml index 83801a7e1e..53a89f0f09 100755 --- a/indra/newview/app_settings/keywords_lsl_default.xml +++ b/indra/newview/app_settings/keywords_lsl_default.xml @@ -89,7 +89,7 @@ <key>vector</key> <map> <key>tooltip</key> - <string>A vector is a data type that contains a set of three float values.\nVectors are used to represent colours (RGB), positions, and directions/velocities.</string> + <string>A vector is a data type that contains a set of three float values.\nVectors are used to represent colors (RGB), positions, and directions/velocities.</string> </map> </map> <key>constants</key> @@ -852,7 +852,7 @@ <key>value</key> <string>0x2</string> <key>tooltip</key> - <string>The object colour has changed.</string> + <string>The object color has changed.</string> </map> <key>CHANGED_INVENTORY</key> <map> @@ -4372,7 +4372,7 @@ <key>value</key> <integer>3</integer> <key>tooltip</key> - <string>A vector <r, g, b> which determines the ending colour of the object.</string> + <string>A vector <r, g, b> which determines the ending color of the object.</string> </map> <key>PSYS_PART_END_GLOW</key> <map> @@ -4426,7 +4426,7 @@ <key>value</key> <string>0x1</string> <key>tooltip</key> - <string>Interpolate both the colour and alpha from the start value to the end value.</string> + <string>Interpolate both the color and alpha from the start value to the end value.</string> </map> <key>PSYS_PART_INTERP_SCALE_MASK</key> <map> @@ -4471,7 +4471,7 @@ <key>value</key> <integer>1</integer> <key>tooltip</key> - <string>A vector <r.r, g.g, b.b> which determines the starting colour of the object.</string> + <string>A vector <r.r, g.g, b.b> which determines the starting color of the object.</string> </map> <key>PSYS_PART_START_GLOW</key> <map> @@ -9032,7 +9032,7 @@ </map> </array> <key>tooltip</key> - <string>Returns the color on Face.\nReturns the colour of Face as a vector of red, green, and blue values between 0 and 1. If face is ALL_SIDES the colour returned is the mean average of each channel.</string> + <string>Returns the color on Face.\nReturns the color of Face as a vector of red, green, and blue values between 0 and 1. If face is ALL_SIDES the color returned is the mean average of each channel.</string> </map> <key>llGetCreator</key> <map> @@ -15304,7 +15304,7 @@ <key>arguments</key> <array> <map> - <key>Colour</key> + <key>Color</key> <map> <key>type</key> <string>vector</string> @@ -15323,7 +15323,7 @@ </map> </array> <key>tooltip</key> - <string>Sets the color, for the face.\nSets the colour of the side specified. If Face is ALL_SIDES, sets the colour on all faces.</string> + <string>Sets the color, for the face.\nSets the color of the side specified. If Face is ALL_SIDES, sets the color on all faces.</string> </map> <key>llSetContentType</key> <map> @@ -15671,7 +15671,7 @@ </map> </map> <map> - <key>Colour</key> + <key>Color</key> <map> <key>type</key> <string>vector</string> @@ -15690,7 +15690,7 @@ </map> </array> <key>tooltip</key> - <string>If a task exists in the link chain at LinkNumber, set the Face to color.\nSets the colour of the linked child's side, specified by LinkNumber.</string> + <string>If a task exists in the link chain at LinkNumber, set the Face to color.\nSets the color of the linked child's side, specified by LinkNumber.</string> </map> <key>llSetLinkMedia</key> <map> diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 1d95276c51..fae4aeb7bc 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -374,6 +374,7 @@ LLScriptEdCore::LLScriptEdCore( setXMLFilename("panel_script_ed.xml"); llassert_always(mContainer != NULL); + mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLScriptEdCore::updateKeywords, this)); } LLScriptEdCore::~LLScriptEdCore() @@ -389,6 +390,7 @@ LLScriptEdCore::~LLScriptEdCore() } delete mLiveFile; + mRegionChangedCallback.disconnect(); } BOOL LLScriptEdCore::postBuild() @@ -407,25 +409,20 @@ BOOL LLScriptEdCore::postBuild() initMenu(); - mSyntaxIdLSL.addFileFetchedCallback(boost::bind(&LLScriptEdCore::processKeywords, this)); + LLSyntaxIdLSL::getInstance()->addFileFetchedCallback(boost::bind(&LLScriptEdCore::processKeywords, this)); // Intialise keyword highlighting for the current simulator's version of LSL - mSyntaxIdLSL.initialise(); + LLSyntaxIdLSL::getInstance()->initialise(); - if (mSyntaxIdLSL.isDifferentVersion()) + if (LLSyntaxIdLSL::getInstance()->isDifferentVersion()) { processLoaded(); } else { - LL_INFOS("SyntaxLSL") - << "Hashes are the same, no need to update highlighter." << LL_ENDL; + LL_DEBUGS("SyntaxLSL") << "Hashes are the same, no need to update highlighter." << LL_ENDL; } - - // Set up a callback for region changes - mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLScriptEdCore::updateKeywords, this)); - return TRUE; } @@ -434,7 +431,6 @@ void LLScriptEdCore::updateKeywords() if (mLive) { mEditor->clearSegments(); - mRegionChangedCallback.disconnect(); } else { @@ -444,61 +440,54 @@ void LLScriptEdCore::updateKeywords() void LLScriptEdCore::processLoaded() { - mSyntaxIdLSL.initialise(); - if (mSyntaxIdLSL.isLoaded()) + LLSyntaxIdLSL::getInstance()->initialise(); + if (LLSyntaxIdLSL::getInstance()->isLoaded()) { processKeywords(); } else { - LL_INFOS("SyntaxLSL") - << "Hashes are different, waiting for the syntax file to be retrieved." << LL_ENDL; + LL_DEBUGS("SyntaxLSL") << "Hashes are different, waiting for the syntax file to be retrieved." << LL_ENDL; } } void LLScriptEdCore::processKeywords() { - if (mSyntaxIdLSL.isLoaded()) + if (LLSyntaxIdLSL::getInstance()->isLoaded()) { - LL_INFOS("SyntaxLSL") - << "Hashes are different, updating highlighter." << LL_ENDL; + LL_DEBUGS("SyntaxLSL") << "Hashes are different, updating highlighter." << LL_ENDL; mEditor->clearSegments(); - if (mSyntaxIdLSL.isLoaded()) - { - mEditor->initKeywords(); - mEditor->loadKeywords(); - - std::vector<std::string> primary_keywords; - std::vector<std::string> secondary_keywords; - LLKeywordToken *token; - LLKeywords::keyword_iterator_t token_it; - for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) - { - token = token_it->second; - if (token->getType() == LLKeywordToken::TT_FUNCTION) - { - primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); - } - else - { - secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); - } - } + mEditor->initKeywords(); + mEditor->loadKeywords(); - for (std::vector<std::string>::const_iterator iter= primary_keywords.begin(); - iter!= primary_keywords.end(); ++iter) + string_vec_t primary_keywords; + string_vec_t secondary_keywords; + LLKeywordToken *token; + LLKeywords::keyword_iterator_t token_it; + for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) + { + token = token_it->second; + if (token->getType() == LLKeywordToken::TT_FUNCTION) { - mFunctions->add(*iter); + primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); } - - for (std::vector<std::string>::const_iterator iter= secondary_keywords.begin(); - iter!= secondary_keywords.end(); ++iter) + else { - mFunctions->add(*iter); + secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); } } + for (string_vec_t::const_iterator iter = primary_keywords.begin(); + iter!= primary_keywords.end(); ++iter) + { + mFunctions->add(*iter); + } + for (string_vec_t::const_iterator iter = secondary_keywords.begin(); + iter!= secondary_keywords.end(); ++iter) + { + mFunctions->add(*iter); + } } } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 3ac48ae9c4..966c149d3d 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -156,7 +156,6 @@ private: BOOL mEnableSave; BOOL mHasScriptData; LLLiveLSLFile* mLiveFile; - LLSyntaxIdLSL mSyntaxIdLSL; LLScriptEdContainer* mContainer; // parent view diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 14265fd3af..3f726fa8b5 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -127,13 +127,13 @@ LLSyntaxIdLSL::file_fetched_signal_t LLSyntaxIdLSL::sFileFetchedSignal; /** * @brief LLSyntaxIdLSL constructor */ -LLSyntaxIdLSL::LLSyntaxIdLSL(std::string filenameDefault, std::string simFeatureName, std::string capabilityName) : - mFilePath(LL_PATH_APP_SETTINGS) +LLSyntaxIdLSL::LLSyntaxIdLSL(const std::string& filename, const std::string& sim_feature, const std::string& capability) +: mFilePath(LL_PATH_APP_SETTINGS) { - mCapabilityName = capabilityName; - mFileNameCurrent = filenameDefault; - mFileNameDefault = filenameDefault; - mSimulatorFeature = simFeatureName; + mCapabilityName = capability; + mFileNameCurrent = filename; + mFileNameDefault = filename; + mSimulatorFeature = sim_feature; mSyntaxIdCurrent = LLUUID(); } @@ -321,6 +321,9 @@ void LLSyntaxIdLSL::initialise() //----------------------------------------------------------------------------- // isSupportedVersion //----------------------------------------------------------------------------- +const U32 LLSD_SYNTAX_LSL_VERSION_EXPECTED = 2; +const std::string LLSD_SYNTAX_LSL_VERSION_KEY("llsd-lsl-syntax-version"); + bool LLSyntaxIdLSL::isSupportedVersion(const LLSD& content) { bool isValid = false; @@ -328,8 +331,6 @@ bool LLSyntaxIdLSL::isSupportedVersion(const LLSD& content) * If the schema used to store LSL keywords and hints changes, this value is incremented * Note that it should _not_ be changed if the keywords and hints _content_ changes. */ - const U32 LLSD_SYNTAX_LSL_VERSION_EXPECTED = 2; - const std::string LLSD_SYNTAX_LSL_VERSION_KEY("llsd-lsl-syntax-version"); if (content.has(LLSD_SYNTAX_LSL_VERSION_KEY)) { diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index 1f7e893b38..75cfc45380 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -75,7 +75,7 @@ private: public: LLSyntaxIdLSL(); - LLSyntaxIdLSL(std::string filenameDefault, std::string simFeatureName, std::string capabilityName); + LLSyntaxIdLSL(const std::string& filename, const std::string& sim_feature, const std::string& capability); bool checkSyntaxIdChanged(); bool fetching(); @@ -104,9 +104,9 @@ protected: void loadDefaultKeywordsIntoLLSD(); void loadKeywordsIntoLLSD(); void setSyntaxId(LLUUID SyntaxId) { mSyntaxIdCurrent = SyntaxId; } - void setFileNameCurrent(std::string& name) { mFileNameCurrent = name; } - void setFileNameDefault(std::string& name) { mFileNameDefault = name; } - void setFileNameNew(std::string name) { mFileNameNew = name; } + void setFileNameCurrent(const std::string& name) { mFileNameCurrent = name; } + void setFileNameDefault(const std::string& name) { mFileNameDefault = name; } + void setFileNameNew(const std::string name) { mFileNameNew = name; } }; |