diff options
Diffstat (limited to 'indra')
| -rwxr-xr-x | indra/llui/llkeywords.cpp | 6 | ||||
| -rwxr-xr-x | indra/llui/llkeywords.h | 12 | ||||
| -rwxr-xr-x | indra/llui/lltexteditor.cpp | 37 | ||||
| -rwxr-xr-x | indra/llui/lltexteditor.h | 15 | ||||
| -rwxr-xr-x | indra/newview/llpreviewscript.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llscripteditor.cpp | 44 | ||||
| -rw-r--r-- | indra/newview/llscripteditor.h | 14 | ||||
| -rwxr-xr-x | indra/newview/skins/default/xui/en/floater_region_debug_console.xml | 1 | ||||
| -rwxr-xr-x | indra/newview/skins/default/xui/en/panel_script_ed.xml | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/script_editor.xml | 4 | 
10 files changed, 71 insertions, 66 deletions
| diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index e2ffd30f8d..07c84e57c0 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -89,7 +89,7 @@ void LLKeywords::addColorGroup(const std::string key_in, const LLColor4 color)  }  // Add the token as described -void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, +void LLKeywords::addToken(LLKeywordToken::ETokenType type,  						  const std::string& key_in,  						  const LLColor4& color,  						  const std::string& tool_tip_in, @@ -300,7 +300,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group)  	LLColor4 ColorDeprecated = getColorGroup("deprecated");  	LLColor4 ColorGM = getColorGroup("god-mode"); -	LLKeywordToken::TOKEN_TYPE token_type = LLKeywordToken::TT_UNKNOWN; +	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")  	{ @@ -633,7 +633,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW  					seg_start = cur - base;  					cur += cur_delimiter->getLengthHead(); -					LLKeywordToken::TOKEN_TYPE type = cur_delimiter->getType(); +					LLKeywordToken::ETokenType type = cur_delimiter->getType();  					if( type == LLKeywordToken::TT_TWO_SIDED_DELIMITER || type == LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS )  					{  						while( *cur && !cur_delimiter->isTail(cur)) diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 2f7932f815..69bc8919db 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -53,7 +53,7 @@ public:  	 * - TT_TWO_SIDED_DELIMITER are for delimiters that end with a different delimiter than they open with.  	 * - TT_DOUBLE_QUOTATION_MARKS are for delimiting areas using the same delimiter to open and close.  	 */ -	enum TOKEN_TYPE +	typedef enum e_token_type  	{  		TT_UNKNOWN,  		TT_WORD, @@ -69,9 +69,9 @@ public:  		TT_LABEL,							// LINE  		TT_SECTION,							// WORD  		TT_TYPE								// WORD -	}; +	} ETokenType; -	LLKeywordToken( TOKEN_TYPE type, const LLColor4& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter  ) +	LLKeywordToken( ETokenType type, const LLColor4& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter  )  		:  		mType( type ),  		mToken( token ), @@ -87,7 +87,7 @@ public:  	bool				isTail(const llwchar* s) const;  	const LLWString&	getToken() const		{ return mToken; }  	const LLColor4&		getColor() const		{ return mColor; } -	TOKEN_TYPE			getType()  const		{ return mType; } +	ETokenType			getType()  const		{ return mType; }  	const LLWString&	getToolTip() const		{ return mToolTip; }  	const LLWString&	getDelimiter() const	{ return mDelimiter; } @@ -96,7 +96,7 @@ public:  #endif  private: -	TOKEN_TYPE	mType; +	ETokenType	mType;  	LLWString	mToken;  	LLColor4	mColor;  	LLWString	mToolTip; @@ -119,7 +119,7 @@ public:  	void		processTokens();  	// Add the token as described -	void addToken(LLKeywordToken::TOKEN_TYPE type, +	void addToken(LLKeywordToken::ETokenType type,  					const std::string& key,  					const LLColor4& color,  					const std::string& tool_tip = LLStringUtil::null, diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 8120f3f9a1..b18c545f30 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2511,43 +2511,6 @@ BOOL LLTextEditor::tryToRevertToPristineState()  	return isPristine(); // TRUE => success  } - -static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting"); -void LLTextEditor::loadKeywords() -{ -	LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); -	mKeywords.processTokens(); - -	segment_vec_t segment_list; -	mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); - -	mSegments.clear(); -	segment_set_t::iterator insert_it = mSegments.begin(); -	for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it) -	{ -		insert_it = mSegments.insert(insert_it, *list_it); -	} -} - -void LLTextEditor::updateSegments() -{ -	if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly) -	{ -		LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); -		// HACK:  No non-ascii keywords for now -		segment_vec_t segment_list; -		mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); - -		clearSegments(); -		for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it) -		{ -			insertSegment(*list_it); -		} -	} - -	LLTextBase::updateSegments(); -} -  void LLTextEditor::updateLinkSegments()  {  	LLWString wtext = getWText(); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 09c56fca5a..6c14ad90a5 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -30,7 +30,6 @@  #define LL_LLTEXTEDITOR_H  #include "llrect.h" -#include "llkeywords.h"  #include "llframetimer.h"  #include "lldarray.h"  #include "llstyle.h" @@ -45,7 +44,6 @@  class LLFontGL;  class LLScrollbar; -class LLKeywordToken;  class TextCmd;  class LLUICtrlFactory;  class LLScrollContainer; @@ -188,14 +186,6 @@ public:  	void			getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ); -	LLKeywords		mKeywords; -	void			loadKeywords(); -	LLKeywords::keyword_iterator_t keywordsBegin()	{ return mKeywords.begin(); } -	LLKeywords::keyword_iterator_t keywordsEnd()	{ return mKeywords.end(); } - -	void			loadKeywords(const std::string& filename_keywords, -								const std::string& filename_colors); -  	// Hacky methods to make it into a word-wrapping, potentially scrolling,  	// read-only text box.  	void			setCommitOnFocusLost(BOOL b)			{ mCommitOnFocusLost = b; } @@ -293,8 +283,8 @@ protected:  	BOOL				mShowLineNumbers;  	bool				mAutoIndent; +	bool				mParseOnTheFly; -	/*virtual*/ void	updateSegments();  	void				updateLinkSegments();  private: @@ -331,7 +321,6 @@ private:  	BOOL			mAllowEmbeddedItems;  	bool			mShowContextMenu; -	bool			mParseOnTheFly;  	bool			mEnableTooltipPaste;  	bool			mPassDelete; @@ -351,4 +340,4 @@ extern template class LLTextEditor* LLView::getChild<class LLTextEditor>(  	const std::string& name, BOOL recurse) const;  #endif -#endif  // LL_TEXTEDITOR_ +#endif  // LL_TEXTEDITOR_H diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 0d95874406..e778015965 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -472,8 +472,7 @@ void LLScriptEdCore::processKeywords()  		if (mSyntaxIdLSL.isLoaded())  		{ -			mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); - +			mEditor->initKeywords();  			mEditor->loadKeywords();  			std::vector<std::string> primary_keywords; diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp index 67a43c0ef0..61b5eec9fc 100644 --- a/indra/newview/llscripteditor.cpp +++ b/indra/newview/llscripteditor.cpp @@ -28,6 +28,8 @@  #include "linden_common.h"  #include "llscripteditor.h" +#include "llsyntaxid.h" +  static LLDefaultChildRegistry::Register<LLScriptEditor> r("script_editor");  LLScriptEditor::LLScriptEditor::Params::Params() @@ -42,6 +44,48 @@ LLScriptEditor::LLScriptEditor(const Params& p)  } +void LLScriptEditor::initKeywords() +{ +	mKeywords.initialise(LLSyntaxIdLSL::getInstance()->getKeywordsXML()); +} + +static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting"); + +void LLScriptEditor::loadKeywords() +{ +	LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); +	mKeywords.processTokens(); +	 +	segment_vec_t segment_list; +	mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); +	 +	mSegments.clear(); +	segment_set_t::iterator insert_it = mSegments.begin(); +	for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it) +	{ +		insert_it = mSegments.insert(insert_it, *list_it); +	} +} + +void LLScriptEditor::updateSegments() +{ +	if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly) +	{ +		LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); +		// HACK:  No non-ascii keywords for now +		segment_vec_t segment_list; +		mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); +		 +		clearSegments(); +		for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it) +		{ +			insertSegment(*list_it); +		} +	} +	 +	LLTextBase::updateSegments(); +} +  void LLScriptEditor::clearSegments()  {  	if (!mSegments.empty()) diff --git a/indra/newview/llscripteditor.h b/indra/newview/llscripteditor.h index a0bee36a25..86c915d6a0 100644 --- a/indra/newview/llscripteditor.h +++ b/indra/newview/llscripteditor.h @@ -41,11 +41,21 @@ public:  	};  	virtual ~LLScriptEditor() {}; -	void clearSegments(); +	void	initKeywords(); +	void	loadKeywords(); +	void	clearSegments(); +	LLKeywords::keyword_iterator_t keywordsBegin()	{ return mKeywords.begin(); } +	LLKeywords::keyword_iterator_t keywordsEnd()	{ return mKeywords.end(); }  protected:  	LLScriptEditor(const Params& p); - +	 +private: +	void	updateSegments(); +	void	loadKeywords(const std::string& filename_keywords, +						 const std::string& filename_colors); +	 +	LLKeywords	mKeywords;  };  #endif // LL_SCRIPTEDITOR_H diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml index 99b812a880..11172d8a3e 100755 --- a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml +++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml @@ -21,7 +21,6 @@      layout="topleft"      max_length="65536"      name="region_debug_console_output" -    show_line_numbers="false"       word_wrap="true"      track_end="true"      read_only="true"> diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index 3e88e2dc04..1a4f0aff73 100755 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -161,7 +161,6 @@       name="Script Editor"       text_readonly_color="DkGray"       width="487" -     show_line_numbers="true"        enable_tooltip_paste="true"       word_wrap="true">          Loading... diff --git a/indra/newview/skins/default/xui/en/script_editor.xml b/indra/newview/skins/default/xui/en/script_editor.xml index d24833e85c..b030a117fc 100644 --- a/indra/newview/skins/default/xui/en/script_editor.xml +++ b/indra/newview/skins/default/xui/en/script_editor.xml @@ -1,5 +1,7 @@  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>  <script_editor      name="script_editor" -    parse_urls="false"> +    parse_urls="false" +	show_context_menu="true" +	show_line_numbers="true">  </script_editor> | 
