diff options
author | Cinder <cinder.roxley@phoenixviewer.com> | 2014-04-18 23:13:57 -0600 |
---|---|---|
committer | Cinder <cinder.roxley@phoenixviewer.com> | 2014-04-18 23:13:57 -0600 |
commit | dcffb97518cb2888489c93b90862518f761967dd (patch) | |
tree | 5d4afbda134d7c0f63c48abcd6aa211f8d4fb782 /indra/llui | |
parent | 54c7b96bf19efd28cc7ce81c0864ee7bbb7d6b1d (diff) |
Move some more script editor functions from LLTextEditor to LLScriptEditor
Diffstat (limited to 'indra/llui')
-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 |
4 files changed, 11 insertions, 59 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 |