diff options
| author | Cinder <cinder.roxley@phoenixviewer.com> | 2014-05-07 19:59:41 -0600 | 
|---|---|---|
| committer | Cinder <cinder.roxley@phoenixviewer.com> | 2014-05-07 19:59:41 -0600 | 
| commit | a354d0efb33ddace2ef97e702b1e4449adcf51ad (patch) | |
| tree | 91c676b8f0503bd58602767044a184c2fc3313d3 /indra | |
| parent | 618a409e13f11ce9ded294936e1f7c1d3d1e1efc (diff) | |
| parent | 8501d6494bceeea962d7251d882ddc244a8daa7f (diff) | |
Merge up.
Diffstat (limited to 'indra')
| -rwxr-xr-x | indra/llui/llkeywords.cpp | 132 | ||||
| -rwxr-xr-x | indra/llui/llkeywords.h | 8 | ||||
| -rwxr-xr-x | indra/newview/app_settings/keywords_lsl_default.xml | 22 | ||||
| -rwxr-xr-x | indra/newview/llpreviewscript.cpp | 79 | ||||
| -rwxr-xr-x | indra/newview/llpreviewscript.h | 3 | ||||
| -rw-r--r-- | indra/newview/llscripteditor.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llsyntaxid.cpp | 55 | ||||
| -rw-r--r-- | indra/newview/llsyntaxid.h | 32 | 
8 files changed, 150 insertions, 183 deletions
| diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index c79468ba5b..2d8bd926c0 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -82,7 +82,7 @@ LLKeywords::~LLKeywords()  	mDelimiterTokenList.clear();  } -void LLKeywords::addColorGroup(const std::string key_in, const LLColor4 color) +void LLKeywords::addColorGroup(const std::string& key_in, const LLColor4& color)  {  	WStringMapIndex key ( utf8str_to_wstring(key_in) );  	mColorGroupMap[key] = color; @@ -176,82 +176,82 @@ std::string LLKeywords::getAttribute(const std::string& key)  	return (it != mAttributes.end()) ? it->second : "";  } -LLColor4 LLKeywords::getColorGroup(const std::string key_in) +LLColor4 LLKeywords::getColorGroup(const std::string& key_in)  { -	std::string ColourGroup = "Black"; +	std::string color_group = "Black";  	if (key_in == "constants-float")  	{ -		ColourGroup = "SyntaxLslConstantFloat"; +		color_group = "SyntaxLslConstantFloat";  	}  	else if (key_in == "constants-integer")  	{ -		ColourGroup = "SyntaxLslConstantInteger"; +		color_group = "SyntaxLslConstantInteger";  	}  	else if (key_in == "constants-key")  	{ -		ColourGroup = "SyntaxLslConstantKey"; +		color_group = "SyntaxLslConstantKey";  	}  	else if (key_in == "constants-rotation")  	{ -		ColourGroup = "SyntaxLslConstantRotation"; +		color_group = "SyntaxLslConstantRotation";  	}  	else if (key_in == "constants-string")  	{ -		ColourGroup = "SyntaxLslConstantString"; +		color_group = "SyntaxLslConstantString";  	}  	else if (key_in == "constants-vector")  	{ -		ColourGroup = "SyntaxLslConstantVector"; +		color_group = "SyntaxLslConstantVector";  	}  	else if (key_in == "misc-flow-label")  	{ -		ColourGroup = "SyntaxLslControlFlow"; +		color_group = "SyntaxLslControlFlow";  	}  	else if (key_in =="deprecated")  	{ -		ColourGroup = "SyntaxLslDeprecated"; +		color_group = "SyntaxLslDeprecated";  	}  	else if (key_in == "events")  	{ -		ColourGroup = "SyntaxLslEvent"; +		color_group = "SyntaxLslEvent";  	}  	else if (key_in == "functions")  	{ -		ColourGroup = "SyntaxLslFunction"; +		color_group = "SyntaxLslFunction";  	}  	else if (key_in =="god-mode")  	{ -		ColourGroup = "SyntaxLslGodMode"; +		color_group = "SyntaxLslGodMode";  	}  	else if (key_in == "types")  	{ -		ColourGroup = "SyntaxLslDataType"; +		color_group = "SyntaxLslDataType";  	}  	else if (key_in == "sections")  	{ -		ColourGroup = "SyntaxLslSection"; +		color_group = "SyntaxLslSection";  	}  	else if (key_in == "misc-double_quotation_marks")  	{ -		ColourGroup = "SyntaxLslStringLiteral"; +		color_group = "SyntaxLslStringLiteral";  	}  	else if (key_in == "misc-comments_1_sided")  	{ -		ColourGroup = "SyntaxLslComment1Sided"; +		color_group = "SyntaxLslComment1Sided";  	}  	else if (key_in == "misc-comments_2_sided")  	{ -		ColourGroup = "SyntaxLslComment2Sided";	 +		color_group = "SyntaxLslComment2Sided";	  	}  	else  	{  		LL_WARNS("SyntaxLSL") << "Color key '" << key_in << "' not recognized!" << LL_ENDL;  	} -	return LLUIColorTable::instance().getColor(ColourGroup); +	return LLUIColorTable::instance().getColor(color_group);  } -void LLKeywords::initialise(LLSD SyntaxXML) +void LLKeywords::initialize(LLSD SyntaxXML)  {  	mSyntax = SyntaxXML;  	mLoaded = true; @@ -271,107 +271,107 @@ void LLKeywords::processTokens()  	addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "/*", getColorGroup("misc-comments_2_sided"), "Comment (multi-line)\nNon-functional commentary or disabled code", "*/" );  	addToken(LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS, "\"", getColorGroup("misc-double_quotation_marks"), "String literal", "\"" ); -	LLSD::map_iterator outerIt = mSyntax.beginMap(); -	for ( ; outerIt != mSyntax.endMap(); ++outerIt) +	LLSD::map_iterator itr = mSyntax.beginMap(); +	for ( ; itr != mSyntax.endMap(); ++itr)  	{ -		if (outerIt->first == "llsd-lsl-syntax-version") +		if (itr->first == "llsd-lsl-syntax-version")  		{  			// Skip over version key.  		}  		else  		{ -			if (outerIt->second.isMap()) +			if (itr->second.isMap())  			{ -				processTokensGroup(outerIt->second, outerIt->first); +				processTokensGroup(itr->second, itr->first);  			}  			else  			{ -				LL_WARNS("LSL-Tokens-Processing") << "Map for " + outerIt->first + " entries is missing! Ignoring." << LL_ENDL; +				LL_WARNS("LSL-Tokens-Processing") << "Map for " + itr->first + " entries is missing! Ignoring." << LL_ENDL;  			}  		}  	}  	LL_INFOS("SyntaxLSL") << "Finished processing tokens." << LL_ENDL;  } -void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) +void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group)  { -	LLColor4 Color; -	LLColor4 ColorGroup; -	LLColor4 ColorDeprecated = getColorGroup("deprecated"); -	LLColor4 ColorGM = getColorGroup("god-mode"); +	LLColor4 color; +	LLColor4 color_group; +	LLColor4 color_deprecated = getColorGroup("deprecated"); +	LLColor4 color_god_mode = getColorGroup("god-mode");  	LLKeywordToken::ETokenType token_type = LLKeywordToken::TT_UNKNOWN;  	// If a new token type is added here, it must also be added to the 'addToken' method -	if (Group == "constants") +	if (group == "constants")  	{  		token_type = LLKeywordToken::TT_CONSTANT;  	} -	else if (Group == "controls") +	else if (group == "controls")  	{  		token_type = LLKeywordToken::TT_CONTROL;  	} -	else if (Group == "events") +	else if (group == "events")  	{  		token_type = LLKeywordToken::TT_EVENT;  	} -	else if (Group == "functions") +	else if (group == "functions")  	{  		token_type = LLKeywordToken::TT_FUNCTION;  	} -	else if (Group == "label") +	else if (group == "label")  	{  		token_type = LLKeywordToken::TT_LABEL;  	} -	else if (Group == "types") +	else if (group == "types")  	{  		token_type = LLKeywordToken::TT_TYPE;  	} -	ColorGroup = getColorGroup(Group); -	LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << ColorGroup << "'" << LL_ENDL; +	color_group = getColorGroup(group); +	LL_INFOS("Tokens") << "Group: '" << group << "', using color: '" << color_group << "'" << LL_ENDL; -	if (Tokens.isMap()) +	if (tokens.isMap())  	{ -		LLSD::map_iterator outerIt = Tokens.beginMap(); -		for ( ; outerIt != Tokens.endMap(); ++outerIt) +		LLSD::map_const_iterator outer_itr = tokens.beginMap(); +		for ( ; outer_itr != tokens.endMap(); ++outer_itr)  		{ -			if (outerIt->second.isMap()) +			if (outer_itr->second.isMap())  			{  				mAttributes.clear(); -				LLSD arguments = LLSD (); -				LLSD::map_iterator innerIt = outerIt->second.beginMap(); -				for ( ; innerIt != outerIt->second.endMap(); ++innerIt) +				LLSD arguments = LLSD(); +				LLSD::map_const_iterator inner_itr = outer_itr->second.beginMap(); +				for ( ; inner_itr != outer_itr->second.endMap(); ++inner_itr)  				{ -					if (innerIt->first == "arguments") +					if (inner_itr->first == "arguments")  					{  -						if (innerIt->second.isArray()) +						if (inner_itr->second.isArray())  						{ -							arguments = innerIt->second; +							arguments = inner_itr->second;  						}  					} -					else if (!innerIt->second.isMap() && !innerIt->second.isArray()) +					else if (!inner_itr->second.isMap() && !inner_itr->second.isArray())  					{ -						mAttributes[innerIt->first] = innerIt->second.asString(); +						mAttributes[inner_itr->first] = inner_itr->second.asString();  					}  					else  					{ -						LL_WARNS("SyntaxLSL") << "Not a valid attribute: " << innerIt->first << LL_ENDL; +						LL_WARNS("SyntaxLSL") << "Not a valid attribute: " << inner_itr->first << LL_ENDL;  					}  				}  				std::string tooltip = "";  				if (token_type == LLKeywordToken::TT_CONSTANT)  				{ -					ColorGroup = getColorGroup(Group + "-" + getAttribute("type")); +					color_group = getColorGroup(group + "-" + getAttribute("type"));  					tooltip = "Type: " + getAttribute("type") + ", Value: " + getAttribute("value");  				}  				else if (token_type == LLKeywordToken::TT_EVENT)  				{ -					tooltip = outerIt->first + "(" + getArguments(arguments) + ")"; +					tooltip = outer_itr->first + "(" + getArguments(arguments) + ")";  				}  				else if (token_type == LLKeywordToken::TT_FUNCTION)  				{ -					tooltip = getAttribute("return") + " " + outerIt->first + "(" + getArguments(arguments) + ");"; +					tooltip = getAttribute("return") + " " + outer_itr->first + "(" + getArguments(arguments) + ");";  					tooltip += "\nEnergy: ";  					tooltip += getAttribute("energy") == "" ? "0.0" : getAttribute("energy");  					if (getAttribute("sleep") != "") @@ -389,28 +389,28 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group)  					tooltip += getAttribute("tooltip");  				} -				Color = getAttribute("deprecated") == "true" ? ColorDeprecated : ColorGroup; +				color = getAttribute("deprecated") == "true" ? color_deprecated : color_group;  				if (getAttribute("god-mode") == "true")  				{ -					Color = ColorGM; +					color = color_god_mode;  				} -				addToken(token_type, outerIt->first, Color, tooltip); +				addToken(token_type, outer_itr->first, color, tooltip);  			}  		}  	} -	else if (Tokens.isArray())	// Currently nothing should need this, but it's here for completeness +	else if (tokens.isArray())	// Currently nothing should need this, but it's here for completeness  	{ -		LL_INFOS("SyntaxLSL") << "Curious, shouldn't be an array here; adding all using color " << Color << LL_ENDL; -		for (int count = 0; count < Tokens.size(); ++count) +		LL_INFOS("SyntaxLSL") << "Curious, shouldn't be an array here; adding all using color " << color << LL_ENDL; +		for (int count = 0; count < tokens.size(); ++count)  		{ -			addToken(token_type, Tokens[count], Color, ""); +			addToken(token_type, tokens[count], color, "");  		}  	}  	else  	{ -		LL_WARNS("Tokens") << "Invalid map/array passed: '" << Tokens << "'" << LL_ENDL; +		LL_WARNS("Tokens") << "Invalid map/array passed: '" << tokens << "'" << LL_ENDL;  	}  } @@ -511,11 +511,11 @@ LLColor4 LLKeywords::readColor(LLSD& sd)  {  	if (sd.isArray())  	{ -		return LLColor4 (sd, 1.f); +		return LLColor4(sd, 1.f);  	}  	else if (sd.isMap())  	{ -		return LLColor4 ( sd.get("x").asReal(), sd.get("y").asReal(), sd.get("z").asReal(), 1.f ); +		return LLColor4( sd.get("x").asReal(), sd.get("y").asReal(), sd.get("z").asReal(), 1.f );  	}  	else  	{ diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 69bc8919db..eecb327fee 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -109,13 +109,13 @@ public:  	LLKeywords();  	~LLKeywords(); -	void		addColorGroup(const std::string key_in, const LLColor4 color); +	void		addColorGroup(const std::string& key_in, const LLColor4& color);  	void		clearLoaded() { mLoaded = false; } -	LLColor4	getColorGroup(const std::string key_in); +	LLColor4	getColorGroup(const std::string& key_in);  	bool		isLoaded() const	{ return mLoaded; }  	void		findSegments(std::vector<LLTextSegmentPtr> *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); -	void		initialise(LLSD SyntaxXML); +	void		initialize(LLSD SyntaxXML);  	void		processTokens();  	// Add the token as described @@ -167,7 +167,7 @@ public:  #endif  protected: -	void		processTokensGroup(LLSD& Tokens, const std::string Group); +	void		processTokensGroup(const LLSD& Tokens, const std::string& Group);  	LLColor4	readColor(const std::string& s);  	LLColor4	readColor(LLSD& sd);  	void		insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); diff --git a/indra/newview/app_settings/keywords_lsl_default.xml b/indra/newview/app_settings/keywords_lsl_default.xml index 83801a7e1e..02823136ee 100755 --- a/indra/newview/app_settings/keywords_lsl_default.xml +++ b/indra/newview/app_settings/keywords_lsl_default.xml @@ -21,7 +21,7 @@           <key>for</key>           <map>              <key>tooltip</key> -            <string>for loop\nfor (<initialiser>; <condition>; <post-iteration-statement>)\n{ ...\n}</string> +            <string>for loop\nfor (<initializer>; <condition>; <post-iteration-statement>)\n{ ...\n}</string>           </map>           <key>if</key>           <map> @@ -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 7858b573ae..befec98849 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()->initialize(); -	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()->initialize(); +	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 99b2f811f9..8b98b908e1 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -76,7 +76,7 @@ protected:  public:  	~LLScriptEdCore(); -	void			initialiseKeywords(); +	void			initializeKeywords();  	void			initMenu();  	void			processKeywords();  	void			processLoaded(); @@ -155,7 +155,6 @@ private:  	BOOL			mEnableSave;  	BOOL			mHasScriptData;  	LLLiveLSLFile*	mLiveFile; -	LLSyntaxIdLSL	mSyntaxIdLSL;  	LLScriptEdContainer* mContainer; // parent view diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp index 12c328e809..31d3c29af4 100644 --- a/indra/newview/llscripteditor.cpp +++ b/indra/newview/llscripteditor.cpp @@ -46,7 +46,7 @@ LLScriptEditor::LLScriptEditor(const Params& p)  void LLScriptEditor::initKeywords()  { -	mKeywords.initialise(LLSyntaxIdLSL::getInstance()->getKeywordsXML()); +	mKeywords.initialize(LLSyntaxIdLSL::getInstance()->getKeywordsXML());  }  LLTrace::BlockTimerStatHandle FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting"); diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 14265fd3af..3582ac024d 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -70,7 +70,7 @@ void fetchKeywordsFileResponder::result(const LLSD& content_ref)  					<< "Supported verson of syntax file." << LL_ENDL;  			LLSyntaxIdLSL::setKeywordsXml(content_ref); -			LLSyntaxIdLSL::sInitialised = true; +			LLSyntaxIdLSL::sInitialized = true;  			LLSyntaxIdLSL::sLoaded = true;  			LLSyntaxIdLSL::sLoadFailed = false; @@ -117,23 +117,23 @@ const std::string LLSyntaxIdLSL::CAPABILITY_NAME = "LSLSyntax";  const std::string LLSyntaxIdLSL::FILENAME_DEFAULT = "keywords_lsl_default.xml";  const std::string LLSyntaxIdLSL::SIMULATOR_FEATURE = "LSLSyntaxId"; -bool LLSyntaxIdLSL::sInitialised; +bool LLSyntaxIdLSL::sInitialized;  LLSD LLSyntaxIdLSL::sKeywordsXml;  bool LLSyntaxIdLSL::sLoaded;  bool LLSyntaxIdLSL::sLoadFailed;  bool LLSyntaxIdLSL::sVersionChanged; -LLSyntaxIdLSL::file_fetched_signal_t	LLSyntaxIdLSL::sFileFetchedSignal; +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();  } @@ -207,7 +207,7 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged()  			}  			else  			{ -				if ( mSyntaxIdCurrent.isNull() && isInitialised()) +				if ( mSyntaxIdCurrent.isNull() && isInitialized())  				{  					LL_INFOS("SyntaxLSL")  							<< "It does not have LSLSyntaxId capability, remaining with default keywords file!" @@ -255,9 +255,9 @@ void LLSyntaxIdLSL::fetchKeywordsFile()  //----------------------------------------------------------------------------- -// initialise +// initialize  //----------------------------------------------------------------------------- -void LLSyntaxIdLSL::initialise() +void LLSyntaxIdLSL::initialize()  {  	mFileNameNew = mFileNameCurrent;  	mSyntaxIdNew = mSyntaxIdCurrent; @@ -309,7 +309,7 @@ void LLSyntaxIdLSL::initialise()  			loadDefaultKeywordsIntoLLSD();  		}  	} -	else if (!isInitialised()) +	else if (!isInitialized())  	{  		loadDefaultKeywordsIntoLLSD();  	} @@ -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))  	{ @@ -354,8 +355,7 @@ bool LLSyntaxIdLSL::isSupportedVersion(const LLSD& content)  //-----------------------------------------------------------------------------  void LLSyntaxIdLSL::loadDefaultKeywordsIntoLLSD()  { -	LL_INFOS("SyntaxLSL") -			<< "LSLSyntaxId is null so we will use the default file!" << LL_ENDL; +	LL_INFOS("SyntaxLSL") << "LSLSyntaxId is null so we will use the default file!" << LL_ENDL;  	mSyntaxIdNew = LLUUID();  	buildFullFileSpec();  	loadKeywordsIntoLLSD(); @@ -372,9 +372,7 @@ void LLSyntaxIdLSL::loadDefaultKeywordsIntoLLSD()   */  void LLSyntaxIdLSL::loadKeywordsIntoLLSD()  { -	LL_INFOS("SyntaxLSL") -			<< "Trying to open cached or default keyword file ;-)" -			<< LL_ENDL; +	LL_INFOS("SyntaxLSL") << "Trying to open cached or default keyword file" << LL_ENDL;  	// Is this the right thing to do, or should we leave the old content  	// even if it isn't entirely accurate anymore? @@ -388,9 +386,7 @@ void LLSyntaxIdLSL::loadKeywordsIntoLLSD()  		sLoaded = (bool)LLSDSerialize::fromXML(content, file);  		if (!sLoaded)  		{ -			LL_WARNS("SyntaxLSL") -					<< "Unable to deserialise file: " -					<< mFullFileSpec << LL_ENDL; +			LL_WARNS("SyntaxLSL") << "Unable to deserialise file: " << mFullFileSpec << LL_ENDL;  		}  		else  		{ @@ -398,15 +394,13 @@ void LLSyntaxIdLSL::loadKeywordsIntoLLSD()  			{  				sKeywordsXml = content;  				sLoaded = true; -				sInitialised = true; -				LL_INFOS("SyntaxLSL") -						<< "Deserialised file: " << mFullFileSpec << LL_ENDL; +				sInitialized = true; +				LL_INFOS("SyntaxLSL") << "Deserialised file: " << mFullFileSpec << LL_ENDL;  			}  			else  			{  				sLoaded = false; -				LL_WARNS("SyntaxLSL") -					<< "Unknown or unsupported version of syntax file." << LL_ENDL; +				LL_WARNS("SyntaxLSL") << "Unknown or unsupported version of syntax file." << LL_ENDL;  			}  		}  	} @@ -421,8 +415,3 @@ boost::signals2::connection LLSyntaxIdLSL::addFileFetchedCallback(const file_fet  {  	return sFileFetchedSignal.connect(cb);  } - -void LLSyntaxIdLSL::removeFileFetchedCallback(boost::signals2::connection callback) -{ -	sFileFetchedSignal.disconnect(callback); -} diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index 1f7e893b38..b68f3f4237 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -36,23 +36,18 @@  #include "llsingleton.h"  #include "llviewerregion.h" - -/** - * @file llsyntaxid.h - * @brief Tracks the file needed to decorate the current sim's version of LSL. - */ -class LLSyntaxIdLSL: public LLSingleton<LLSyntaxIdLSL> +class LLSyntaxIdLSL : public LLSingleton<LLSyntaxIdLSL>  {  friend class fetchKeywordsFileResponder;  public:  	typedef boost::signals2::signal<void()> file_fetched_signal_t; -	static const std::string	CAPABILITY_NAME; -	static const std::string	FILENAME_DEFAULT; -	static const std::string	SIMULATOR_FEATURE; +	static const std::string CAPABILITY_NAME; +	static const std::string FILENAME_DEFAULT; +	static const std::string SIMULATOR_FEATURE;  protected: -	static bool		sInitialised; +	static bool		sInitialized;  	static LLSD		sKeywordsXml;  	static bool		sLoaded;  	static bool		sLoadFailed; @@ -75,7 +70,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(); @@ -85,16 +80,15 @@ public:  	LLSD			getKeywordsXML()		const { return sKeywordsXml; }  	LLUUID			getSyntaxId()			const { return mSyntaxIdCurrent; }  	bool			isDifferentVersion()	const { return sVersionChanged; } -	bool			isInitialised()			const { return sInitialised; } +	bool			isInitialized()			const { return sInitialized; } -	void			initialise(); +	void			initialize();  	bool			isLoaded() { return sLoaded; }  	static bool		isSupportedVersion(const LLSD& content);  	static void		setKeywordsXml(const LLSD& content) { sKeywordsXml = content; }  	boost::signals2::connection		addFileFetchedCallback(const file_fetched_signal_t::slot_type& cb); -	void							removeFileFetchedCallback(boost::signals2::connection callback);  protected: @@ -104,16 +98,12 @@ 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; }  }; -/** - * @file  llsyntaxid.h - * @brief Handles responses for the LSLSyntax capability's get call. Is a friend of LLSyntaxIdLSL - */  class fetchKeywordsFileResponder : public LLHTTPClient::Responder  {  public: | 
