From 7183cecd14fbdc3cd31e1482248fabec7b23b1fb Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Tue, 5 Feb 2013 16:37:37 +0000 Subject: STORM-1831 merging in previous work --- indra/llui/llkeywords.cpp | 558 ++++++++++++++++++++++++++++++++------------ indra/llui/llkeywords.h | 81 +++++-- indra/llui/lltexteditor.cpp | 8 +- indra/llui/lltexteditor.h | 35 ++- 4 files changed, 487 insertions(+), 195 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index c1cd04186b..2ff0298ba6 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llkeywords.cpp * @brief Keyword list for LSL * * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -29,12 +29,12 @@ #include #include +#include "lldir.h" #include "llkeywords.h" +#include "llsdserialize.h" #include "lltexteditor.h" #include "llstl.h" -#include -const U32 KEYWORD_FILE_CURRENT_VERSION = 2; inline BOOL LLKeywordToken::isHead(const llwchar* s) const { @@ -53,10 +53,6 @@ inline BOOL LLKeywordToken::isHead(const llwchar* s) const return res; } -LLKeywords::LLKeywords() : mLoaded(FALSE) -{ -} - inline BOOL LLKeywordToken::isTail(const llwchar* s) const { BOOL res = TRUE; @@ -73,6 +69,12 @@ inline BOOL LLKeywordToken::isTail(const llwchar* s) const return res; } +LLKeywords::LLKeywords() : mLoaded(FALSE) +{ + setFilenameColors( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_colors.xml") ); + setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_tokens.xml") ); +} + LLKeywords::~LLKeywords() { std::for_each(mWordTokenMap.begin(), mWordTokenMap.end(), DeletePairedPointer()); @@ -80,180 +82,418 @@ LLKeywords::~LLKeywords() std::for_each(mDelimiterTokenList.begin(), mDelimiterTokenList.end(), DeletePointer()); } -BOOL LLKeywords::loadFromFile( const std::string& filename ) + + +void LLKeywords::addColorGroup(const std::string key_in, const LLColor3 color) { - mLoaded = FALSE; + WStringMapIndex key ( utf8str_to_wstring(key_in) ); + mColorGroupMap[key] = color; +} - //////////////////////////////////////////////////////////// - // File header +// Add the token as described +void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, + const std::string& key_in, + const LLColor3& color, + const std::string& tool_tip_in, + const std::string& delimiter_in) +{ + std::string tip_text = tool_tip_in; + LLStringUtil::replaceString(tip_text, "\\n", "\n" ); + LLStringUtil::replaceString(tip_text, "\t", " " ); + if (tip_text =="") + { + tip_text = "[no info]"; + } + LLWString tool_tip = utf8str_to_wstring(tip_text); - const S32 BUFFER_SIZE = 1024; - char buffer[BUFFER_SIZE]; /* Flawfinder: ignore */ + LLWString key = utf8str_to_wstring(key_in); + LLWString delimiter = utf8str_to_wstring(delimiter_in); + switch(type) + { + case LLKeywordToken::TT_CONSTANT: + case LLKeywordToken::TT_EVENT: + case LLKeywordToken::TT_FLOW: + case LLKeywordToken::TT_FUNCTION: + case LLKeywordToken::TT_LABEL: + case LLKeywordToken::TT_SECTION: + case LLKeywordToken::TT_TYPE: + case LLKeywordToken::TT_WORD: + mWordTokenMap[key] = new LLKeywordToken(type, color, key, tool_tip, LLWStringUtil::null); + break; - llifstream file; - file.open(filename); /* Flawfinder: ignore */ - if( file.fail() ) + case LLKeywordToken::TT_LINE: + mLineTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip, LLWStringUtil::null)); + break; + + case LLKeywordToken::TT_TWO_SIDED_DELIMITER: + case LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS: + case LLKeywordToken::TT_ONE_SIDED_DELIMITER: + mDelimiterTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip, delimiter)); + break; + + default: + llassert(0); + } +} + +std::string LLKeywords::getArguments(LLSD& arguments) +{ + std::string args = ""; + if (arguments.isArray()) { - llinfos << "LLKeywords::loadFromFile() Unable to open file: " << filename << llendl; - return mLoaded; + int count = 0; + do + { + LLSD arg = arguments[count]; + args += arg.get("type").asString() + " " + arg.get("name").asString(); + ++count; + if (arguments.size() - count > 0) + { + args += ", "; + } + } while (count < arguments.size()); } + else + { + LL_WARNS("Arguments") << "Not an array! Invalid LLSD passed to function.\n" << arguments << LL_ENDL; + } + return args == "" ? " void " : args; +} - // Identifying string - file >> buffer; - if( strcmp( buffer, "llkeywords" ) ) +std::string LLKeywords::getAttribute(const std::string& key) +{ + attribute_iterator_t it = mAttributes.find(key); + return (it != mAttributes.end()) ? it->second : ""; +} + +LLColor3 LLKeywords::getColorGroup(const std::string key_in) +{ + // LLColor3 initialises to Black (0,0,0) + LLColor3 Colour; + WStringMapIndex key ( utf8str_to_wstring(key_in) ); + group_color_map_t::iterator it = mColorGroupMap.find(key); + if (it == mColorGroupMap.end()) + { + LL_WARNS("Colour lookup") << "'" << key_in << "' not found!" << LL_ENDL; + } + else { - llinfos << filename << " does not appear to be a keyword file" << llendl; - return mLoaded; + Colour = it->second; } - // Check file version - file >> buffer; - U32 version_num; - file >> version_num; - if( strcmp(buffer, "version") || version_num != (U32)KEYWORD_FILE_CURRENT_VERSION ) + return Colour; +} + +BOOL LLKeywords::initialise() +{ + mReady = false; + + if (! loadIntoLLSD(mFilenameColors, mColors) ) { - llinfos << filename << " does not appear to be a version " << KEYWORD_FILE_CURRENT_VERSION << " keyword file" << llendl; - return mLoaded; + LL_ERRS("") << "Failed to load color data, cannot continue!" << LL_ENDL; + } + else if (! loadIntoLLSD(mFilenameSyntax, mSyntax) ) + { + LL_ERRS("") << "Failed to load syntax data from '" << mFilenameSyntax << "', cannot continue!" << LL_ENDL; + } + else + { + mReady = true; } - // start of line (SOL) - std::string SOL_COMMENT("#"); - std::string SOL_WORD("[word "); - std::string SOL_LINE("[line "); - std::string SOL_ONE_SIDED_DELIMITER("[one_sided_delimiter "); - std::string SOL_TWO_SIDED_DELIMITER("[two_sided_delimiter "); - std::string SOL_DOUBLE_QUOTATION_MARKS("[double_quotation_marks "); + if (ready()) + { + processColors(); + } + else + { + LL_ERRS("") << LL_ENDL; + LL_ERRS("") << "Failed to load one or both data files, cannot continue!" << LL_ENDL; + } + return mReady; +} - LLColor3 cur_color( 1, 0, 0 ); - LLKeywordToken::TOKEN_TYPE cur_type = LLKeywordToken::WORD; +BOOL LLKeywords::loadFromFile() +{ + processTokens(); + return true; +} - while (!file.eof()) +/** + * @brief Load xml serialised LLSD + * @desc Opens the specified filespec and attempts to deserialise the + * contained data to the specified LLSD object. + * @return Returns boolean true/false indicating success or failure. + */ +BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) +{ + mLoaded = false; + llifstream file; + file.open(filename); + if(file.is_open()) { - buffer[0] = 0; - file.getline( buffer, BUFFER_SIZE ); - std::string line(buffer); - if( line.find(SOL_COMMENT) == 0 ) - { - continue; - } - else if( line.find(SOL_WORD) == 0 ) + mLoaded = (BOOL)LLSDSerialize::fromXML(data, file); + if (!mLoaded) { - cur_color = readColor( line.substr(SOL_WORD.size()) ); - cur_type = LLKeywordToken::WORD; - continue; + LL_WARNS("") << "Unable to deserialise file: " << filename << LL_ENDL; } - else if( line.find(SOL_LINE) == 0 ) + else { - cur_color = readColor( line.substr(SOL_LINE.size()) ); - cur_type = LLKeywordToken::LINE; - continue; - } - else if( line.find(SOL_TWO_SIDED_DELIMITER) == 0 ) - { - cur_color = readColor( line.substr(SOL_TWO_SIDED_DELIMITER.size()) ); - cur_type = LLKeywordToken::TWO_SIDED_DELIMITER; - continue; - } - else if( line.find(SOL_DOUBLE_QUOTATION_MARKS) == 0 ) - { - cur_color = readColor( line.substr(SOL_DOUBLE_QUOTATION_MARKS.size()) ); - cur_type = LLKeywordToken::DOUBLE_QUOTATION_MARKS; - continue; - } - else if( line.find(SOL_ONE_SIDED_DELIMITER) == 0 ) - { - cur_color = readColor( line.substr(SOL_ONE_SIDED_DELIMITER.size()) ); - cur_type = LLKeywordToken::ONE_SIDED_DELIMITER; - continue; + LL_INFOS("") << "Deserialised file: " << filename << LL_ENDL; } + } + else + { + LL_WARNS("") << "Unable to open file: " << filename << LL_ENDL; + } + return mLoaded; +} + +/** + * @brief Start processing the colour LLSD from its beginning. + * + */ +std::string LLKeywords::processColors() +{ + return processColors(mColors, ""); +} - std::string token_buffer( line ); - LLStringUtil::trim(token_buffer); - - typedef boost::tokenizer > tokenizer; - boost::char_separator sep_word("", " \t"); - tokenizer word_tokens(token_buffer, sep_word); - tokenizer::iterator token_word_iter = word_tokens.begin(); +/** + * @brief Recursively process the colour LLSD from an arbitrary level. + * @desc Process the supplied LLSD for colour data. The strPrefix is a string + * of hyphen separated keys from previous levels. + */ +std::string LLKeywords::processColors(LLSD &settings, const std::string strPrefix) +{ + if (settings.isMap() || (! settings.isMap() && strPrefix != "") ) + { + LLSD llsd_map = settings; - if( !token_buffer.empty() && token_word_iter != word_tokens.end() ) + LLSD::map_iterator my_iter = llsd_map.beginMap(); + for ( ; my_iter != llsd_map.endMap(); ++my_iter) { - // first word is the keyword or a left delimiter - std::string keyword = (*token_word_iter); - LLStringUtil::trim(keyword); + std::string strGroup = strPrefix; + const LLSD::String& key = my_iter->first; + LLSD& value = my_iter->second; - // second word may be a right delimiter - std::string delimiter; - if (cur_type == LLKeywordToken::TWO_SIDED_DELIMITER) + if (key == "color") { - while (delimiter.length() == 0 && ++token_word_iter != word_tokens.end()) + if (value.isMap() || value.isArray()) + { + addColorGroup(strGroup, readColor(value)); + } + else { - delimiter = *token_word_iter; - LLStringUtil::trim(delimiter); + LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; } } - else if (cur_type == LLKeywordToken::DOUBLE_QUOTATION_MARKS) + else if (value.isMap()) + { + strGroup += (strGroup.length() == 0) ? my_iter->first : "-" + my_iter->first; + strGroup = processColors(value, strGroup); + } + else { - // Closing delimiter is identical to the opening one. - delimiter = keyword; + LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; } + } + } + return strPrefix; +} - // following words are tooltip - std::string tool_tip; - while (++token_word_iter != word_tokens.end()) +void LLKeywords::processTokens() +{ + // Add 'standard' stuff: Quotes, Comments, Strings, Labels, etc. before processing the LLSD + std::string delimiter; + addToken(LLKeywordToken::TT_LINE, "@", getColorGroup("misc-flow-label"), "Label\nTarget for jump statement", delimiter ); + addToken(LLKeywordToken::TT_ONE_SIDED_DELIMITER, "//", getColorGroup("misc-comments_1_sided"), "Comment\nNon-functional commentary or disabled code", delimiter ); + addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "/*", getColorGroup("misc-comments_2_sided"), "Comment\nNon-functional commentary or disabled code (multi-line)", "*/" ); + addToken(LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS, "\"", getColorGroup("misc-double_quotation_marks"), "String literal", "\"" ); + + LLSD::map_iterator outerIt = mSyntax.beginMap(); + for ( ; outerIt != mSyntax.endMap(); ++outerIt) + { + // TODO Collapse the 'if's into two, those that call 'processTokens' directly and an else if (for 'misc') that doesn't + if (outerIt->first == "constants") + { + if (outerIt->second.isMap()) + { + processTokensGroup(outerIt->second, "constants"); + } + else + { + LL_ERRS("Tokens-Constants") << "No constants map to process!" << LL_ENDL; + } + } + else if(outerIt->first == "misc") + { + if (outerIt->second.isMap()) { - tool_tip += (*token_word_iter); + LLSD::map_iterator innerIt = outerIt->second.beginMap(); + for ( ; innerIt != outerIt->second.endMap(); ++innerIt) + { + processTokensGroup(innerIt->second, "misc-" + innerIt->first); + } } - LLStringUtil::trim(tool_tip); - - if( !tool_tip.empty() ) + else { - // Replace : with \n for multi-line tool tips. - LLStringUtil::replaceChar( tool_tip, ':', '\n' ); - addToken(cur_type, keyword, cur_color, tool_tip, delimiter ); + LL_ERRS("Tokens-Misc") << "No misc map to process!" << LL_ENDL; + } + } + else if(outerIt->first == "events") + { + if (outerIt->second.isMap()) + { + processTokensGroup(outerIt->second, "events"); } else { - addToken(cur_type, keyword, cur_color, LLStringUtil::null, delimiter ); + LL_ERRS("Tokens-Events") << "No event map to process!" << LL_ENDL; } } + else if(outerIt->first == "functions") + { + if (outerIt->second.isMap()) + { + processTokensGroup(outerIt->second, "functions"); + } + else + { + LL_ERRS("Tokens-Functions") << "No function map to process!" << LL_ENDL; + } + } + else if(outerIt->first == "types") + { + if (outerIt->second.isArray()) + { + processTokensGroup(outerIt->second, "types"); + } + else + { + LL_ERRS("Tokens-Types") << "No types array to process!" << LL_ENDL; + } + } + else + { + LL_ERRS("Tokens") << "Unknown token group '" << outerIt->first << "'" << LL_ENDL; + } } - - file.close(); - - mLoaded = TRUE; - return mLoaded; + LL_INFOS("") << LL_ENDL; } -// Add the token as described -void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, - const std::string& key_in, - const LLColor3& color, - const std::string& tool_tip_in, - const std::string& delimiter_in) +void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { - LLWString key = utf8str_to_wstring(key_in); - LLWString tool_tip = utf8str_to_wstring(tool_tip_in); - LLWString delimiter = utf8str_to_wstring(delimiter_in); - switch(type) + LLColor3 Color = getColorGroup(Group); + LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << Color << "'" << LL_ENDL; + + LLKeywordToken::TOKEN_TYPE 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") { - case LLKeywordToken::WORD: - mWordTokenMap[key] = new LLKeywordToken(type, color, key, tool_tip, LLWStringUtil::null); - break; + token_type = LLKeywordToken::TT_CONSTANT; + } + else if (Group == "events") + { + token_type = LLKeywordToken::TT_EVENT; + } + else if (Group == "misc-flow-control") + { + token_type = LLKeywordToken::TT_FLOW; + } + else if (Group == "functions") + { + token_type = LLKeywordToken::TT_FUNCTION; + } + else if (Group == "misc-flow-label") + { + token_type = LLKeywordToken::TT_LABEL; + } + else if (Group == "misc-sections") + { + token_type = LLKeywordToken::TT_SECTION; + } + else if (Group == "types") + { + token_type = LLKeywordToken::TT_TYPE; + } - case LLKeywordToken::LINE: - mLineTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip, LLWStringUtil::null)); - break; + if (Tokens.isMap()) // constants, events, functions, and misc + { + LLSD::map_iterator outerIt = Tokens.beginMap(); + for ( ; outerIt != Tokens.endMap(); ++outerIt) + { + if (outerIt->second.isMap()) + { + mAttributes.clear(); + LLSD arguments = LLSD (); + LLSD::map_iterator innerIt = outerIt->second.beginMap(); + for ( ; innerIt != outerIt->second.endMap(); ++innerIt) + { + if (innerIt->first != "arguments") + { + mAttributes[innerIt->first] = innerIt->second.asString(); + } + else if (innerIt->second.isArray()) + { + arguments = innerIt->second; + } + } - case LLKeywordToken::TWO_SIDED_DELIMITER: - case LLKeywordToken::DOUBLE_QUOTATION_MARKS: - case LLKeywordToken::ONE_SIDED_DELIMITER: - mDelimiterTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip, delimiter)); - break; + std::string tooltip = ""; + if (token_type == LLKeywordToken::TT_CONSTANT) + { + Color = getColorGroup(Group + "-" + getAttribute("type")); + tooltip = "Type: " + getAttribute("type") + ", Value: " + getAttribute("value"); + } + else if (token_type == LLKeywordToken::TT_EVENT) + { + tooltip = outerIt->first + "(" + getArguments(arguments) + ")"; + } + else if (token_type == LLKeywordToken::TT_FLOW) + { + tooltip = "flow baby"; + } + else if (token_type == LLKeywordToken::TT_FUNCTION) + { + tooltip = getAttribute("return") + " " + outerIt->first + "(" + getArguments(arguments) + ");"; + tooltip += "\nEnergy: "; + tooltip += getAttribute("energy") == "" ? "0.0" : getAttribute("energy"); + if (getAttribute("sleep") != "") + { + tooltip += ", Sleep: " + getAttribute("sleep"); + } + } + else if (token_type == LLKeywordToken::TT_SECTION) + { + tooltip = "section"; + } - default: - llassert(0); + if (getAttribute("summry") != "") + { + tooltip += "\n" + getAttribute("summary"); + } + else if (getAttribute("description") != "") + { + tooltip += "\n" + getAttribute("description"); + } + + addToken(token_type, outerIt->first, Color, tooltip); + } + } + } + else if (Tokens.isArray()) // types + { + for (int count = 0; count < Tokens.size(); ++count) + { + addToken(token_type, Tokens[count], Color, ""); + } + } + else + { + LL_INFOS("Tokens") << "Invalid map/array passed: '" << Tokens << "'" << LL_ENDL; } } + LLKeywords::WStringMapIndex::WStringMapIndex(const WStringMapIndex& other) { if(other.mOwner) @@ -298,13 +538,13 @@ bool LLKeywords::WStringMapIndex::operator<(const LLKeywords::WStringMapIndex &o { // NOTE: Since this is only used to organize a std::map, it doesn't matter if it uses correct collate order or not. // The comparison only needs to strictly order all possible strings, and be stable. - + bool result = false; const llwchar* self_iter = mData; const llwchar* self_end = mData + mLength; const llwchar* other_iter = other.mData; const llwchar* other_end = other.mData + other.mLength; - + while(true) { if(other_iter >= other_end) @@ -319,7 +559,7 @@ bool LLKeywords::WStringMapIndex::operator<(const LLKeywords::WStringMapIndex &o { // self is shorter than other. result = true; - break; + break; } else if(*self_iter != *other_iter) { @@ -331,7 +571,7 @@ bool LLKeywords::WStringMapIndex::operator<(const LLKeywords::WStringMapIndex &o self_iter++; other_iter++; } - + return result; } @@ -347,6 +587,22 @@ LLColor3 LLKeywords::readColor( const std::string& s ) return LLColor3( r, g, b ); } +LLColor3 LLKeywords::readColor(LLSD& sd) +{ + if (sd.isArray()) + { + return LLColor3 (sd); + } + else if (sd.isMap()) + { + return LLColor3 ( sd.get("x").asReal(), sd.get("y").asReal(), sd.get("z").asReal() ); + } + else + { + return LLColor3::black; + } +} + LLFastTimer::DeclareTimer FTM_SYNTAX_COLORING("Syntax Coloring"); // Walk through a string, applying the rules specified by the keyword token list and @@ -360,10 +616,10 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW { return; } - + S32 text_len = wtext.size() + 1; - seg_list->push_back( new LLNormalTextSegment( defaultColor, 0, text_len, editor ) ); + seg_list->push_back( new LLNormalTextSegment( defaultColor, 0, text_len, editor ) ); const llwchar* base = wtext.c_str(); const llwchar* cur = base; @@ -398,7 +654,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW continue; } - // cur is now at the first non-whitespace character of a new line + // cur is now at the first non-whitespace character of a new line // Line start tokens { @@ -416,7 +672,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW cur++; } S32 seg_end = cur - base; - + //create segments from seg_start to seg_end insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, defaultColor, editor); line_done = TRUE; // to break out of second loop. @@ -461,14 +717,14 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW seg_start = cur - base; cur += cur_delimiter->getLengthHead(); - + LLKeywordToken::TOKEN_TYPE type = cur_delimiter->getType(); - if( type == LLKeywordToken::TWO_SIDED_DELIMITER || type == LLKeywordToken::DOUBLE_QUOTATION_MARKS ) + if( type == LLKeywordToken::TT_TWO_SIDED_DELIMITER || type == LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS ) { while( *cur && !cur_delimiter->isTail(cur)) { // Check for an escape sequence. - if (type == LLKeywordToken::DOUBLE_QUOTATION_MARKS && *cur == '\\') + if (type == LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS && *cur == '\\') { // Count the number of backslashes. S32 num_backslashes = 0; @@ -515,7 +771,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW } else { - llassert( cur_delimiter->getType() == LLKeywordToken::ONE_SIDED_DELIMITER ); + llassert( cur_delimiter->getType() == LLKeywordToken::TT_ONE_SIDED_DELIMITER ); // Left side is the delimiter. Right side is eol or eof. while( *cur && ('\n' != *cur) ) { @@ -561,7 +817,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, defaultColor, editor); } - cur += seg_len; + cur += seg_len; continue; } } @@ -577,7 +833,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW void LLKeywords::insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* cur_token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor ) { std::string::size_type pos = wtext.find('\n',seg_start); - + while (pos!=-1 && pos < (std::string::size_type)seg_end) { if (pos!=seg_start) @@ -656,7 +912,7 @@ void LLKeywords::dump() void LLKeywordToken::dump() { - llinfos << "[" << + llinfos << "[" << mColor.mV[VX] << ", " << mColor.mV[VY] << ", " << mColor.mV[VZ] << "] [" << diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index ac34015393..87f65dc0bf 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -1,25 +1,25 @@ -/** +/** * @file llkeywords.h * @brief Keyword list for LSL * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -41,26 +41,35 @@ typedef LLPointer LLTextSegmentPtr; class LLKeywordToken { public: - /** + /** * @brief Types of tokens/delimters being parsed. * * @desc Tokens/delimiters that need to be identified/highlighted. All are terminated if an EOF is encountered. - * - WORD are keywords in the normal sense, i.e. constants, events, etc. - * - LINE are for entire lines (currently only flow control labels use this). - * - ONE_SIDED_DELIMITER are for open-ended delimiters which are terminated by EOL. - * - TWO_SIDED_DELIMITER are for delimiters that end with a different delimiter than they open with. - * - DOUBLE_QUOTATION_MARKS are for delimiting areas using the same delimiter to open and close. + * - TT_WORD are keywords in the normal sense, i.e. constants, events, etc. + * - TT_LINE are for entire lines (currently only flow control labels use this). + * - TT_ONE_SIDED_DELIMITER are for open-ended delimiters which are terminated by EOL. + * - 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 { - WORD, - LINE, - TWO_SIDED_DELIMITER, - ONE_SIDED_DELIMITER, - DOUBLE_QUOTATION_MARKS + TT_UNKNOWN, + TT_WORD, + TT_LINE, + TT_TWO_SIDED_DELIMITER, + TT_ONE_SIDED_DELIMITER, + TT_DOUBLE_QUOTATION_MARKS, + // Following constants are more specific versions of the preceding ones + TT_CONSTANT, // WORD + TT_EVENT, // WORD + TT_FLOW, // WORD + TT_FUNCTION, // WORD + TT_LABEL, // LINE + TT_SECTION, // WORD + TT_TYPE // WORD }; - LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter ) + LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter ) : mType( type ), mToken( token ), @@ -98,10 +107,19 @@ public: LLKeywords(); ~LLKeywords(); + void addColorGroup(const std::string key_in, const LLColor3 color); + LLColor3 getColorGroup(const std::string key_in); + BOOL loadFromFile(); BOOL loadFromFile(const std::string& filename); BOOL isLoaded() const { return mLoaded; } + void setFilenameColors(const std::string filename) { mFilenameColors = filename; } + void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); + BOOL initialise(); + std::string processColors(); + std::string processColors(LLSD &data, const std::string strGroup); + void processTokens(); // Add the token as described void addToken(LLKeywordToken::TOKEN_TYPE type, @@ -109,7 +127,7 @@ public: const LLColor3& color, const std::string& tool_tip = LLStringUtil::null, const std::string& delimiter = LLStringUtil::null); - + // This class is here as a performance optimization. // The word token map used to be defined as std::map. // This worked, but caused a performance bottleneck due to memory allocation and string copies @@ -133,6 +151,9 @@ public: const llwchar *mData; size_t mLength; bool mOwner; + + + LLColor3 mColor; }; typedef std::map word_token_map_t; @@ -140,20 +161,42 @@ public: keyword_iterator_t begin() const { return mWordTokenMap.begin(); } keyword_iterator_t end() const { return mWordTokenMap.end(); } + typedef std::map group_color_map_t; + typedef group_color_map_t::const_iterator color_iterator_t; + group_color_map_t mColorGroupMap; + #ifdef _DEBUG void dump(); #endif -private: +protected: + void processTokensGroup(LLSD& Tokens, const std::string Group); LLColor3 readColor(const std::string& s); + LLColor3 readColor(LLSD& sd); void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); void insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); + BOOL loadIntoLLSD( const std::string& filename, LLSD& data ); + LLSD mColors; BOOL mLoaded; + LLSD mSyntax; word_token_map_t mWordTokenMap; typedef std::deque token_list_t; token_list_t mLineTokenList; token_list_t mDelimiterTokenList; + + typedef std::map element_attributes_t; + typedef element_attributes_t::const_iterator attribute_iterator_t; + element_attributes_t mAttributes; + std::string getAttribute(const std::string& key); + + std::string getArguments(LLSD& args); + +private: + BOOL ready() { return mReady; }; + BOOL mReady; + std::string mFilenameColors; + std::string mFilenameSyntax; }; #endif // LL_LLKEYWORDS_H diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 144b6960a1..1728292a6b 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2416,14 +2416,8 @@ void LLTextEditor::loadKeywords(const std::string& filename, const LLColor3& color) { LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); - if(mKeywords.loadFromFile(filename)) + if(mKeywords.loadFromFile()) { - S32 count = llmin(funcs.size(), tooltips.size()); - for(S32 i = 0; i < count; i++) - { - std::string name = utf8str_trim(funcs[i]); - mKeywords.addToken(LLKeywordToken::WORD, name, color, tooltips[i] ); - } segment_vec_t segment_list; mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 40821ae9fb..070c859e46 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -1,25 +1,25 @@ -/** +/** * @file lltexteditor.h * @brief LLTextEditor base class * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -131,7 +131,7 @@ public: virtual BOOL canCopy() const; virtual void paste(); virtual BOOL canPaste() const; - + virtual void updatePrimary(); virtual void copyPrimary(); virtual void pastePrimary(); @@ -147,7 +147,7 @@ public: void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); void replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive); - + // Undo/redo stack void blockUndo(); @@ -179,6 +179,7 @@ public: void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ); + LLKeywords mKeywords; void loadKeywords(const std::string& filename, const std::vector& funcs, const std::vector& tooltips, @@ -186,6 +187,9 @@ public: 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; } @@ -207,7 +211,7 @@ protected: void drawPreeditMarker(); void assignEmbedded(const std::string &s); - + void removeCharOrTab(); void indentSelectedLines( S32 spaces ); @@ -226,12 +230,12 @@ protected: S32 nextWordPos(S32 cursorPos) const; void autoIndent(); - + void findEmbeddedItemSegments(S32 start, S32 end); void getSegmentsInRange(segment_vec_t& segments, S32 start, S32 end, bool include_partial) const; virtual llwchar pasteEmbeddedItem(llwchar ext_char) { return ext_char; } - + // Here's the method that takes and applies text commands. S32 execute(TextCmd* cmd); @@ -245,7 +249,7 @@ protected: S32 removeChar(S32 pos); S32 insert(S32 pos, const LLWString &wstr, bool group_with_next_op, LLTextSegmentPtr segment); S32 remove(S32 pos, S32 length, bool group_with_next_op); - + void updateAllowingLanguageInput(); BOOL hasPreeditString() const; @@ -262,14 +266,14 @@ protected: // // Protected data // - // Probably deserves serious thought to hiding as many of these + // Probably deserves serious thought to hiding as many of these // as possible behind protected accessor methods. // // Use these to determine if a click on an embedded item is a drag or not. S32 mMouseDownX; S32 mMouseDownY; - + LLWString mPreeditWString; LLWString mPreeditOverwrittenWString; std::vector mPreeditPositions; @@ -293,11 +297,6 @@ private: void onKeyStroke(); - // - // Data - // - LLKeywords mKeywords; - // Concrete TextCmd sub-classes used by the LLTextEditor base class class TextCmdInsert; class TextCmdAddChar; -- cgit v1.2.3 From 582babac2f1acd7f558fa4bf13034c5f306fe115 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Mon, 11 Feb 2013 21:50:38 +0000 Subject: STORM-1831 Changes to LLSD structure and corresponding processing in llkeywords. Plus some formating clean ups. --- indra/llui/llkeywords.cpp | 99 ++++++++++++++++++++++++++--------------------- indra/llui/llkeywords.h | 2 +- 2 files changed, 55 insertions(+), 46 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 2ff0298ba6..0481948a09 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -111,8 +111,8 @@ void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, switch(type) { case LLKeywordToken::TT_CONSTANT: + case LLKeywordToken::TT_CONTROL: case LLKeywordToken::TT_EVENT: - case LLKeywordToken::TT_FLOW: case LLKeywordToken::TT_FUNCTION: case LLKeywordToken::TT_LABEL: case LLKeywordToken::TT_SECTION: @@ -139,23 +139,23 @@ void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, std::string LLKeywords::getArguments(LLSD& arguments) { std::string args = ""; - if (arguments.isArray()) + if (arguments.isMap()) { - int count = 0; - do + int count = arguments.size(); + LLSD::map_iterator argsIt = arguments.beginMap(); + for ( ; argsIt != arguments.endMap(); ++argsIt) { - LLSD arg = arguments[count]; - args += arg.get("type").asString() + " " + arg.get("name").asString(); - ++count; - if (arguments.size() - count > 0) - { - args += ", "; - } - } while (count < arguments.size()); + LLSD arg = argsIt->second; + args += arg.get("type").asString() + " " + argsIt->first; + if (count-- > 1) + { + args += ", "; + } + } } - else + else if (!arguments.isUndefined()) { - LL_WARNS("Arguments") << "Not an array! Invalid LLSD passed to function.\n" << arguments << LL_ENDL; + LL_WARNS("Arguments") << "Not a map! Invalid LLSD passed to function.\n" << arguments << LL_ENDL; } return args == "" ? " void " : args; } @@ -305,7 +305,7 @@ void LLKeywords::processTokens() { // Add 'standard' stuff: Quotes, Comments, Strings, Labels, etc. before processing the LLSD std::string delimiter; - addToken(LLKeywordToken::TT_LINE, "@", getColorGroup("misc-flow-label"), "Label\nTarget for jump statement", delimiter ); + addToken(LLKeywordToken::TT_LABEL, "@", getColorGroup("label"), "Label\nTarget for jump statement", delimiter ); addToken(LLKeywordToken::TT_ONE_SIDED_DELIMITER, "//", getColorGroup("misc-comments_1_sided"), "Comment\nNon-functional commentary or disabled code", delimiter ); addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "/*", getColorGroup("misc-comments_2_sided"), "Comment\nNon-functional commentary or disabled code (multi-line)", "*/" ); addToken(LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS, "\"", getColorGroup("misc-double_quotation_marks"), "String literal", "\"" ); @@ -325,6 +325,17 @@ void LLKeywords::processTokens() LL_ERRS("Tokens-Constants") << "No constants map to process!" << LL_ENDL; } } + else if (outerIt->first == "controls") + { + if (outerIt->second.isMap()) + { + processTokensGroup(outerIt->second, "controls"); + } + else + { + LL_ERRS("Tokens-Controls") << "No controls map to process!" << LL_ENDL; + } + } else if(outerIt->first == "misc") { if (outerIt->second.isMap()) @@ -364,7 +375,7 @@ void LLKeywords::processTokens() } else if(outerIt->first == "types") { - if (outerIt->second.isArray()) + if (outerIt->second.isMap()) { processTokensGroup(outerIt->second, "types"); } @@ -392,50 +403,51 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { token_type = LLKeywordToken::TT_CONSTANT; } - else if (Group == "events") + else if (Group == "controls") { - token_type = LLKeywordToken::TT_EVENT; + token_type = LLKeywordToken::TT_CONTROL; } - else if (Group == "misc-flow-control") + else if (Group == "events") { - token_type = LLKeywordToken::TT_FLOW; + token_type = LLKeywordToken::TT_EVENT; } else if (Group == "functions") { token_type = LLKeywordToken::TT_FUNCTION; } - else if (Group == "misc-flow-label") + else if (Group == "label") { token_type = LLKeywordToken::TT_LABEL; } - else if (Group == "misc-sections") - { - token_type = LLKeywordToken::TT_SECTION; - } else if (Group == "types") { token_type = LLKeywordToken::TT_TYPE; } - if (Tokens.isMap()) // constants, events, functions, and misc + if (Tokens.isMap()) { LLSD::map_iterator outerIt = Tokens.beginMap(); for ( ; outerIt != Tokens.endMap(); ++outerIt) { + Color = getColorGroup(Group); if (outerIt->second.isMap()) { mAttributes.clear(); + bool deprecated = false; LLSD arguments = LLSD (); LLSD::map_iterator innerIt = outerIt->second.beginMap(); for ( ; innerIt != outerIt->second.endMap(); ++innerIt) { - if (innerIt->first != "arguments") - { - mAttributes[innerIt->first] = innerIt->second.asString(); + if (innerIt->first == "arguments") + { + if (innerIt->second.isMap()) + { + arguments = innerIt->second; + } } - else if (innerIt->second.isArray()) + else { - arguments = innerIt->second; + mAttributes[innerIt->first] = innerIt->second.asString(); } } @@ -449,10 +461,6 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { tooltip = outerIt->first + "(" + getArguments(arguments) + ")"; } - else if (token_type == LLKeywordToken::TT_FLOW) - { - tooltip = "flow baby"; - } else if (token_type == LLKeywordToken::TT_FUNCTION) { tooltip = getAttribute("return") + " " + outerIt->first + "(" + getArguments(arguments) + ");"; @@ -463,25 +471,26 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) tooltip += ", Sleep: " + getAttribute("sleep"); } } - else if (token_type == LLKeywordToken::TT_SECTION) - { - tooltip = "section"; - } - if (getAttribute("summry") != "") + if (getAttribute("tooltip") != "") { - tooltip += "\n" + getAttribute("summary"); + if (tooltip != "") + { + tooltip += "\n"; + } + tooltip += getAttribute("tooltip"); } - else if (getAttribute("description") != "") + + deprecated = getAttribute("deprecated") == "true" ? true : false; + if (deprecated) { - tooltip += "\n" + getAttribute("description"); + Color = getColorGroup("deprecated"); } - addToken(token_type, outerIt->first, Color, tooltip); } } } - else if (Tokens.isArray()) // types + else if (Tokens.isArray()) // Currently nothing should need this, but it's here for completeness { for (int count = 0; count < Tokens.size(); ++count) { diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 87f65dc0bf..badbd2ae85 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -61,8 +61,8 @@ public: TT_DOUBLE_QUOTATION_MARKS, // Following constants are more specific versions of the preceding ones TT_CONSTANT, // WORD + TT_CONTROL, // WORD TT_EVENT, // WORD - TT_FLOW, // WORD TT_FUNCTION, // WORD TT_LABEL, // LINE TT_SECTION, // WORD -- cgit v1.2.3 From 9db5ed51f00f98f2567882d525d9d547cac3ed62 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 14 Feb 2013 16:54:24 +0000 Subject: STORM-1831 Refactoring serial if's to be prettier ;-) + Minor edit to comment tootips --- indra/llui/llkeywords.cpp | 63 ++++++----------------------------------------- 1 file changed, 7 insertions(+), 56 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 0481948a09..d738d5127f 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -306,37 +306,14 @@ void LLKeywords::processTokens() // Add 'standard' stuff: Quotes, Comments, Strings, Labels, etc. before processing the LLSD std::string delimiter; addToken(LLKeywordToken::TT_LABEL, "@", getColorGroup("label"), "Label\nTarget for jump statement", delimiter ); - addToken(LLKeywordToken::TT_ONE_SIDED_DELIMITER, "//", getColorGroup("misc-comments_1_sided"), "Comment\nNon-functional commentary or disabled code", delimiter ); - addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "/*", getColorGroup("misc-comments_2_sided"), "Comment\nNon-functional commentary or disabled code (multi-line)", "*/" ); + addToken(LLKeywordToken::TT_ONE_SIDED_DELIMITER, "//", getColorGroup("misc-comments_1_sided"), "Comment (single-line)\nNon-functional commentary or disabled code", delimiter ); + 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) { - // TODO Collapse the 'if's into two, those that call 'processTokens' directly and an else if (for 'misc') that doesn't - if (outerIt->first == "constants") - { - if (outerIt->second.isMap()) - { - processTokensGroup(outerIt->second, "constants"); - } - else - { - LL_ERRS("Tokens-Constants") << "No constants map to process!" << LL_ENDL; - } - } - else if (outerIt->first == "controls") - { - if (outerIt->second.isMap()) - { - processTokensGroup(outerIt->second, "controls"); - } - else - { - LL_ERRS("Tokens-Controls") << "No controls map to process!" << LL_ENDL; - } - } - else if(outerIt->first == "misc") + if (outerIt->first == "misc") { if (outerIt->second.isMap()) { @@ -348,46 +325,20 @@ void LLKeywords::processTokens() } else { - LL_ERRS("Tokens-Misc") << "No misc map to process!" << LL_ENDL; - } - } - else if(outerIt->first == "events") - { - if (outerIt->second.isMap()) - { - processTokensGroup(outerIt->second, "events"); - } - else - { - LL_ERRS("Tokens-Events") << "No event map to process!" << LL_ENDL; - } - } - else if(outerIt->first == "functions") - { - if (outerIt->second.isMap()) - { - processTokensGroup(outerIt->second, "functions"); - } - else - { - LL_ERRS("Tokens-Functions") << "No function map to process!" << LL_ENDL; + LL_ERRS("LSL-Tokens-Processing") << "Map for misc entries is missing! Ignoring." << LL_ENDL; } } - else if(outerIt->first == "types") + else { if (outerIt->second.isMap()) { - processTokensGroup(outerIt->second, "types"); + processTokensGroup(outerIt->second, outerIt->first); } else { - LL_ERRS("Tokens-Types") << "No types array to process!" << LL_ENDL; + LL_ERRS("LSL-Tokens-Processing") << "Map for " + outerIt->first + " entries is missing! Ignoring." << LL_ENDL; } } - else - { - LL_ERRS("Tokens") << "Unknown token group '" << outerIt->first << "'" << LL_ENDL; - } } LL_INFOS("") << LL_ENDL; } -- cgit v1.2.3 From 14b00fc6bfc298b423e03e2efe6ca811798043ee Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 14 Feb 2013 18:34:13 +0000 Subject: STORM-1831 Removing an unnecessary assignment. --- indra/llui/llkeywords.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index d738d5127f..5305826c8a 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -145,8 +145,7 @@ std::string LLKeywords::getArguments(LLSD& arguments) LLSD::map_iterator argsIt = arguments.beginMap(); for ( ; argsIt != arguments.endMap(); ++argsIt) { - LLSD arg = argsIt->second; - args += arg.get("type").asString() + " " + argsIt->first; + args += argsIt->second.get("type").asString() + " " + argsIt->first; if (count-- > 1) { args += ", "; -- cgit v1.2.3 From 34fe6ad59161e0dcd57dfdc1feb6cfd1fcaa4794 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Tue, 12 Mar 2013 22:34:15 +0000 Subject: SH-3944 WIP CHUI merge fixing re-introduced don's refactor of low-level openGL calls pulling out of llui and putting them into llrender. Took the new code from their updated versions from the CHUI merge, but put them in a place accessible to appearance utility. --- indra/llui/CMakeLists.txt | 2 - indra/llui/llcombobox.cpp | 2 +- indra/llui/lllineeditor.cpp | 6 +- indra/llui/lllocalcliprect.cpp | 8 +- indra/llui/lltextbase.cpp | 4 +- indra/llui/lltexteditor.cpp | 2 +- indra/llui/llui.cpp | 1567 +--------------------------------------- indra/llui/llui.h | 130 +--- indra/llui/lluiimage.cpp | 243 ------- indra/llui/lluiimage.h | 126 ---- 10 files changed, 39 insertions(+), 2051 deletions(-) delete mode 100644 indra/llui/lluiimage.cpp delete mode 100644 indra/llui/lluiimage.h (limited to 'indra/llui') diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 01c42e07a2..34a08603fa 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -117,7 +117,6 @@ set(llui_SOURCE_FILES lluicolortable.cpp lluictrl.cpp lluictrlfactory.cpp - lluiimage.cpp lluistring.cpp llundo.cpp llurlaction.cpp @@ -231,7 +230,6 @@ set(llui_HEADER_FILES lluifwd.h llui.h lluicolor.h - lluiimage.h lluistring.h llundo.h llurlaction.h diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 41e5d74042..d4e14d9419 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -551,7 +551,7 @@ void LLComboBox::showList() LLCoordWindow window_size; getWindow()->getSize(&window_size); //HACK: shouldn't have to know about scale here - mList->fitContents( 192, llfloor((F32)window_size.mY / LLUI::sGLScaleFactor.mV[VY]) - 50 ); + mList->fitContents( 192, llfloor((F32)window_size.mY / LLUI::getScaleFactor().mV[VY]) - 50 ); // Make sure that we can see the whole list LLRect root_view_local; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 2e64be89fa..f8b84e39b5 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -2015,8 +2015,8 @@ void LLLineEditor::draw() LLRect screen_pos = calcScreenRect(); LLCoordGL ime_pos( screen_pos.mLeft + pixels_after_scroll, screen_pos.mTop - lineeditor_v_pad ); - ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); - ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); + ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]); + ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]); getWindow()->setLanguageTextInput( ime_pos ); } } @@ -2563,7 +2563,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length) S32 LLLineEditor::getPreeditFontSize() const { - return llround(mGLFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]); + return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace) diff --git a/indra/llui/lllocalcliprect.cpp b/indra/llui/lllocalcliprect.cpp index 31ceb0766a..0620e0f52d 100644 --- a/indra/llui/lllocalcliprect.cpp +++ b/indra/llui/lllocalcliprect.cpp @@ -88,10 +88,10 @@ void LLScreenClipRect::updateScissorRegion() LLRect rect = sClipRectStack.top(); stop_glerror(); S32 x,y,w,h; - x = llfloor(rect.mLeft * LLUI::sGLScaleFactor.mV[VX]); - y = llfloor(rect.mBottom * LLUI::sGLScaleFactor.mV[VY]); - w = llmax(0, llceil(rect.getWidth() * LLUI::sGLScaleFactor.mV[VX])) + 1; - h = llmax(0, llceil(rect.getHeight() * LLUI::sGLScaleFactor.mV[VY])) + 1; + x = llfloor(rect.mLeft * LLUI::getScaleFactor().mV[VX]); + y = llfloor(rect.mBottom * LLUI::getScaleFactor().mV[VY]); + w = llmax(0, llceil(rect.getWidth() * LLUI::getScaleFactor().mV[VX])) + 1; + h = llmax(0, llceil(rect.getHeight() * LLUI::getScaleFactor().mV[VY])) + 1; glScissor( x,y,w,h ); stop_glerror(); } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 7cee9f5b46..e22b806a74 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -521,8 +521,8 @@ void LLTextBase::drawCursor() LLRect screen_pos = calcScreenRect(); LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_rect.mLeft), screen_pos.mBottom + llfloor(cursor_rect.mTop) ); - ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); - ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); + ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]); + ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]); getWindow()->setLanguageTextInput( ime_pos ); } } diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index d5e08fa29b..3dc1b99edb 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2911,7 +2911,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length) S32 LLTextEditor::getPreeditFontSize() const { - return llround((F32)mFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]); + return llround((F32)mFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } BOOL LLTextEditor::isDirty() const diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 2a774d54a3..0ddb149738 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -39,6 +39,7 @@ #include "llrect.h" #include "lldir.h" #include "llgl.h" +#include "llsd.h" // Project includes #include "llcommandmanager.h" @@ -69,16 +70,13 @@ // // Globals // -const LLColor4 UI_VERTEX_COLOR(1.f, 1.f, 1.f, 1.f); // Language for UI construction std::map gTranslation; std::list gUntranslated; /*static*/ LLUI::settings_map_t LLUI::sSettingGroups; -/*static*/ LLImageProviderInterface* LLUI::sImageProvider = NULL; /*static*/ LLUIAudioCallback LLUI::sAudioCallback = NULL; /*static*/ LLUIAudioCallback LLUI::sDeferredAudioCallback = NULL; -/*static*/ LLVector2 LLUI::sGLScaleFactor(1.f, 1.f); /*static*/ LLWindow* LLUI::sWindow = NULL; /*static*/ LLView* LLUI::sRootView = NULL; /*static*/ BOOL LLUI::sDirty = FALSE; @@ -158,1474 +156,6 @@ void make_ui_sound_deferred(const char* namep) } } -BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom) -{ - if (x < left || right < x) return FALSE; - if (y < bottom || top < y) return FALSE; - return TRUE; -} - - -// Puts GL into 2D drawing mode by turning off lighting, setting to an -// orthographic projection, etc. -void gl_state_for_2d(S32 width, S32 height) -{ - stop_glerror(); - F32 window_width = (F32) width;//gViewerWindow->getWindowWidth(); - F32 window_height = (F32) height;//gViewerWindow->getWindowHeight(); - - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.loadIdentity(); - gGL.ortho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.loadIdentity(); - stop_glerror(); -} - - -void gl_draw_x(const LLRect& rect, const LLColor4& color) -{ - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.color4fv( color.mV ); - - gGL.begin( LLRender::LINES ); - gGL.vertex2i( rect.mLeft, rect.mTop ); - gGL.vertex2i( rect.mRight, rect.mBottom ); - gGL.vertex2i( rect.mLeft, rect.mBottom ); - gGL.vertex2i( rect.mRight, rect.mTop ); - gGL.end(); -} - - -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset, BOOL filled) -{ - gGL.color4fv(color.mV); - gl_rect_2d_offset_local(left, top, right, bottom, pixel_offset, filled); -} - -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled) -{ - gGL.pushUIMatrix(); - left += LLFontGL::sCurOrigin.mX; - right += LLFontGL::sCurOrigin.mX; - bottom += LLFontGL::sCurOrigin.mY; - top += LLFontGL::sCurOrigin.mY; - - gGL.loadUIIdentity(); - gl_rect_2d(llfloor((F32)left * LLUI::sGLScaleFactor.mV[VX]) - pixel_offset, - llfloor((F32)top * LLUI::sGLScaleFactor.mV[VY]) + pixel_offset, - llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset, - llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset, - filled); - gGL.popUIMatrix(); -} - - -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) -{ - stop_glerror(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - // Counterclockwise quad will face the viewer - if( filled ) - { - gGL.begin( LLRender::QUADS ); - gGL.vertex2i(left, top); - gGL.vertex2i(left, bottom); - gGL.vertex2i(right, bottom); - gGL.vertex2i(right, top); - gGL.end(); - } - else - { - if( gGLManager.mATIOffsetVerticalLines ) - { - // Work around bug in ATI driver: vertical lines are offset by (-1,-1) - gGL.begin( LLRender::LINES ); - - // Verticals - gGL.vertex2i(left + 1, top); - gGL.vertex2i(left + 1, bottom); - - gGL.vertex2i(right, bottom); - gGL.vertex2i(right, top); - - // Horizontals - top--; - right--; - gGL.vertex2i(left, bottom); - gGL.vertex2i(right, bottom); - - gGL.vertex2i(left, top); - gGL.vertex2i(right, top); - gGL.end(); - } - else - { - top--; - right--; - gGL.begin( LLRender::LINE_STRIP ); - gGL.vertex2i(left, top); - gGL.vertex2i(left, bottom); - gGL.vertex2i(right, bottom); - gGL.vertex2i(right, top); - gGL.vertex2i(left, top); - gGL.end(); - } - } - stop_glerror(); -} - -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled ) -{ - gGL.color4fv( color.mV ); - gl_rect_2d( left, top, right, bottom, filled ); -} - - -void gl_rect_2d( const LLRect& rect, const LLColor4& color, BOOL filled ) -{ - gGL.color4fv( color.mV ); - gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled ); -} - -// Given a rectangle on the screen, draws a drop shadow _outside_ -// the right and bottom edges of it. Along the right it has width "lines" -// and along the bottom it has height "lines". -void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines) -{ - stop_glerror(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - // HACK: Overlap with the rectangle by a single pixel. - right--; - bottom++; - lines++; - - LLColor4 end_color = start_color; - end_color.mV[VALPHA] = 0.f; - - gGL.begin(LLRender::QUADS); - - // Right edge, CCW faces screen - gGL.color4fv(start_color.mV); - gGL.vertex2i(right, top-lines); - gGL.vertex2i(right, bottom); - gGL.color4fv(end_color.mV); - gGL.vertex2i(right+lines, bottom); - gGL.vertex2i(right+lines, top-lines); - - // Bottom edge, CCW faces screen - gGL.color4fv(start_color.mV); - gGL.vertex2i(right, bottom); - gGL.vertex2i(left+lines, bottom); - gGL.color4fv(end_color.mV); - gGL.vertex2i(left+lines, bottom-lines); - gGL.vertex2i(right, bottom-lines); - - // bottom left Corner - gGL.color4fv(start_color.mV); - gGL.vertex2i(left+lines, bottom); - gGL.color4fv(end_color.mV); - gGL.vertex2i(left, bottom); - // make the bottom left corner not sharp - gGL.vertex2i(left+1, bottom-lines+1); - gGL.vertex2i(left+lines, bottom-lines); - - // bottom right corner - gGL.color4fv(start_color.mV); - gGL.vertex2i(right, bottom); - gGL.color4fv(end_color.mV); - gGL.vertex2i(right, bottom-lines); - // make the rightmost corner not sharp - gGL.vertex2i(right+lines-1, bottom-lines+1); - gGL.vertex2i(right+lines, bottom); - - // top right corner - gGL.color4fv(start_color.mV); - gGL.vertex2i( right, top-lines ); - gGL.color4fv(end_color.mV); - gGL.vertex2i( right+lines, top-lines ); - // make the corner not sharp - gGL.vertex2i( right+lines-1, top-1 ); - gGL.vertex2i( right, top ); - - gGL.end(); - stop_glerror(); -} - -void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2 ) -{ - // Work around bug in ATI driver: vertical lines are offset by (-1,-1) - if( (x1 == x2) && gGLManager.mATIOffsetVerticalLines ) - { - x1++; - x2++; - y1++; - y2++; - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.begin(LLRender::LINES); - gGL.vertex2i(x1, y1); - gGL.vertex2i(x2, y2); - gGL.end(); -} - -void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ) -{ - // Work around bug in ATI driver: vertical lines are offset by (-1,-1) - if( (x1 == x2) && gGLManager.mATIOffsetVerticalLines ) - { - x1++; - x2++; - y1++; - y2++; - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.color4fv( color.mV ); - - gGL.begin(LLRender::LINES); - gGL.vertex2i(x1, y1); - gGL.vertex2i(x2, y2); - gGL.end(); -} - -void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled) -{ - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.color4fv(color.mV); - - if (filled) - { - gGL.begin(LLRender::TRIANGLES); - } - else - { - gGL.begin(LLRender::LINE_LOOP); - } - gGL.vertex2i(x1, y1); - gGL.vertex2i(x2, y2); - gGL.vertex2i(x3, y3); - gGL.end(); -} - -void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac) -{ - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - length = llmin((S32)(max_frac*(right - left)), length); - length = llmin((S32)(max_frac*(top - bottom)), length); - gGL.begin(LLRender::LINES); - gGL.vertex2i(left, top); - gGL.vertex2i(left + length, top); - - gGL.vertex2i(left, top); - gGL.vertex2i(left, top - length); - - gGL.vertex2i(left, bottom); - gGL.vertex2i(left + length, bottom); - - gGL.vertex2i(left, bottom); - gGL.vertex2i(left, bottom + length); - - gGL.vertex2i(right, top); - gGL.vertex2i(right - length, top); - - gGL.vertex2i(right, top); - gGL.vertex2i(right, top - length); - - gGL.vertex2i(right, bottom); - gGL.vertex2i(right - length, bottom); - - gGL.vertex2i(right, bottom); - gGL.vertex2i(right, bottom + length); - gGL.end(); -} - - -void gl_draw_image( S32 x, S32 y, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect ) -{ - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), 0.f, image, color, uv_rect ); -} - -void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) -{ - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect ); -} - -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect) -{ - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - - // scale screen size of borders down - F32 border_width_fraction = (F32)border_width / (F32)image->getWidth(0); - F32 border_height_fraction = (F32)border_height / (F32)image->getHeight(0); - - LLRectf scale_rect(border_width_fraction, 1.f - border_height_fraction, 1.f - border_width_fraction, border_height_fraction); - gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect); -} - -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect) -{ - stop_glerror(); - - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - - // add in offset of current image to current UI translation - const LLVector3 ui_scale = gGL.getUIScale(); - const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); - - F32 uv_width = uv_outer_rect.getWidth(); - F32 uv_height = uv_outer_rect.getHeight(); - - // shrink scaling region to be proportional to clipped image region - LLRectf uv_center_rect( - uv_outer_rect.mLeft + (center_rect.mLeft * uv_width), - uv_outer_rect.mBottom + (center_rect.mTop * uv_height), - uv_outer_rect.mLeft + (center_rect.mRight * uv_width), - uv_outer_rect.mBottom + (center_rect.mBottom * uv_height)); - - F32 image_width = image->getWidth(0); - F32 image_height = image->getHeight(0); - - S32 image_natural_width = llround(image_width * uv_width); - S32 image_natural_height = llround(image_height * uv_height); - - LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, - uv_center_rect.mTop * image_height, - uv_center_rect.mRight * image_width, - uv_center_rect.mBottom * image_height); - - { // scale fixed region of image to drawn region - draw_center_rect.mRight += width - image_natural_width; - draw_center_rect.mTop += height - image_natural_height; - - F32 border_shrink_width = llmax(0.f, draw_center_rect.mLeft - draw_center_rect.mRight); - F32 border_shrink_height = llmax(0.f, draw_center_rect.mBottom - draw_center_rect.mTop); - - F32 shrink_width_ratio = center_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - center_rect.getWidth())); - F32 shrink_height_ratio = center_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - center_rect.getHeight())); - - F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); - - draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * shrink_scale * ui_scale.mV[VX]); - draw_center_rect.mTop = llround(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale) * ui_scale.mV[VY]); - draw_center_rect.mRight = llround(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale) * ui_scale.mV[VX]); - draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * shrink_scale * ui_scale.mV[VY]); - } - - LLRectf draw_outer_rect(ui_translation.mV[VX], - ui_translation.mV[VY] + height * ui_scale.mV[VY], - ui_translation.mV[VX] + width * ui_scale.mV[VX], - ui_translation.mV[VY]); - - LLGLSUIDefault gls_ui; - - if (solid_color) - { - if (LLGLSLShader::sNoFixedFunction) - { - gSolidColorProgram.bind(); - } - else - { - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); - gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA); - } - } - - gGL.getTexUnit(0)->bind(image, true); - - gGL.color4fv(color.mV); - - const S32 NUM_VERTICES = 9 * 4; // 9 quads - LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; - - S32 index = 0; - - gGL.begin(LLRender::QUADS); - { - // draw bottom left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - // draw bottom middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - // draw bottom right - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - // draw left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - // draw middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - // draw right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - // draw top left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; - - // draw top middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; - - // draw top right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; - - gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); - } - gGL.end(); - - if (solid_color) - { - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.bind(); - } - else - { - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - } - } -} - -void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) -{ - gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), degrees, image, color, uv_rect ); -} - -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) -{ - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - - LLGLSUIDefault gls_ui; - - - gGL.getTexUnit(0)->bind(image, true); - - gGL.color4fv(color.mV); - - if (degrees == 0.f) - { - const S32 NUM_VERTICES = 4; // 9 quads - LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; - - gGL.begin(LLRender::QUADS); - { - LLVector3 ui_scale = gGL.getUIScale(); - LLVector3 ui_translation = gGL.getUITranslation(); - ui_translation.mV[VX] += x; - ui_translation.mV[VY] += y; - ui_translation.scaleVec(ui_scale); - S32 index = 0; - S32 scaled_width = llround(width * ui_scale.mV[VX]); - S32 scaled_height = llround(height * ui_scale.mV[VY]); - - uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop); - pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f); - index++; - - uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop); - pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f); - index++; - - uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom); - pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY], 0.f); - index++; - - uv[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom); - pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f); - index++; - - gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); - } - gGL.end(); - } - else - { - gGL.pushUIMatrix(); - gGL.translateUI((F32)x, (F32)y, 0.f); - - F32 offset_x = F32(width/2); - F32 offset_y = F32(height/2); - - gGL.translateUI(offset_x, offset_y, 0.f); - - LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); - - gGL.getTexUnit(0)->bind(image, true); - - gGL.color4fv(color.mV); - - gGL.begin(LLRender::QUADS); - { - LLVector3 v; - - v = LLVector3(offset_x, offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); - gGL.vertex2f(v.mV[0], v.mV[1] ); - - v = LLVector3(-offset_x, offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); - gGL.vertex2f(v.mV[0], v.mV[1] ); - - v = LLVector3(-offset_x, -offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); - gGL.vertex2f(v.mV[0], v.mV[1] ); - - v = LLVector3(offset_x, -offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); - gGL.vertex2f(v.mV[0], v.mV[1] ); - } - gGL.end(); - gGL.popUIMatrix(); - } -} - - -void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase ) -{ - phase = fmod(phase, 1.f); - - S32 shift = S32(phase * 4.f) % 4; - - // Stippled line - LLGLEnable stipple(GL_LINE_STIPPLE); - - gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); - - gGL.flush(); - glLineWidth(2.5f); - - if (!LLGLSLShader::sNoFixedFunction) - { - glLineStipple(2, 0x3333 << shift); - } - - gGL.begin(LLRender::LINES); - { - gGL.vertex3fv( start.mV ); - gGL.vertex3fv( end.mV ); - } - gGL.end(); - - LLUI::setLineWidth(1.f); -} - -void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle) -{ - if (end_angle < start_angle) - { - end_angle += F_TWO_PI; - } - - gGL.pushUIMatrix(); - { - gGL.translateUI(center_x, center_y, 0.f); - - // Inexact, but reasonably fast. - F32 delta = (end_angle - start_angle) / steps; - F32 sin_delta = sin( delta ); - F32 cos_delta = cos( delta ); - F32 x = cosf(start_angle) * radius; - F32 y = sinf(start_angle) * radius; - - if (filled) - { - gGL.begin(LLRender::TRIANGLE_FAN); - gGL.vertex2f(0.f, 0.f); - // make sure circle is complete - steps += 1; - } - else - { - gGL.begin(LLRender::LINE_STRIP); - } - - while( steps-- ) - { - // Successive rotations - gGL.vertex2f( x, y ); - F32 x_new = x * cos_delta - y * sin_delta; - y = x * sin_delta + y * cos_delta; - x = x_new; - } - gGL.end(); - } - gGL.popUIMatrix(); -} - -void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled) -{ - gGL.pushUIMatrix(); - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.translateUI(center_x, center_y, 0.f); - - // Inexact, but reasonably fast. - F32 delta = F_TWO_PI / steps; - F32 sin_delta = sin( delta ); - F32 cos_delta = cos( delta ); - F32 x = radius; - F32 y = 0.f; - - if (filled) - { - gGL.begin(LLRender::TRIANGLE_FAN); - gGL.vertex2f(0.f, 0.f); - // make sure circle is complete - steps += 1; - } - else - { - gGL.begin(LLRender::LINE_LOOP); - } - - while( steps-- ) - { - // Successive rotations - gGL.vertex2f( x, y ); - F32 x_new = x * cos_delta - y * sin_delta; - y = x * sin_delta + y * cos_delta; - x = x_new; - } - gGL.end(); - } - gGL.popUIMatrix(); -} - -// Renders a ring with sides (tube shape) -void gl_deep_circle( F32 radius, F32 depth, S32 steps ) -{ - F32 x = radius; - F32 y = 0.f; - F32 angle_delta = F_TWO_PI / (F32)steps; - gGL.begin( LLRender::TRIANGLE_STRIP ); - { - S32 step = steps + 1; // An extra step to close the circle. - while( step-- ) - { - gGL.vertex3f( x, y, depth ); - gGL.vertex3f( x, y, 0.f ); - - F32 x_new = x * cosf(angle_delta) - y * sinf(angle_delta); - y = x * sinf(angle_delta) + y * cosf(angle_delta); - x = x_new; - } - } - gGL.end(); -} - -void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ) -{ - gGL.pushUIMatrix(); - { - gGL.translateUI(0.f, 0.f, -width / 2); - if( render_center ) - { - gGL.color4fv(center_color.mV); - gGL.diffuseColor4fv(center_color.mV); - gl_deep_circle( radius, width, steps ); - } - else - { - gGL.diffuseColor4fv(side_color.mV); - gl_washer_2d(radius, radius - width, steps, side_color, side_color); - gGL.translateUI(0.f, 0.f, width); - gl_washer_2d(radius - width, radius, steps, side_color, side_color); - } - } - gGL.popUIMatrix(); -} - -// Draw gray and white checkerboard with black border -void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha) -{ - if (!LLGLSLShader::sNoFixedFunction) - { - // Initialize the first time this is called. - const S32 PIXELS = 32; - static GLubyte checkerboard[PIXELS * PIXELS]; - static BOOL first = TRUE; - if( first ) - { - for( S32 i = 0; i < PIXELS; i++ ) - { - for( S32 j = 0; j < PIXELS; j++ ) - { - checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF; - } - } - first = FALSE; - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - // ...white squares - gGL.color4f( 1.f, 1.f, 1.f, alpha ); - gl_rect_2d(rect); - - // ...gray squares - gGL.color4f( .7f, .7f, .7f, alpha ); - gGL.flush(); - - glPolygonStipple( checkerboard ); - - LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); - gl_rect_2d(rect); - } - else - { //polygon stipple is deprecated, use "Checker" texture - LLPointer img = LLUI::getUIImage("Checker"); - gGL.getTexUnit(0)->bind(img->getImage()); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - - LLColor4 color(1.f, 1.f, 1.f, alpha); - LLRectf uv_rect(0, 0, rect.getWidth()/32.f, rect.getHeight()/32.f); - - gl_draw_scaled_image(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), - img->getImage(), color, uv_rect); - } - - gGL.flush(); -} - - -// Draws the area between two concentric circles, like -// a doughnut or washer. -void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color) -{ - const F32 DELTA = F_TWO_PI / steps; - const F32 SIN_DELTA = sin( DELTA ); - const F32 COS_DELTA = cos( DELTA ); - - F32 x1 = outer_radius; - F32 y1 = 0.f; - F32 x2 = inner_radius; - F32 y2 = 0.f; - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.begin( LLRender::TRIANGLE_STRIP ); - { - steps += 1; // An extra step to close the circle. - while( steps-- ) - { - gGL.color4fv(outer_color.mV); - gGL.vertex2f( x1, y1 ); - gGL.color4fv(inner_color.mV); - gGL.vertex2f( x2, y2 ); - - F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; - y1 = x1 * SIN_DELTA + y1 * COS_DELTA; - x1 = x1_new; - - F32 x2_new = x2 * COS_DELTA - y2 * SIN_DELTA; - y2 = x2 * SIN_DELTA + y2 * COS_DELTA; - x2 = x2_new; - } - } - gGL.end(); -} - -// Draws the area between two concentric circles, like -// a doughnut or washer. -void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color) -{ - const F32 DELTA = (end_radians - start_radians) / steps; - const F32 SIN_DELTA = sin( DELTA ); - const F32 COS_DELTA = cos( DELTA ); - - F32 x1 = outer_radius * cos( start_radians ); - F32 y1 = outer_radius * sin( start_radians ); - F32 x2 = inner_radius * cos( start_radians ); - F32 y2 = inner_radius * sin( start_radians ); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.begin( LLRender::TRIANGLE_STRIP ); - { - steps += 1; // An extra step to close the circle. - while( steps-- ) - { - gGL.color4fv(outer_color.mV); - gGL.vertex2f( x1, y1 ); - gGL.color4fv(inner_color.mV); - gGL.vertex2f( x2, y2 ); - - F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; - y1 = x1 * SIN_DELTA + y1 * COS_DELTA; - x1 = x1_new; - - F32 x2_new = x2 * COS_DELTA - y2 * SIN_DELTA; - y2 = x2 * SIN_DELTA + y2 * COS_DELTA; - x2 = x2_new; - } - } - gGL.end(); -} - -void gl_rect_2d_simple_tex( S32 width, S32 height ) -{ - gGL.begin( LLRender::QUADS ); - - gGL.texCoord2f(1.f, 1.f); - gGL.vertex2i(width, height); - - gGL.texCoord2f(0.f, 1.f); - gGL.vertex2i(0, height); - - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(0, 0); - - gGL.texCoord2f(1.f, 0.f); - gGL.vertex2i(width, 0); - - gGL.end(); -} - -void gl_rect_2d_simple( S32 width, S32 height ) -{ - gGL.begin( LLRender::QUADS ); - gGL.vertex2i(width, height); - gGL.vertex2i(0, height); - gGL.vertex2i(0, 0); - gGL.vertex2i(width, 0); - gGL.end(); -} - -void gl_segmented_rect_2d_tex(const S32 left, - const S32 top, - const S32 right, - const S32 bottom, - const S32 texture_width, - const S32 texture_height, - const S32 border_size, - const U32 edges) -{ - S32 width = llabs(right - left); - S32 height = llabs(top - bottom); - - gGL.pushUIMatrix(); - - gGL.translateUI((F32)left, (F32)bottom, 0.f); - LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); - - if (border_uv_scale.mV[VX] > 0.5f) - { - border_uv_scale *= 0.5f / border_uv_scale.mV[VX]; - } - if (border_uv_scale.mV[VY] > 0.5f) - { - border_uv_scale *= 0.5f / border_uv_scale.mV[VY]; - } - - F32 border_scale = llmin((F32)border_size, (F32)width * 0.5f, (F32)height * 0.5f); - LLVector2 border_width_left = ((edges & (~(U32)ROUNDED_RECT_RIGHT)) != 0) ? LLVector2(border_scale, 0.f) : LLVector2::zero; - LLVector2 border_width_right = ((edges & (~(U32)ROUNDED_RECT_LEFT)) != 0) ? LLVector2(border_scale, 0.f) : LLVector2::zero; - LLVector2 border_height_bottom = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? LLVector2(0.f, border_scale) : LLVector2::zero; - LLVector2 border_height_top = ((edges & (~(U32)ROUNDED_RECT_BOTTOM)) != 0) ? LLVector2(0.f, border_scale) : LLVector2::zero; - LLVector2 width_vec((F32)width, 0.f); - LLVector2 height_vec(0.f, (F32)height); - - gGL.begin(LLRender::QUADS); - { - // draw bottom left - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2f(0.f, 0.f); - - gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv(border_width_left.mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + border_height_bottom).mV); - - gGL.texCoord2f(0.f, border_uv_scale.mV[VY]); - gGL.vertex2fv(border_height_bottom.mV); - - // draw bottom middle - gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv(border_width_left.mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv((width_vec - border_width_right).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + border_height_bottom).mV); - - // draw bottom right - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv((width_vec - border_width_right).mV); - - gGL.texCoord2f(1.f, 0.f); - gGL.vertex2fv(width_vec.mV); - - gGL.texCoord2f(1.f, border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); - - // draw left - gGL.texCoord2f(0.f, border_uv_scale.mV[VY]); - gGL.vertex2fv(border_height_bottom.mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + border_height_bottom).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); - - gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((height_vec - border_height_top).mV); - - // draw middle - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); - - // draw right - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); - - gGL.texCoord2f(1.f, border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec + border_height_bottom).mV); - - gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); - - // draw top left - gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((height_vec - border_height_top).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((border_width_left + height_vec).mV); - - gGL.texCoord2f(0.f, 1.f); - gGL.vertex2fv((height_vec).mV); - - // draw top middle - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((width_vec - border_width_right + height_vec).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((border_width_left + height_vec).mV); - - // draw top right - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f, 1.f); - gGL.vertex2fv((width_vec + height_vec).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((width_vec - border_width_right + height_vec).mV); - } - gGL.end(); - - gGL.popUIMatrix(); -} - -//FIXME: rewrite to use scissor? -void gl_segmented_rect_2d_fragment_tex(const S32 left, - const S32 top, - const S32 right, - const S32 bottom, - const S32 texture_width, - const S32 texture_height, - const S32 border_size, - const F32 start_fragment, - const F32 end_fragment, - const U32 edges) -{ - S32 width = llabs(right - left); - S32 height = llabs(top - bottom); - - gGL.pushUIMatrix(); - - gGL.translateUI((F32)left, (F32)bottom, 0.f); - LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); - - if (border_uv_scale.mV[VX] > 0.5f) - { - border_uv_scale *= 0.5f / border_uv_scale.mV[VX]; - } - if (border_uv_scale.mV[VY] > 0.5f) - { - border_uv_scale *= 0.5f / border_uv_scale.mV[VY]; - } - - F32 border_scale = llmin((F32)border_size, (F32)width * 0.5f, (F32)height * 0.5f); - LLVector2 border_width_left = ((edges & (~(U32)ROUNDED_RECT_RIGHT)) != 0) ? LLVector2(border_scale, 0.f) : LLVector2::zero; - LLVector2 border_width_right = ((edges & (~(U32)ROUNDED_RECT_LEFT)) != 0) ? LLVector2(border_scale, 0.f) : LLVector2::zero; - LLVector2 border_height_bottom = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? LLVector2(0.f, border_scale) : LLVector2::zero; - LLVector2 border_height_top = ((edges & (~(U32)ROUNDED_RECT_BOTTOM)) != 0) ? LLVector2(0.f, border_scale) : LLVector2::zero; - LLVector2 width_vec((F32)width, 0.f); - LLVector2 height_vec(0.f, (F32)height); - - F32 middle_start = border_scale / (F32)width; - F32 middle_end = 1.f - middle_start; - - F32 u_min; - F32 u_max; - LLVector2 x_min; - LLVector2 x_max; - - gGL.begin(LLRender::QUADS); - { - if (start_fragment < middle_start) - { - u_min = (start_fragment / middle_start) * border_uv_scale.mV[VX]; - u_max = llmin(end_fragment / middle_start, 1.f) * border_uv_scale.mV[VX]; - x_min = (start_fragment / middle_start) * border_width_left; - x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left; - - // draw bottom left - gGL.texCoord2f(u_min, 0.f); - gGL.vertex2fv(x_min.mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv(x_max.mV); - - gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - // draw left - gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - // draw top left - gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_max, 1.f); - gGL.vertex2fv((x_max + height_vec).mV); - - gGL.texCoord2f(u_min, 1.f); - gGL.vertex2fv((x_min + height_vec).mV); - } - - if (end_fragment > middle_start || start_fragment < middle_end) - { - x_min = border_width_left + ((llclamp(start_fragment, middle_start, middle_end) - middle_start)) * width_vec; - x_max = border_width_left + ((llclamp(end_fragment, middle_start, middle_end) - middle_start)) * width_vec; - - // draw bottom middle - gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv(x_min.mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv((x_max).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - // draw middle - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - // draw top middle - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((x_max + height_vec).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((x_min + height_vec).mV); - } - - if (end_fragment > middle_end) - { - u_min = (1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_uv_scale.mV[VX]; - u_max = (1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]; - x_min = width_vec - ((1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_width_right); - x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right); - - // draw bottom right - gGL.texCoord2f(u_min, 0.f); - gGL.vertex2fv((x_min).mV); - - gGL.texCoord2f(u_max, 0.f); - gGL.vertex2fv(x_max.mV); - - gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - // draw right - gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - // draw top right - gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_max, 1.f); - gGL.vertex2fv((x_max + height_vec).mV); - - gGL.texCoord2f(u_min, 1.f); - gGL.vertex2fv((x_min + height_vec).mV); - } - } - gGL.end(); - - gGL.popUIMatrix(); -} - -void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, - const LLVector3& width_vec, const LLVector3& height_vec) -{ - gGL.begin(LLRender::QUADS); - { - // draw bottom left - gGL.texCoord2f(clip_rect.mLeft, clip_rect.mBottom); - gGL.vertex3f(0.f, 0.f, 0.f); - - gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mBottom * height_vec).mV); - - // draw bottom middle - gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV); - - // draw bottom right - gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, clip_rect.mBottom); - gGL.vertex3fv(width_vec.mV); - - gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV); - - // draw left - gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mTop * height_vec).mV); - - // draw middle - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - - // draw right - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV); - - // draw top left - gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + height_vec).mV); - - gGL.texCoord2f(clip_rect.mLeft, clip_rect.mTop); - gGL.vertex3fv((height_vec).mV); - - // draw top middle - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + height_vec).mV); - - // draw top right - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, clip_rect.mTop); - gGL.vertex3fv((width_vec + height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + height_vec).mV); - } - gGL.end(); - -} - - void LLUI::initClass(const settings_map_t& settings, LLImageProviderInterface* image_provider, LLUIAudioCallback audio_callback, @@ -1633,6 +163,7 @@ void LLUI::initClass(const settings_map_t& settings, const LLVector2* scale_factor, const std::string& language) { + LLRender2D::initClass(image_provider,scale_factor); sSettingGroups = settings; if ((get_ptr_in_map(sSettingGroups, std::string("config")) == NULL) || @@ -1642,10 +173,8 @@ void LLUI::initClass(const settings_map_t& settings, llerrs << "Failure to initialize configuration groups" << llendl; } - sImageProvider = image_provider; sAudioCallback = audio_callback; sDeferredAudioCallback = deferred_audio_callback; - sGLScaleFactor = (scale_factor == NULL) ? LLVector2(1.f, 1.f) : *scale_factor; sWindow = NULL; // set later in startup LLFontGL::sShadowColor = LLUIColorTable::instance().getColor("ColorDropShadow"); @@ -1679,10 +208,7 @@ void LLUI::initClass(const settings_map_t& settings, void LLUI::cleanupClass() { - if(sImageProvider) - { - sImageProvider->cleanUp(); -} + LLRender2D::cleanupClass(); } void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups) @@ -1706,60 +232,12 @@ void LLUI::dirtyRect(LLRect rect) } } - -//static -void LLUI::translate(F32 x, F32 y, F32 z) -{ - gGL.translateUI(x,y,z); - LLFontGL::sCurOrigin.mX += (S32) x; - LLFontGL::sCurOrigin.mY += (S32) y; - LLFontGL::sCurDepth += z; -} - -//static -void LLUI::pushMatrix() -{ - gGL.pushUIMatrix(); - LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth)); -} - -//static -void LLUI::popMatrix() -{ - gGL.popUIMatrix(); - LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first; - LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second; - LLFontGL::sOriginStack.pop_back(); -} - -//static -void LLUI::loadIdentity() -{ - gGL.loadUIIdentity(); - LLFontGL::sCurOrigin.mX = 0; - LLFontGL::sCurOrigin.mY = 0; - LLFontGL::sCurDepth = 0.f; -} - -//static -void LLUI::setScaleFactor(const LLVector2 &scale_factor) -{ - sGLScaleFactor = scale_factor; -} - -//static -void LLUI::setLineWidth(F32 width) -{ - gGL.flush(); - glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f)); -} - //static void LLUI::setMousePositionScreen(S32 x, S32 y) { S32 screen_x, screen_y; - screen_x = llround((F32)x * sGLScaleFactor.mV[VX]); - screen_y = llround((F32)y * sGLScaleFactor.mV[VY]); + screen_x = llround((F32)x * getScaleFactor().mV[VX]); + screen_y = llround((F32)y * getScaleFactor().mV[VY]); LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert()); } @@ -1770,8 +248,8 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y) LLCoordWindow cursor_pos_window; getWindow()->getCursorPosition(&cursor_pos_window); LLCoordGL cursor_pos_gl(cursor_pos_window.convert()); - *x = llround((F32)cursor_pos_gl.mX / sGLScaleFactor.mV[VX]); - *y = llround((F32)cursor_pos_gl.mY / sGLScaleFactor.mV[VX]); + *x = llround((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]); + *y = llround((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]); } //static @@ -1885,21 +363,21 @@ LLVector2 LLUI::getWindowSize() LLCoordWindow window_rect; sWindow->getSize(&window_rect); - return LLVector2(window_rect.mX / sGLScaleFactor.mV[VX], window_rect.mY / sGLScaleFactor.mV[VY]); + return LLVector2(window_rect.mX / getScaleFactor().mV[VX], window_rect.mY / getScaleFactor().mV[VY]); } //static void LLUI::screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y) { - *gl_x = llround((F32)screen_x * sGLScaleFactor.mV[VX]); - *gl_y = llround((F32)screen_y * sGLScaleFactor.mV[VY]); + *gl_x = llround((F32)screen_x * getScaleFactor().mV[VX]); + *gl_y = llround((F32)screen_y * getScaleFactor().mV[VY]); } //static void LLUI::glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y) { - *screen_x = llround((F32)gl_x / sGLScaleFactor.mV[VX]); - *screen_y = llround((F32)gl_y / sGLScaleFactor.mV[VY]); + *screen_x = llround((F32)gl_x / getScaleFactor().mV[VX]); + *screen_y = llround((F32)gl_y / getScaleFactor().mV[VY]); } //static @@ -1916,27 +394,6 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen) glPointToScreen(gl.mRight, gl.mBottom, &screen->mRight, &screen->mBottom); } -//static -LLPointer LLUI::getUIImageByID(const LLUUID& image_id, S32 priority) -{ - if (sImageProvider) - { - return sImageProvider->getUIImageByID(image_id, priority); - } - else - { - return NULL; - } -} - -//static -LLPointer LLUI::getUIImage(const std::string& name, S32 priority) -{ - if (!name.empty() && sImageProvider) - return sImageProvider->getUIImage(name, priority); - else - return NULL; -} LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname) { diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 4c1703392a..83831e4799 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -1,6 +1,6 @@ /** * @file llui.h - * @brief GL function declarations and other general static UI services. + * @brief General static UI services. * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -24,122 +24,38 @@ * $/LicenseInfo$ */ -// All immediate-mode gl drawing should happen here. #ifndef LL_LLUI_H #define LL_LLUI_H -#include "llpointer.h" // LLPointer<> #include "llrect.h" #include "llcontrol.h" #include "llcoord.h" -#include "llglslshader.h" +#include "v2math.h" #include "llinitparam.h" #include "llregistry.h" +#include "llrender2dutils.h" +#include "llpointer.h" #include "lluicolor.h" #include "lluicolortable.h" +#include "lluiimage.h" #include #include "lllazyvalue.h" #include "llframetimer.h" #include -// LLUIFactory -#include "llsd.h" - // for initparam specialization #include "llfontgl.h" -class LLColor4; -class LLVector3; -class LLVector2; -class LLUIImage; class LLUUID; class LLWindow; class LLView; class LLHelp; -// UI colors -extern const LLColor4 UI_VERTEX_COLOR; void make_ui_sound(const char* name); void make_ui_sound_deferred(const char * name); -BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom); -void gl_state_for_2d(S32 width, S32 height); - -void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2); -void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ); -void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled); -void gl_rect_2d_simple( S32 width, S32 height ); - -void gl_draw_x(const LLRect& rect, const LLColor4& color); - -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled = TRUE ); -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled = TRUE ); -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset = 0, BOOL filled = TRUE ); -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE ); -void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE ); -void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE ); -void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha = 1.0f); - -void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines); - -void gl_circle_2d(F32 x, F32 y, F32 radius, S32 steps, BOOL filled); -void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle); -void gl_deep_circle( F32 radius, F32 depth ); -void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ); -void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac); -void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color); -void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color); - -void gl_draw_image(S32 x, S32 y, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); - -void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); - -void gl_rect_2d_simple_tex( S32 width, S32 height ); - -// segmented rectangles - -/* - TL |______TOP_________| TR - /| |\ - _/_|__________________|_\_ - L| | MIDDLE | |R - _|_|__________________|_|_ - \ | BOTTOM | / - BL\|__________________|/ BR - | | -*/ - -typedef enum e_rounded_edge -{ - ROUNDED_RECT_LEFT = 0x1, - ROUNDED_RECT_TOP = 0x2, - ROUNDED_RECT_RIGHT = 0x4, - ROUNDED_RECT_BOTTOM = 0x8, - ROUNDED_RECT_ALL = 0xf -}ERoundedEdge; - - -void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL); -void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL); -void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, const LLVector3& width_vec, const LLVector3& height_vec); - -inline void gl_rect_2d( const LLRect& rect, BOOL filled ) -{ - gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled ); -} - -inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL filled) -{ - gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled ); -} - class LLImageProviderInterface; typedef void (*LLUIAudioCallback)(const LLUUID& uuid); @@ -281,10 +197,10 @@ public: static void cleanupClass(); static void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& ); - static void pushMatrix(); - static void popMatrix(); - static void loadIdentity(); - static void translate(F32 x, F32 y, F32 z = 0.0f); + static void pushMatrix() { LLRender2D::pushMatrix(); } + static void popMatrix() { LLRender2D::popMatrix(); } + static void loadIdentity() { LLRender2D::loadIdentity(); } + static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::translate(x, y, z); } static LLRect sDirtyRect; static BOOL sDirty; @@ -329,10 +245,13 @@ public: static void getMousePositionScreen(S32 *x, S32 *y); static void setMousePositionLocal(const LLView* viewp, S32 x, S32 y); static void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y); - static void setScaleFactor(const LLVector2& scale_factor); - static void setLineWidth(F32 width); - static LLPointer getUIImageByID(const LLUUID& image_id, S32 priority = 0); - static LLPointer getUIImage(const std::string& name, S32 priority = 0); + static LLVector2& getScaleFactor() { return LLRender2D::sGLScaleFactor; } + static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::setScaleFactor(scale_factor); } + static void setLineWidth(F32 width) { LLRender2D::setLineWidth(width); } + static LLPointer getUIImageByID(const LLUUID& image_id, S32 priority = 0) + { return LLRender2D::getUIImageByID(image_id, priority); } + static LLPointer getUIImage(const std::string& name, S32 priority = 0) + { return LLRender2D::getUIImage(name, priority); } static LLVector2 getWindowSize(); static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); @@ -362,12 +281,10 @@ public: static settings_map_t sSettingGroups; static LLUIAudioCallback sAudioCallback; static LLUIAudioCallback sDeferredAudioCallback; - static LLVector2 sGLScaleFactor; static LLWindow* sWindow; static LLView* sRootView; static LLHelp* sHelpImpl; private: - static LLImageProviderInterface* sImageProvider; static std::vector sXUIPaths; static LLFrameTimer sMouseIdleTimer; static add_popup_t sAddPopupFunc; @@ -378,18 +295,6 @@ private: // Moved LLLocalClipRect to lllocalcliprect.h -//RN: maybe this needs to moved elsewhere? -class LLImageProviderInterface -{ -protected: - LLImageProviderInterface() {}; - virtual ~LLImageProviderInterface() {}; -public: - virtual LLPointer getUIImage(const std::string& name, S32 priority) = 0; - virtual LLPointer getUIImageByID(const LLUUID& id, S32 priority) = 0; - virtual void cleanUp() = 0; -}; - class LLCallbackRegistry { public: @@ -600,7 +505,4 @@ namespace LLInitParam }; } -extern LLGLSLShader gSolidColorProgram; -extern LLGLSLShader gUIProgram; - #endif diff --git a/indra/llui/lluiimage.cpp b/indra/llui/lluiimage.cpp deleted file mode 100644 index 9ed98f941f..0000000000 --- a/indra/llui/lluiimage.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/** - * @file lluiimage.cpp - * @brief UI implementation - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// Utilities functions the user interface needs - -//#include "llviewerprecompiledheaders.h" -#include "linden_common.h" - -// Project includes -#include "lluiimage.h" -#include "llui.h" - -LLUIImage::LLUIImage(const std::string& name, LLPointer image) -: mName(name), - mImage(image), - mScaleRegion(0.f, 1.f, 1.f, 0.f), - mClipRegion(0.f, 1.f, 1.f, 0.f), - mUniformScaling(TRUE), - mNoClip(TRUE), - mImageLoaded(NULL) -{ -} - -LLUIImage::~LLUIImage() -{ - delete mImageLoaded; -} - -void LLUIImage::setClipRegion(const LLRectf& region) -{ - mClipRegion = region; - mNoClip = mClipRegion.mLeft == 0.f - && mClipRegion.mRight == 1.f - && mClipRegion.mBottom == 0.f - && mClipRegion.mTop == 1.f; -} - -void LLUIImage::setScaleRegion(const LLRectf& region) -{ - mScaleRegion = region; - mUniformScaling = mScaleRegion.mLeft == 0.f - && mScaleRegion.mRight == 1.f - && mScaleRegion.mBottom == 0.f - && mScaleRegion.mTop == 1.f; -} - -//TODO: move drawing implementation inside class -void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const -{ - gl_draw_scaled_image(x, y, getWidth(), getHeight(), mImage, color, mClipRegion); -} - -void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const -{ - if (mUniformScaling) - { - gl_draw_scaled_image(x, y, width, height, mImage, color, mClipRegion); - } - else - { - gl_draw_scaled_image_with_border( - x, y, - width, height, - mImage, - color, - FALSE, - mClipRegion, - mScaleRegion); - } -} - -void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const -{ - gl_draw_scaled_image_with_border( - x, y, - width, height, - mImage, - color, - TRUE, - mClipRegion, - mScaleRegion); -} - -void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const -{ - LLRect border_rect; - border_rect.setOriginAndSize(x, y, width, height); - border_rect.stretch(border_width, border_width); - drawSolid(border_rect, color); -} - -void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, const LLVector3& y_axis, - const LLRect& rect, const LLColor4& color) -{ - F32 border_scale = 1.f; - F32 border_height = (1.f - mScaleRegion.getHeight()) * getHeight(); - F32 border_width = (1.f - mScaleRegion.getWidth()) * getWidth(); - if (rect.getHeight() < border_height || rect.getWidth() < border_width) - { - if(border_height - rect.getHeight() > border_width - rect.getWidth()) - { - border_scale = (F32)rect.getHeight() / border_height; - } - else - { - border_scale = (F32)rect.getWidth() / border_width; - } - } - - LLUI::pushMatrix(); - { - LLVector3 rect_origin = origin_agent + (rect.mLeft * x_axis) + (rect.mBottom * y_axis); - LLUI::translate(rect_origin.mV[VX], - rect_origin.mV[VY], - rect_origin.mV[VZ]); - gGL.getTexUnit(0)->bind(getImage()); - gGL.color4fv(color.mV); - - LLRectf center_uv_rect(mClipRegion.mLeft + mScaleRegion.mLeft * mClipRegion.getWidth(), - mClipRegion.mBottom + mScaleRegion.mTop * mClipRegion.getHeight(), - mClipRegion.mLeft + mScaleRegion.mRight * mClipRegion.getWidth(), - mClipRegion.mBottom + mScaleRegion.mBottom * mClipRegion.getHeight()); - gl_segmented_rect_3d_tex(mClipRegion, - center_uv_rect, - LLRectf(border_width * border_scale * 0.5f / (F32)rect.getWidth(), - (rect.getHeight() - (border_height * border_scale * 0.5f)) / (F32)rect.getHeight(), - (rect.getWidth() - (border_width * border_scale * 0.5f)) / (F32)rect.getWidth(), - (border_height * border_scale * 0.5f) / (F32)rect.getHeight()), - rect.getWidth() * x_axis, - rect.getHeight() * y_axis); - - } LLUI::popMatrix(); -} - - -S32 LLUIImage::getWidth() const -{ - // return clipped dimensions of actual image area - return llround((F32)mImage->getWidth(0) * mClipRegion.getWidth()); -} - -S32 LLUIImage::getHeight() const -{ - // return clipped dimensions of actual image area - return llround((F32)mImage->getHeight(0) * mClipRegion.getHeight()); -} - -S32 LLUIImage::getTextureWidth() const -{ - return mImage->getWidth(0); -} - -S32 LLUIImage::getTextureHeight() const -{ - return mImage->getHeight(0); -} - -boost::signals2::connection LLUIImage::addLoadedCallback( const image_loaded_signal_t::slot_type& cb ) -{ - if (!mImageLoaded) - { - mImageLoaded = new image_loaded_signal_t(); - } - return mImageLoaded->connect(cb); -} - - -void LLUIImage::onImageLoaded() -{ - if (mImageLoaded) - { - (*mImageLoaded)(); - } -} - - -namespace LLInitParam -{ - void ParamValue::updateValueFromBlock() - { - // The keyword "none" is specifically requesting a null image - // do not default to current value. Used to overwrite template images. - if (name() == "none") - { - updateValue(NULL); - return; - } - - LLUIImage* imagep = LLUI::getUIImage(name()); - if (imagep) - { - updateValue(imagep); - } - } - - void ParamValue::updateBlockFromValue(bool make_block_authoritative) - { - if (getValue() == NULL) - { - name.set("none", make_block_authoritative); - } - else - { - name.set(getValue()->getName(), make_block_authoritative); - } - } - - - bool ParamCompare::equals( - LLUIImage* const &a, - LLUIImage* const &b) - { - // force all LLUIImages for XML UI export to be "non-default" - if (!a && !b) - return false; - else - return (a == b); - } -} - diff --git a/indra/llui/lluiimage.h b/indra/llui/lluiimage.h deleted file mode 100644 index 7817ba1c7b..0000000000 --- a/indra/llui/lluiimage.h +++ /dev/null @@ -1,126 +0,0 @@ -/** - * @file lluiimage.h - * @brief wrapper for images used in the UI that handles smart scaling, etc. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLUIIMAGE_H -#define LL_LLUIIMAGE_H - -#include "v4color.h" -#include "llpointer.h" -#include "llrefcount.h" -#include "llrefcount.h" -#include "llrect.h" -#include -#include -#include "llinitparam.h" -#include "lltexture.h" - -extern const LLColor4 UI_VERTEX_COLOR; - -class LLUIImage : public LLRefCount -{ -public: - typedef boost::signals2::signal image_loaded_signal_t; - - LLUIImage(const std::string& name, LLPointer image); - virtual ~LLUIImage(); - - void setClipRegion(const LLRectf& region); - void setScaleRegion(const LLRectf& region); - - LLPointer getImage() { return mImage; } - const LLPointer& getImage() const { return mImage; } - - void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR) const; - void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR) const; - void draw(const LLRect& rect, const LLColor4& color = UI_VERTEX_COLOR) const { draw(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color); } - - void drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const; - void drawSolid(const LLRect& rect, const LLColor4& color) const { drawSolid(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color); } - void drawSolid(S32 x, S32 y, const LLColor4& color) const { drawSolid(x, y, getWidth(), getHeight(), color); } - - void drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const; - void drawBorder(const LLRect& rect, const LLColor4& color, S32 border_width) const { drawBorder(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color, border_width); } - void drawBorder(S32 x, S32 y, const LLColor4& color, S32 border_width) const { drawBorder(x, y, getWidth(), getHeight(), color, border_width); } - - void draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, const LLVector3& y_axis, const LLRect& rect, const LLColor4& color); - - const std::string& getName() const { return mName; } - - virtual S32 getWidth() const; - virtual S32 getHeight() const; - - // returns dimensions of underlying textures, which might not be equal to ui image portion - S32 getTextureWidth() const; - S32 getTextureHeight() const; - - boost::signals2::connection addLoadedCallback( const image_loaded_signal_t::slot_type& cb ); - - void onImageLoaded(); - -protected: - image_loaded_signal_t* mImageLoaded; - - std::string mName; - LLRectf mScaleRegion; - LLRectf mClipRegion; - LLPointer mImage; - BOOL mUniformScaling; - BOOL mNoClip; -}; - -namespace LLInitParam -{ - template<> - class ParamValue - : public CustomParamValue - { - typedef boost::add_reference::type>::type T_const_ref; - typedef CustomParamValue super_t; - public: - Optional name; - - ParamValue(LLUIImage* const& image = NULL) - : super_t(image) - { - updateBlockFromValue(false); - addSynonym(name, "name"); - } - - void updateValueFromBlock(); - void updateBlockFromValue(bool make_block_authoritative); - }; - - // Need custom comparison function for our test app, which only loads - // LLUIImage* as NULL. - template<> - struct ParamCompare - { - static bool equals(LLUIImage* const &a, LLUIImage* const &b); - }; -} - -typedef LLPointer LLUIImagePtr; -#endif -- cgit v1.2.3 From 3f1d360a04c4e4d8f07b7e93cd926961ae379430 Mon Sep 17 00:00:00 2001 From: "prep@lindenlab.com" Date: Fri, 10 May 2013 13:57:02 -0500 Subject: SH-4035: Removed prompt to save if av just has outfit changes. Hooked up logic to handle ctrl+w and ctrl+shift+w confirmation prompts --- indra/llui/llfloater.cpp | 31 ++++++++++++++++++++++++++----- indra/llui/llfloater.h | 3 ++- indra/llui/llpanel.cpp | 22 ++++++++++++++++++++-- indra/llui/llpanel.h | 10 +++++++++- 4 files changed, 57 insertions(+), 9 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 09e27a264a..28dfda8faf 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -704,9 +704,15 @@ void LLFloater::openFloater(const LLSD& key) dirtyRect(); } +void LLFloater::verifyClose() +{ + LLPanel::handleCloseConfirmation(); +} + void LLFloater::closeFloater(bool app_quitting) { llinfos << "Closing floater " << getName() << llendl; + if (app_quitting) { LLFloater::sQuitting = true; @@ -781,7 +787,7 @@ void LLFloater::closeFloater(bool app_quitting) dirtyRect(); // Close callbacks - onClose(app_quitting); + onClose(app_quitting); mCloseSignal(this, LLSD(app_quitting)); // Hide or Destroy @@ -1788,11 +1794,19 @@ void LLFloater::initRectControl() void LLFloater::closeFrontmostFloater() { LLFloater* floater_to_close = gFloaterView->getFrontmostClosableFloater(); - if(floater_to_close) + if( floater_to_close ) { - floater_to_close->closeFloater(); + if ( floater_to_close->mVerifyUponClose ) + { + floater_to_close->verifyClose(); + //Closing of the window handle in the subclass - so bug out here. + return; + } + else + { + floater_to_close->closeFloater(); + } } - // if nothing took focus after closing focused floater // give it to next floater (to allow closing multiple windows via keyboard in rapid succession) if (gFocusMgr.getKeyboardFocus() == NULL) @@ -2631,7 +2645,14 @@ void LLFloaterView::closeAllChildren(bool app_quitting) if (floaterp->canClose() && !floaterp->isDead() && (app_quitting || floaterp->getVisible())) { - floaterp->closeFloater(app_quitting); + if ( floaterp->mVerifyUponClose ) + { + floaterp->verifyClose(); + } + else + { + floaterp->closeFloater(app_quitting); + } } } } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 4dba1e645f..bf71b527b3 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -225,6 +225,7 @@ public: // If allowed, close the floater cleanly, releasing focus. virtual void closeFloater(bool app_quitting = false); + virtual void verifyClose(); // Close the floater or its host. Use when hidding or toggling a floater instance. virtual void closeHostedFloater(); @@ -303,7 +304,7 @@ public: /*virtual*/ void setVisible(BOOL visible); // do not override /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // do not override - + void handleCloseConfirmation( ); void setFrontmost(BOOL take_focus = TRUE); virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 67472ad166..01165a5718 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -114,7 +114,9 @@ LLPanel::LLPanel(const LLPanel::Params& p) mCommitCallbackRegistrar(false), mEnableCallbackRegistrar(false), mXMLFilename(p.filename), - mVisibleSignal(NULL) + mVisibleSignal(NULL), + mCloseConfirmationSignal(NULL), + mVerifyUponClose(false) // *NOTE: Be sure to also change LLPanel::initFromParams(). We have too // many classes derived from LLPanel to retrofit them all to pass in params. { @@ -127,6 +129,7 @@ LLPanel::LLPanel(const LLPanel::Params& p) LLPanel::~LLPanel() { delete mVisibleSignal; + delete mCloseConfirmationSignal; } // virtual @@ -349,6 +352,14 @@ void LLPanel::handleVisibilityChange ( BOOL new_visibility ) (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD } + +void LLPanel::handleCloseConfirmation( ) +{ + if (mCloseConfirmationSignal) + { + (*mCloseConfirmationSignal)(this, LLSD() ); + } +} void LLPanel::setFocus(BOOL b) { if( b && !hasFocus()) @@ -959,10 +970,17 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t:: { mVisibleSignal = new commit_signal_t(); } - return mVisibleSignal->connect(cb); } +boost::signals2::connection LLPanel::setCloseConfirmationCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mCloseConfirmationSignal) + { + mCloseConfirmationSignal = new commit_signal_t(); + } + return mCloseConfirmationSignal->connect(cb); +} static LLFastTimer::DeclareTimer FTM_BUILD_PANELS("Build Panels"); //----------------------------------------------------------------------------- diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index e63b41f97c..1b0beaa5c8 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -116,6 +116,8 @@ public: /*virtual*/ void draw(); /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); + void handleCloseConfirmation( ); + // From LLFocusableElement /*virtual*/ void setFocus( BOOL b ); @@ -251,6 +253,10 @@ public: std::string getXMLFilename() { return mXMLFilename; }; boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setCloseConfirmationCallback( const commit_signal_t::slot_type& cb ); + +public: + const BOOL confirmClose() const { return mVerifyUponClose; } protected: // Override to set not found list @@ -260,6 +266,7 @@ protected: EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar; commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD() + commit_signal_t* mCloseConfirmationSignal; std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer typedef std::deque factory_stack_t; @@ -267,7 +274,8 @@ protected: // for setting the xml filename when building panel in context dependent cases std::string mXMLFilename; - + //Specific close-down logic in subclass + BOOL mVerifyUponClose; private: BOOL mBgVisible; // any background at all? BOOL mBgOpaque; // use opaque color or image -- cgit v1.2.3 From c498f53d9ab02a41886b55762883d116801fd39b Mon Sep 17 00:00:00 2001 From: "prep@lindenlab.com" Date: Tue, 28 May 2013 11:51:11 -0500 Subject: Sh-4035: Updated implementation according to new specs. Fixed a couple of outstanding bugs. --- indra/llui/llfloater.cpp | 12 ++++++++++++ indra/llui/llpanel.cpp | 3 ++- indra/llui/llpanel.h | 5 +++-- 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 28dfda8faf..ae4961559e 100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -713,6 +713,18 @@ void LLFloater::closeFloater(bool app_quitting) { llinfos << "Closing floater " << getName() << llendl; + if (!app_quitting) + { + if ( mVerifyUponClose && !mForceCloseAfterVerify ) + { + onClose( app_quitting ); + if ( mForceCloseAfterVerify ) + { + return; + } + } + } + if (app_quitting) { LLFloater::sQuitting = true; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 01165a5718..7b7920f866 100755 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -116,7 +116,8 @@ LLPanel::LLPanel(const LLPanel::Params& p) mXMLFilename(p.filename), mVisibleSignal(NULL), mCloseConfirmationSignal(NULL), - mVerifyUponClose(false) + mVerifyUponClose(false), + mForceCloseAfterVerify(false) // *NOTE: Be sure to also change LLPanel::initFromParams(). We have too // many classes derived from LLPanel to retrofit them all to pass in params. { diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 1b0beaa5c8..d48fab6dd9 100755 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -255,8 +255,6 @@ public: boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setCloseConfirmationCallback( const commit_signal_t::slot_type& cb ); -public: - const BOOL confirmClose() const { return mVerifyUponClose; } protected: // Override to set not found list @@ -276,6 +274,9 @@ protected: std::string mXMLFilename; //Specific close-down logic in subclass BOOL mVerifyUponClose; +public: + BOOL mForceCloseAfterVerify; + private: BOOL mBgVisible; // any background at all? BOOL mBgOpaque; // use opaque color or image -- cgit v1.2.3 From c81b685b4217b3c321815e1993d39fb0b479a767 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 3 Jun 2013 16:10:46 -0400 Subject: Fix for sh-4221 Sometimes ctrl+q needed to be hit twice --- indra/llui/llfloater.cpp | 8 ++++---- indra/llui/llfloater.h | 2 +- indra/llui/llpanel.cpp | 4 ++-- indra/llui/llpanel.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index ae4961559e..63491aa296 100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -704,9 +704,9 @@ void LLFloater::openFloater(const LLSD& key) dirtyRect(); } -void LLFloater::verifyClose() +void LLFloater::verifyClose( bool app_quitting ) { - LLPanel::handleCloseConfirmation(); + LLPanel::handleCloseConfirmation( app_quitting ); } void LLFloater::closeFloater(bool app_quitting) @@ -726,7 +726,7 @@ void LLFloater::closeFloater(bool app_quitting) } if (app_quitting) - { + { LLFloater::sQuitting = true; } @@ -2659,7 +2659,7 @@ void LLFloaterView::closeAllChildren(bool app_quitting) { if ( floaterp->mVerifyUponClose ) { - floaterp->verifyClose(); + floaterp->verifyClose(app_quitting); } else { diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index bf71b527b3..8eb40ddd0b 100755 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -225,7 +225,7 @@ public: // If allowed, close the floater cleanly, releasing focus. virtual void closeFloater(bool app_quitting = false); - virtual void verifyClose(); + virtual void verifyClose( bool app_quitting = false ); // Close the floater or its host. Use when hidding or toggling a floater instance. virtual void closeHostedFloater(); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 7b7920f866..b0bdbcb7d1 100755 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -354,11 +354,11 @@ void LLPanel::handleVisibilityChange ( BOOL new_visibility ) } -void LLPanel::handleCloseConfirmation( ) +void LLPanel::handleCloseConfirmation( bool app_quitting) { if (mCloseConfirmationSignal) { - (*mCloseConfirmationSignal)(this, LLSD() ); + (*mCloseConfirmationSignal)(this, LLSD( app_quitting ) ); } } void LLPanel::setFocus(BOOL b) diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index d48fab6dd9..02f8c0aba7 100755 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -116,7 +116,7 @@ public: /*virtual*/ void draw(); /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); - void handleCloseConfirmation( ); + void handleCloseConfirmation( bool app_quitting ); // From LLFocusableElement -- cgit v1.2.3 From c5c2e7b405bbbcc3d1c1756e34c3069611f0e4a1 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 3 Jun 2013 18:08:48 -0400 Subject: SH-4035 spec change. If you revert after quiting, SL shutsdown. --- indra/llui/llfloater.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 63491aa296..93eca8b62e 100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -717,9 +717,13 @@ void LLFloater::closeFloater(bool app_quitting) { if ( mVerifyUponClose && !mForceCloseAfterVerify ) { + + llinfos<<"prep#dogshit1"< Date: Fri, 7 Jun 2013 17:25:43 -0500 Subject: Removed some debug tracking --- indra/llui/llfloater.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 93eca8b62e..f8b01e106b 100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -716,22 +716,17 @@ void LLFloater::closeFloater(bool app_quitting) if (!app_quitting) { if ( mVerifyUponClose && !mForceCloseAfterVerify ) - { - - llinfos<<"prep#dogshit1"< Date: Fri, 14 Jun 2013 12:34:45 -0500 Subject: WIP: sh-4035 backed out changes to appearance window confirmation --- indra/llui/llfloater.cpp | 47 +++++++---------------------------------------- indra/llui/llfloater.h | 5 ++--- indra/llui/llpanel.cpp | 23 ++--------------------- indra/llui/llpanel.h | 11 +---------- 4 files changed, 12 insertions(+), 74 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index f8b01e106b..0807b497a7 100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -704,29 +704,11 @@ void LLFloater::openFloater(const LLSD& key) dirtyRect(); } -void LLFloater::verifyClose( bool app_quitting ) -{ - LLPanel::handleCloseConfirmation( app_quitting ); -} - void LLFloater::closeFloater(bool app_quitting) { llinfos << "Closing floater " << getName() << llendl; - - if (!app_quitting) - { - if ( mVerifyUponClose && !mForceCloseAfterVerify ) - { - onClose( app_quitting ); - if ( mForceCloseAfterVerify ) - { - return; - } - } - } - if (app_quitting) - { + { LLFloater::sQuitting = true; } @@ -799,7 +781,7 @@ void LLFloater::closeFloater(bool app_quitting) dirtyRect(); // Close callbacks - onClose(app_quitting); + onClose(app_quitting); mCloseSignal(this, LLSD(app_quitting)); // Hide or Destroy @@ -1639,7 +1621,7 @@ void LLFloater::bringToFront( S32 x, S32 y ) // virtual -void LLFloater::setVisibleAndFrontmost(BOOL take_focus, const LLSD& key) +void LLFloater::setVisibleAndFrontmost(BOOL take_focus,const LLSD& key) { LLMultiFloater* hostp = getHost(); if (hostp) @@ -1806,19 +1788,11 @@ void LLFloater::initRectControl() void LLFloater::closeFrontmostFloater() { LLFloater* floater_to_close = gFloaterView->getFrontmostClosableFloater(); - if( floater_to_close ) + if(floater_to_close) { - if ( floater_to_close->mVerifyUponClose ) - { - floater_to_close->verifyClose(); - //Closing of the window handle in the subclass - so bug out here. - return; - } - else - { - floater_to_close->closeFloater(); - } + floater_to_close->closeFloater(); } + // if nothing took focus after closing focused floater // give it to next floater (to allow closing multiple windows via keyboard in rapid succession) if (gFocusMgr.getKeyboardFocus() == NULL) @@ -2657,14 +2631,7 @@ void LLFloaterView::closeAllChildren(bool app_quitting) if (floaterp->canClose() && !floaterp->isDead() && (app_quitting || floaterp->getVisible())) { - if ( floaterp->mVerifyUponClose ) - { - floaterp->verifyClose(app_quitting); - } - else - { - floaterp->closeFloater(app_quitting); - } + floaterp->closeFloater(app_quitting); } } } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 8eb40ddd0b..1d0d3cb050 100755 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -225,7 +225,6 @@ public: // If allowed, close the floater cleanly, releasing focus. virtual void closeFloater(bool app_quitting = false); - virtual void verifyClose( bool app_quitting = false ); // Close the floater or its host. Use when hidding or toggling a floater instance. virtual void closeHostedFloater(); @@ -304,9 +303,9 @@ public: /*virtual*/ void setVisible(BOOL visible); // do not override /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // do not override - void handleCloseConfirmation( ); + void setFrontmost(BOOL take_focus = TRUE); - virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); + virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); // Defaults to false. virtual BOOL canSaveAs() const { return FALSE; } diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index b0bdbcb7d1..67472ad166 100755 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -114,10 +114,7 @@ LLPanel::LLPanel(const LLPanel::Params& p) mCommitCallbackRegistrar(false), mEnableCallbackRegistrar(false), mXMLFilename(p.filename), - mVisibleSignal(NULL), - mCloseConfirmationSignal(NULL), - mVerifyUponClose(false), - mForceCloseAfterVerify(false) + mVisibleSignal(NULL) // *NOTE: Be sure to also change LLPanel::initFromParams(). We have too // many classes derived from LLPanel to retrofit them all to pass in params. { @@ -130,7 +127,6 @@ LLPanel::LLPanel(const LLPanel::Params& p) LLPanel::~LLPanel() { delete mVisibleSignal; - delete mCloseConfirmationSignal; } // virtual @@ -353,14 +349,6 @@ void LLPanel::handleVisibilityChange ( BOOL new_visibility ) (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD } - -void LLPanel::handleCloseConfirmation( bool app_quitting) -{ - if (mCloseConfirmationSignal) - { - (*mCloseConfirmationSignal)(this, LLSD( app_quitting ) ); - } -} void LLPanel::setFocus(BOOL b) { if( b && !hasFocus()) @@ -971,17 +959,10 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t:: { mVisibleSignal = new commit_signal_t(); } + return mVisibleSignal->connect(cb); } -boost::signals2::connection LLPanel::setCloseConfirmationCallback( const commit_signal_t::slot_type& cb ) -{ - if (!mCloseConfirmationSignal) - { - mCloseConfirmationSignal = new commit_signal_t(); - } - return mCloseConfirmationSignal->connect(cb); -} static LLFastTimer::DeclareTimer FTM_BUILD_PANELS("Build Panels"); //----------------------------------------------------------------------------- diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 02f8c0aba7..e63b41f97c 100755 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -116,8 +116,6 @@ public: /*virtual*/ void draw(); /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); - void handleCloseConfirmation( bool app_quitting ); - // From LLFocusableElement /*virtual*/ void setFocus( BOOL b ); @@ -253,8 +251,6 @@ public: std::string getXMLFilename() { return mXMLFilename; }; boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb ); - boost::signals2::connection setCloseConfirmationCallback( const commit_signal_t::slot_type& cb ); - protected: // Override to set not found list @@ -264,7 +260,6 @@ protected: EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar; commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD() - commit_signal_t* mCloseConfirmationSignal; std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer typedef std::deque factory_stack_t; @@ -272,11 +267,7 @@ protected: // for setting the xml filename when building panel in context dependent cases std::string mXMLFilename; - //Specific close-down logic in subclass - BOOL mVerifyUponClose; -public: - BOOL mForceCloseAfterVerify; - + private: BOOL mBgVisible; // any background at all? BOOL mBgOpaque; // use opaque color or image -- cgit v1.2.3 From 7d5ed4f7477c2c564f0e9dededf7131ed42d55b8 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 27 Jun 2013 21:28:52 +0100 Subject: Moving LSL highlighting colour info into .../skins/default/colors.xml where it makes more sense than its own xml file. Changing other functions to read it. --- indra/llui/llkeywords.cpp | 90 +++++++++++++++++++++++---------------------- indra/llui/llkeywords.h | 23 ++++++------ indra/llui/lltexteditor.cpp | 2 +- indra/llui/lltexteditor.h | 2 +- 4 files changed, 60 insertions(+), 57 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index b7eb4c63bc..521134f26c 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -71,7 +71,6 @@ inline BOOL LLKeywordToken::isTail(const llwchar* s) const LLKeywords::LLKeywords() : mLoaded(FALSE) { - setFilenameColors( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_colors.xml") ); setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_tokens.xml") ); } @@ -84,7 +83,7 @@ LLKeywords::~LLKeywords() -void LLKeywords::addColorGroup(const std::string key_in, const LLColor3 color) +void LLKeywords::addColorGroup(const std::string key_in, const LLColor4 color) { WStringMapIndex key ( utf8str_to_wstring(key_in) ); mColorGroupMap[key] = color; @@ -93,7 +92,7 @@ void LLKeywords::addColorGroup(const std::string key_in, const LLColor3 color) // Add the token as described void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, const std::string& key_in, - const LLColor3& color, + const LLColor4& color, const std::string& tool_tip_in, const std::string& delimiter_in) { @@ -165,33 +164,47 @@ std::string LLKeywords::getAttribute(const std::string& key) return (it != mAttributes.end()) ? it->second : ""; } -LLColor3 LLKeywords::getColorGroup(const std::string key_in) +LLColor4 LLKeywords::getColorGroup(const std::string key_in) { - // LLColor3 initialises to Black (0,0,0) - LLColor3 Colour; - WStringMapIndex key ( utf8str_to_wstring(key_in) ); - group_color_map_t::iterator it = mColorGroupMap.find(key); - if (it == mColorGroupMap.end()) - { - LL_WARNS("Colour lookup") << "'" << key_in << "' not found!" << LL_ENDL; - } - else - { - Colour = it->second; - } - - return Colour; + std::string ColourGroup = "Black"; + if (key_in == "constants-float") { + ColourGroup = "SyntaxLslConstantFloat"; + } else if (key_in == "constants-integer") { + ColourGroup = "SyntaxLslConstantInteger"; + } else if (key_in == "constants-key") { + ColourGroup = "SyntaxLslConstantKey"; + } else if (key_in == "constants-string") { + ColourGroup = "SyntaxLslConstantRotation"; + } else if (key_in == "constants-string") { + ColourGroup = "SyntaxLslConstantString"; + } else if (key_in == "constants-vector") { + ColourGroup = "SyntaxLslConstantVector"; + } else if (key_in == "controls") { + ColourGroup = "SyntaxLslControlFlow"; + } else if (key_in == "events") { + ColourGroup = "SyntaxLslEvent"; + } else if (key_in == "functions") { + ColourGroup = "SyntaxLslFunction"; + } else if (key_in == "types") { + ColourGroup = "SyntaxLslDataType"; + } else if (key_in == "sections") { + ColourGroup = "SyntaxLslSection"; + } else if (key_in == "misc-double_quotation_marks") { + ColourGroup = "SyntaxLslStringLiteral"; + } else if (key_in == "misc-comments_1_sided") { + ColourGroup = "SyntaxLslComment1Sided"; + } else if (key_in == "misc-comments_2_sided") { + ColourGroup = "SyntaxLslComment2Sided"; + } + + return LLUIColorTable::instance().getColor(ColourGroup); } BOOL LLKeywords::initialise() { mReady = false; - if (! loadIntoLLSD(mFilenameColors, mColors) ) - { - LL_ERRS("") << "Failed to load color data, cannot continue!" << LL_ENDL; - } - else if (! loadIntoLLSD(mFilenameSyntax, mSyntax) ) + if (! loadIntoLLSD(mFilenameSyntax, mSyntax) ) { LL_ERRS("") << "Failed to load syntax data from '" << mFilenameSyntax << "', cannot continue!" << LL_ENDL; } @@ -199,16 +212,6 @@ BOOL LLKeywords::initialise() { mReady = true; } - - if (ready()) - { - processColors(); - } - else - { - LL_ERRS("") << LL_ENDL; - LL_ERRS("") << "Failed to load one or both data files, cannot continue!" << LL_ENDL; - } return mReady; } @@ -251,7 +254,7 @@ BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) /** * @brief Start processing the colour LLSD from its beginning. * - */ + * / std::string LLKeywords::processColors() { return processColors(mColors, ""); @@ -261,7 +264,7 @@ std::string LLKeywords::processColors() * @brief Recursively process the colour LLSD from an arbitrary level. * @desc Process the supplied LLSD for colour data. The strPrefix is a string * of hyphen separated keys from previous levels. - */ + * / std::string LLKeywords::processColors(LLSD &settings, const std::string strPrefix) { if (settings.isMap() || (! settings.isMap() && strPrefix != "") ) @@ -299,12 +302,13 @@ std::string LLKeywords::processColors(LLSD &settings, const std::string strPrefi } return strPrefix; } +*/ void LLKeywords::processTokens() { // Add 'standard' stuff: Quotes, Comments, Strings, Labels, etc. before processing the LLSD std::string delimiter; - addToken(LLKeywordToken::TT_LABEL, "@", getColorGroup("label"), "Label\nTarget for jump statement", delimiter ); + addToken(LLKeywordToken::TT_LABEL, "@", getColorGroup("misc-flow-label"), "Label\nTarget for jump statement", delimiter ); addToken(LLKeywordToken::TT_ONE_SIDED_DELIMITER, "//", getColorGroup("misc-comments_1_sided"), "Comment (single-line)\nNon-functional commentary or disabled code", delimiter ); 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", "\"" ); @@ -344,7 +348,7 @@ void LLKeywords::processTokens() void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { - LLColor3 Color = getColorGroup(Group); + LLColor4 Color; LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << Color << "'" << LL_ENDL; LLKeywordToken::TOKEN_TYPE token_type = LLKeywordToken::TT_UNKNOWN; @@ -534,7 +538,7 @@ bool LLKeywords::WStringMapIndex::operator<(const LLKeywords::WStringMapIndex &o return result; } -LLColor3 LLKeywords::readColor( const std::string& s ) +LLColor4 LLKeywords::readColor( const std::string& s ) { F32 r, g, b; r = g = b = 0.0f; @@ -543,22 +547,22 @@ LLColor3 LLKeywords::readColor( const std::string& s ) { llinfos << " poorly formed color in keyword file" << llendl; } - return LLColor3( r, g, b ); + return LLColor4( r, g, b, 1.f); } -LLColor3 LLKeywords::readColor(LLSD& sd) +LLColor4 LLKeywords::readColor(LLSD& sd) { if (sd.isArray()) { - return LLColor3 (sd); + return LLColor4 (sd, 1.f); } else if (sd.isMap()) { - return LLColor3 ( sd.get("x").asReal(), sd.get("y").asReal(), sd.get("z").asReal() ); + return LLColor4 ( sd.get("x").asReal(), sd.get("y").asReal(), sd.get("z").asReal(), 1.f ); } else { - return LLColor3::black; + return LLColor4::black; } } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index badbd2ae85..6889b95339 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -30,6 +30,7 @@ #include "llstring.h" #include "v3color.h" +#include "v4color.h" #include #include #include @@ -69,7 +70,7 @@ public: TT_TYPE // WORD }; - LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter ) + LLKeywordToken( TOKEN_TYPE type, const LLColor4& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter ) : mType( type ), mToken( token ), @@ -84,7 +85,7 @@ public: BOOL isHead(const llwchar* s) const; BOOL isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } - const LLColor3& getColor() const { return mColor; } + const LLColor4& getColor() const { return mColor; } TOKEN_TYPE getType() const { return mType; } const LLWString& getToolTip() const { return mToolTip; } const LLWString& getDelimiter() const { return mDelimiter; } @@ -96,7 +97,7 @@ public: private: TOKEN_TYPE mType; LLWString mToken; - LLColor3 mColor; + LLColor4 mColor; LLWString mToolTip; LLWString mDelimiter; }; @@ -107,12 +108,11 @@ public: LLKeywords(); ~LLKeywords(); - void addColorGroup(const std::string key_in, const LLColor3 color); - LLColor3 getColorGroup(const std::string key_in); + void addColorGroup(const std::string key_in, const LLColor4 color); + LLColor4 getColorGroup(const std::string key_in); BOOL loadFromFile(); BOOL loadFromFile(const std::string& filename); BOOL isLoaded() const { return mLoaded; } - void setFilenameColors(const std::string filename) { mFilenameColors = filename; } void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); @@ -124,7 +124,7 @@ public: // Add the token as described void addToken(LLKeywordToken::TOKEN_TYPE type, const std::string& key, - const LLColor3& color, + const LLColor4& color, const std::string& tool_tip = LLStringUtil::null, const std::string& delimiter = LLStringUtil::null); @@ -153,7 +153,7 @@ public: bool mOwner; - LLColor3 mColor; + LLColor4 mColor; }; typedef std::map word_token_map_t; @@ -161,7 +161,7 @@ public: keyword_iterator_t begin() const { return mWordTokenMap.begin(); } keyword_iterator_t end() const { return mWordTokenMap.end(); } - typedef std::map group_color_map_t; + typedef std::map group_color_map_t; typedef group_color_map_t::const_iterator color_iterator_t; group_color_map_t mColorGroupMap; @@ -171,8 +171,8 @@ public: protected: void processTokensGroup(LLSD& Tokens, const std::string Group); - LLColor3 readColor(const std::string& s); - LLColor3 readColor(LLSD& sd); + LLColor4 readColor(const std::string& s); + LLColor4 readColor(LLSD& sd); void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); void insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); BOOL loadIntoLLSD( const std::string& filename, LLSD& data ); @@ -195,7 +195,6 @@ protected: private: BOOL ready() { return mReady; }; BOOL mReady; - std::string mFilenameColors; std::string mFilenameSyntax; }; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index d3f97dcac8..83d89af4b0 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2488,7 +2488,7 @@ static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting"); void LLTextEditor::loadKeywords(const std::string& filename, const std::vector& funcs, const std::vector& tooltips, - const LLColor3& color) + const LLColor4& color) { LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); if(mKeywords.loadFromFile()) diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index a6ed39eef8..2a0a0d524f 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -190,7 +190,7 @@ public: void loadKeywords(const std::string& filename, const std::vector& funcs, const std::vector& tooltips, - const LLColor3& func_color); + const LLColor4& func_color); LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); } LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); } -- cgit v1.2.3 From 02097397e06a6cf45c639823c7f633dffe3684e8 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Fri, 28 Jun 2013 18:29:59 +0100 Subject: Changing the way I commented out functions for later removal. TC doesn't like how I did it before :-( --- indra/llui/llkeywords.cpp | 104 +++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 521134f26c..315cf45f43 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -251,58 +251,58 @@ BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) return mLoaded; } -/** - * @brief Start processing the colour LLSD from its beginning. - * - * / -std::string LLKeywords::processColors() -{ - return processColors(mColors, ""); -} - -/** - * @brief Recursively process the colour LLSD from an arbitrary level. - * @desc Process the supplied LLSD for colour data. The strPrefix is a string - * of hyphen separated keys from previous levels. - * / -std::string LLKeywords::processColors(LLSD &settings, const std::string strPrefix) -{ - if (settings.isMap() || (! settings.isMap() && strPrefix != "") ) - { - LLSD llsd_map = settings; - - LLSD::map_iterator my_iter = llsd_map.beginMap(); - for ( ; my_iter != llsd_map.endMap(); ++my_iter) - { - std::string strGroup = strPrefix; - const LLSD::String& key = my_iter->first; - LLSD& value = my_iter->second; - - if (key == "color") - { - if (value.isMap() || value.isArray()) - { - addColorGroup(strGroup, readColor(value)); - } - else - { - LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; - } - } - else if (value.isMap()) - { - strGroup += (strGroup.length() == 0) ? my_iter->first : "-" + my_iter->first; - strGroup = processColors(value, strGroup); - } - else - { - LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; - } - } - } - return strPrefix; -} -*/ +///** +// * @brief Start processing the colour LLSD from its beginning. +// * +// */ +//std::string LLKeywords::processColors() +//{ +// return processColors(mColors, ""); +//} + +///** +// * @brief Recursively process the colour LLSD from an arbitrary level. +// * @desc Process the supplied LLSD for colour data. The strPrefix is a string +// * of hyphen separated keys from previous levels. +// */ +//std::string LLKeywords::processColors(LLSD &settings, const std::string strPrefix) +//{ +// if (settings.isMap() || (! settings.isMap() && strPrefix != "") ) +// { +// LLSD llsd_map = settings; + +// LLSD::map_iterator my_iter = llsd_map.beginMap(); +// for ( ; my_iter != llsd_map.endMap(); ++my_iter) +// { +// std::string strGroup = strPrefix; +// const LLSD::String& key = my_iter->first; +// LLSD& value = my_iter->second; +// +// if (key == "color") +// { +// if (value.isMap() || value.isArray()) +// { +// addColorGroup(strGroup, readColor(value)); +// } +// else +// { +// LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; +// } +// } +// else if (value.isMap()) +// { +// strGroup += (strGroup.length() == 0) ? my_iter->first : "-" + my_iter->first; +// strGroup = processColors(value, strGroup); +// } +// else +// { +// LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; +// } +// } +// } +// return strPrefix; +//} +//*/ void LLKeywords::processTokens() { -- cgit v1.2.3 From 0ffaf25e7599391841508fbac769bc3b544930a5 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Tue, 15 Oct 2013 21:46:24 +0100 Subject: STORM-1831 Removing unnecessary semi-colon --- indra/llui/llkeywords.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 6889b95339..77a12bc1e5 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -193,7 +193,7 @@ protected: std::string getArguments(LLSD& args); private: - BOOL ready() { return mReady; }; + BOOL ready() { return mReady; } BOOL mReady; std::string mFilenameSyntax; }; -- cgit v1.2.3 From bccbcced5426d95353f07ec2e8bb12c0b1ec03bf Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Tue, 15 Oct 2013 21:56:20 +0100 Subject: Renaming file to better reflect it's actual usage for the future. --- indra/llui/llkeywords.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 93e8c084e9..33a8cc947d 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -35,7 +35,6 @@ #include "lltexteditor.h" #include "llstl.h" - inline BOOL LLKeywordToken::isHead(const llwchar* s) const { // strncmp is much faster than string compare @@ -71,7 +70,7 @@ inline BOOL LLKeywordToken::isTail(const llwchar* s) const LLKeywords::LLKeywords() : mLoaded(FALSE) { - setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_tokens.xml") ); + setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_default.xml") ); } LLKeywords::~LLKeywords() -- cgit v1.2.3 From 79645e6981a97224024c5226d8713dce9569d54a Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Mon, 21 Oct 2013 04:09:20 +0100 Subject: STORM-1831 First attempt at using SyntaxIdLSL capability. (incomplete) --- indra/llui/llkeywords.cpp | 6 +++--- indra/llui/llkeywords.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 33a8cc947d..687c2fb31d 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -29,7 +29,6 @@ #include #include -#include "lldir.h" #include "llkeywords.h" #include "llsdserialize.h" #include "lltexteditor.h" @@ -70,7 +69,7 @@ inline BOOL LLKeywordToken::isTail(const llwchar* s) const LLKeywords::LLKeywords() : mLoaded(FALSE) { - setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_default.xml") ); + //setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_default.xml") ); } LLKeywords::~LLKeywords() @@ -199,9 +198,10 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) return LLUIColorTable::instance().getColor(ColourGroup); } -BOOL LLKeywords::initialise() +BOOL LLKeywords::initialise(ELLPath path, const std::string filename) { mReady = false; + setFilenameSyntax( gDirUtilp->getExpandedFilename(path, filename) ); if (! loadIntoLLSD(mFilenameSyntax, mSyntax) ) { diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 77a12bc1e5..1bd23549d2 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -28,6 +28,7 @@ #define LL_LLKEYWORDS_H +#include "lldir.h" #include "llstring.h" #include "v3color.h" #include "v4color.h" @@ -116,7 +117,7 @@ public: void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); - BOOL initialise(); + BOOL initialise(ELLPath path, const std::string filename); std::string processColors(); std::string processColors(LLSD &data, const std::string strGroup); void processTokens(); -- cgit v1.2.3 From 4af21580297dd85727ffdc5d4eee89ad58ead271 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 9 Nov 2013 11:31:32 +0000 Subject: Adding method to load cached/default syntax file and method to access sKeyWordsXML. --- indra/llui/llkeywords.cpp | 12 ++++++------ indra/llui/llkeywords.h | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 687c2fb31d..832264f074 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -34,7 +34,7 @@ #include "lltexteditor.h" #include "llstl.h" -inline BOOL LLKeywordToken::isHead(const llwchar* s) const +inline bool LLKeywordToken::isHead(const llwchar* s) const { // strncmp is much faster than string compare BOOL res = TRUE; @@ -51,7 +51,7 @@ inline BOOL LLKeywordToken::isHead(const llwchar* s) const return res; } -inline BOOL LLKeywordToken::isTail(const llwchar* s) const +inline bool LLKeywordToken::isTail(const llwchar* s) const { BOOL res = TRUE; const llwchar* t = mDelimiter.c_str(); @@ -198,7 +198,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) return LLUIColorTable::instance().getColor(ColourGroup); } -BOOL LLKeywords::initialise(ELLPath path, const std::string filename) +bool LLKeywords::initialise(ELLPath path, const std::string filename) { mReady = false; setFilenameSyntax( gDirUtilp->getExpandedFilename(path, filename) ); @@ -214,7 +214,7 @@ BOOL LLKeywords::initialise(ELLPath path, const std::string filename) return mReady; } -BOOL LLKeywords::loadFromFile() +bool LLKeywords::loadFromFile() { processTokens(); return true; @@ -226,14 +226,14 @@ BOOL LLKeywords::loadFromFile() * contained data to the specified LLSD object. * @return Returns boolean true/false indicating success or failure. */ -BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) +bool LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) { mLoaded = false; llifstream file; file.open(filename); if(file.is_open()) { - mLoaded = (BOOL)LLSDSerialize::fromXML(data, file); + mLoaded = (bool)LLSDSerialize::fromXML(data, file); if (!mLoaded) { LL_WARNS("") << "Unable to deserialise file: " << filename << LL_ENDL; diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 1bd23549d2..f98453405d 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -83,8 +83,8 @@ public: S32 getLengthHead() const { return mToken.size(); } S32 getLengthTail() const { return mDelimiter.size(); } - BOOL isHead(const llwchar* s) const; - BOOL isTail(const llwchar* s) const; + bool isHead(const llwchar* s) const; + bool isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } const LLColor4& getColor() const { return mColor; } TOKEN_TYPE getType() const { return mType; } @@ -111,13 +111,13 @@ public: void addColorGroup(const std::string key_in, const LLColor4 color); LLColor4 getColorGroup(const std::string key_in); - BOOL loadFromFile(); - BOOL loadFromFile(const std::string& filename); - BOOL isLoaded() const { return mLoaded; } + bool loadFromFile(); + bool loadFromFile(const std::string& filename); + bool isLoaded() const { return mLoaded; } void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); - BOOL initialise(ELLPath path, const std::string filename); + bool initialise(ELLPath path, const std::string filename); std::string processColors(); std::string processColors(LLSD &data, const std::string strGroup); void processTokens(); @@ -176,10 +176,10 @@ protected: LLColor4 readColor(LLSD& sd); void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); void insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); - BOOL loadIntoLLSD( const std::string& filename, LLSD& data ); + bool loadIntoLLSD( const std::string& filename, LLSD& data ); LLSD mColors; - BOOL mLoaded; + bool mLoaded; LLSD mSyntax; word_token_map_t mWordTokenMap; typedef std::deque token_list_t; @@ -194,8 +194,8 @@ protected: std::string getArguments(LLSD& args); private: - BOOL ready() { return mReady; } - BOOL mReady; + bool ready() { return mReady; } + bool mReady; std::string mFilenameSyntax; }; -- cgit v1.2.3 From 29b2129e1eec0dbbb909422e82766a58f14c5da3 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 9 Nov 2013 11:32:08 +0000 Subject: Backed out changeset: e82d9467bec8 --- indra/llui/llkeywords.cpp | 12 ++++++------ indra/llui/llkeywords.h | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 832264f074..687c2fb31d 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -34,7 +34,7 @@ #include "lltexteditor.h" #include "llstl.h" -inline bool LLKeywordToken::isHead(const llwchar* s) const +inline BOOL LLKeywordToken::isHead(const llwchar* s) const { // strncmp is much faster than string compare BOOL res = TRUE; @@ -51,7 +51,7 @@ inline bool LLKeywordToken::isHead(const llwchar* s) const return res; } -inline bool LLKeywordToken::isTail(const llwchar* s) const +inline BOOL LLKeywordToken::isTail(const llwchar* s) const { BOOL res = TRUE; const llwchar* t = mDelimiter.c_str(); @@ -198,7 +198,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) return LLUIColorTable::instance().getColor(ColourGroup); } -bool LLKeywords::initialise(ELLPath path, const std::string filename) +BOOL LLKeywords::initialise(ELLPath path, const std::string filename) { mReady = false; setFilenameSyntax( gDirUtilp->getExpandedFilename(path, filename) ); @@ -214,7 +214,7 @@ bool LLKeywords::initialise(ELLPath path, const std::string filename) return mReady; } -bool LLKeywords::loadFromFile() +BOOL LLKeywords::loadFromFile() { processTokens(); return true; @@ -226,14 +226,14 @@ bool LLKeywords::loadFromFile() * contained data to the specified LLSD object. * @return Returns boolean true/false indicating success or failure. */ -bool LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) +BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) { mLoaded = false; llifstream file; file.open(filename); if(file.is_open()) { - mLoaded = (bool)LLSDSerialize::fromXML(data, file); + mLoaded = (BOOL)LLSDSerialize::fromXML(data, file); if (!mLoaded) { LL_WARNS("") << "Unable to deserialise file: " << filename << LL_ENDL; diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index f98453405d..1bd23549d2 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -83,8 +83,8 @@ public: S32 getLengthHead() const { return mToken.size(); } S32 getLengthTail() const { return mDelimiter.size(); } - bool isHead(const llwchar* s) const; - bool isTail(const llwchar* s) const; + BOOL isHead(const llwchar* s) const; + BOOL isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } const LLColor4& getColor() const { return mColor; } TOKEN_TYPE getType() const { return mType; } @@ -111,13 +111,13 @@ public: void addColorGroup(const std::string key_in, const LLColor4 color); LLColor4 getColorGroup(const std::string key_in); - bool loadFromFile(); - bool loadFromFile(const std::string& filename); - bool isLoaded() const { return mLoaded; } + BOOL loadFromFile(); + BOOL loadFromFile(const std::string& filename); + BOOL isLoaded() const { return mLoaded; } void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); - bool initialise(ELLPath path, const std::string filename); + BOOL initialise(ELLPath path, const std::string filename); std::string processColors(); std::string processColors(LLSD &data, const std::string strGroup); void processTokens(); @@ -176,10 +176,10 @@ protected: LLColor4 readColor(LLSD& sd); void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); void insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); - bool loadIntoLLSD( const std::string& filename, LLSD& data ); + BOOL loadIntoLLSD( const std::string& filename, LLSD& data ); LLSD mColors; - bool mLoaded; + BOOL mLoaded; LLSD mSyntax; word_token_map_t mWordTokenMap; typedef std::deque token_list_t; @@ -194,8 +194,8 @@ protected: std::string getArguments(LLSD& args); private: - bool ready() { return mReady; } - bool mReady; + BOOL ready() { return mReady; } + BOOL mReady; std::string mFilenameSyntax; }; -- cgit v1.2.3 From 5e27952ee4698006c86ebdca60c4eab305ddebac Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 20:24:13 +0000 Subject: storm-1831 Switch to use the llsyntaxid keywords LLSD directly --- indra/llui/llkeywords.cpp | 15 +++------------ indra/llui/llkeywords.h | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 687c2fb31d..ac95a20588 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -198,19 +198,10 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) return LLUIColorTable::instance().getColor(ColourGroup); } -BOOL LLKeywords::initialise(ELLPath path, const std::string filename) +bool LLKeywords::initialise(LLSD SyntaxXML) { - mReady = false; - setFilenameSyntax( gDirUtilp->getExpandedFilename(path, filename) ); - - if (! loadIntoLLSD(mFilenameSyntax, mSyntax) ) - { - LL_ERRS("") << "Failed to load syntax data from '" << mFilenameSyntax << "', cannot continue!" << LL_ENDL; - } - else - { - mReady = true; - } + mSyntax = SyntaxXML; + mLoaded = mReady = true; return mReady; } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 1bd23549d2..24a0450912 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -117,7 +117,7 @@ public: void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); - BOOL initialise(ELLPath path, const std::string filename); + bool initialise(LLSD SyntaxXML); std::string processColors(); std::string processColors(LLSD &data, const std::string strGroup); void processTokens(); -- cgit v1.2.3 From dc317ed70ac8b8344a745b4f43116460efdfdbca Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 21:58:17 +0000 Subject: Refactoring load routines to remove uneeded methods --- indra/llui/llkeywords.cpp | 36 ------------------------------------ indra/llui/lltexteditor.cpp | 24 ++++++++++-------------- indra/llui/lltexteditor.h | 5 +---- 3 files changed, 11 insertions(+), 54 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index ac95a20588..65ede3e46f 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -205,42 +205,6 @@ bool LLKeywords::initialise(LLSD SyntaxXML) return mReady; } -BOOL LLKeywords::loadFromFile() -{ - processTokens(); - return true; -} - -/** - * @brief Load xml serialised LLSD - * @desc Opens the specified filespec and attempts to deserialise the - * contained data to the specified LLSD object. - * @return Returns boolean true/false indicating success or failure. - */ -BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) -{ - mLoaded = false; - llifstream file; - file.open(filename); - if(file.is_open()) - { - mLoaded = (BOOL)LLSDSerialize::fromXML(data, file); - if (!mLoaded) - { - LL_WARNS("") << "Unable to deserialise file: " << filename << LL_ENDL; - } - else - { - LL_INFOS("") << "Deserialised file: " << filename << LL_ENDL; - } - } - else - { - LL_WARNS("") << "Unable to open file: " << filename << LL_ENDL; - } - return mLoaded; -} - ///** // * @brief Start processing the colour LLSD from its beginning. // * diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 4bab68b339..b6c2e20a9d 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2502,23 +2502,19 @@ BOOL LLTextEditor::tryToRevertToPristineState() static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting"); -void LLTextEditor::loadKeywords(const std::string& filename, - const std::vector& funcs, - const std::vector& tooltips, - const LLColor4& color) +void LLTextEditor::loadKeywords() { LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); - if(mKeywords.loadFromFile()) - { - segment_vec_t segment_list; - mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); + mKeywords.processTokens(); - 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); - } + 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); } } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 8cc0e03712..0b4a22b08b 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -187,10 +187,7 @@ public: void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ); LLKeywords mKeywords; - void loadKeywords(const std::string& filename, - const std::vector& funcs, - const std::vector& tooltips, - const LLColor4& func_color); + void loadKeywords(); LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); } LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); } -- cgit v1.2.3 From 009245510149c26337ac1cca64a367cd2234725b Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 22:35:49 +0000 Subject: Removing unused getter/setter and property for mFilenameSyntax, mReady. --- indra/llui/llkeywords.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 24a0450912..f14605157d 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -113,8 +113,7 @@ public: LLColor4 getColorGroup(const std::string key_in); BOOL loadFromFile(); BOOL loadFromFile(const std::string& filename); - BOOL isLoaded() const { return mLoaded; } - void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } + bool isLoaded() const { return mLoaded; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); bool initialise(LLSD SyntaxXML); @@ -179,7 +178,7 @@ protected: BOOL loadIntoLLSD( const std::string& filename, LLSD& data ); LLSD mColors; - BOOL mLoaded; + bool mLoaded; LLSD mSyntax; word_token_map_t mWordTokenMap; typedef std::deque token_list_t; @@ -194,9 +193,6 @@ protected: std::string getArguments(LLSD& args); private: - BOOL ready() { return mReady; } - BOOL mReady; - std::string mFilenameSyntax; }; #endif // LL_LLKEYWORDS_H -- cgit v1.2.3 From 3e41917403fb3519adac2343ca21a1f289596621 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Mon, 11 Nov 2013 16:33:04 +0000 Subject: Removing no longer used member variable, adding method to reset the mLoaded status --- indra/llui/llkeywords.cpp | 4 ++-- indra/llui/llkeywords.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 65ede3e46f..6aeaf4798b 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -201,8 +201,8 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) bool LLKeywords::initialise(LLSD SyntaxXML) { mSyntax = SyntaxXML; - mLoaded = mReady = true; - return mReady; + mLoaded = true; + return mLoaded; } ///** diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index f14605157d..074cedfc63 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -110,6 +110,7 @@ public: ~LLKeywords(); void addColorGroup(const std::string key_in, const LLColor4 color); + void clearLoaded() { mLoaded = false; } LLColor4 getColorGroup(const std::string key_in); BOOL loadFromFile(); BOOL loadFromFile(const std::string& filename); -- cgit v1.2.3 From fa5c3320cc9c50462b222b1b1197d9c16064983e Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 21 Nov 2013 19:55:38 +0000 Subject: storm-1831 Cleaning up colour LLSD processing code which is no longer used as colours come from the colors XML file. --- indra/llui/llkeywords.cpp | 58 +---------------------------------------------- indra/llui/llkeywords.h | 2 -- 2 files changed, 1 insertion(+), 59 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 6aeaf4798b..5f5810812e 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -67,10 +67,7 @@ inline BOOL LLKeywordToken::isTail(const llwchar* s) const return res; } -LLKeywords::LLKeywords() : mLoaded(FALSE) -{ - //setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_default.xml") ); -} +LLKeywords::LLKeywords() : mLoaded(FALSE) { } LLKeywords::~LLKeywords() { @@ -205,59 +202,6 @@ bool LLKeywords::initialise(LLSD SyntaxXML) return mLoaded; } -///** -// * @brief Start processing the colour LLSD from its beginning. -// * -// */ -//std::string LLKeywords::processColors() -//{ -// return processColors(mColors, ""); -//} - -///** -// * @brief Recursively process the colour LLSD from an arbitrary level. -// * @desc Process the supplied LLSD for colour data. The strPrefix is a string -// * of hyphen separated keys from previous levels. -// */ -//std::string LLKeywords::processColors(LLSD &settings, const std::string strPrefix) -//{ -// if (settings.isMap() || (! settings.isMap() && strPrefix != "") ) -// { -// LLSD llsd_map = settings; - -// LLSD::map_iterator my_iter = llsd_map.beginMap(); -// for ( ; my_iter != llsd_map.endMap(); ++my_iter) -// { -// std::string strGroup = strPrefix; -// const LLSD::String& key = my_iter->first; -// LLSD& value = my_iter->second; -// -// if (key == "color") -// { -// if (value.isMap() || value.isArray()) -// { -// addColorGroup(strGroup, readColor(value)); -// } -// else -// { -// LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; -// } -// } -// else if (value.isMap()) -// { -// strGroup += (strGroup.length() == 0) ? my_iter->first : "-" + my_iter->first; -// strGroup = processColors(value, strGroup); -// } -// else -// { -// LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; -// } -// } -// } -// return strPrefix; -//} -//*/ - void LLKeywords::processTokens() { // Add 'standard' stuff: Quotes, Comments, Strings, Labels, etc. before processing the LLSD diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 074cedfc63..d0f1de8389 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -118,8 +118,6 @@ public: void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); bool initialise(LLSD SyntaxXML); - std::string processColors(); - std::string processColors(LLSD &data, const std::string strGroup); void processTokens(); // Add the token as described -- cgit v1.2.3 From 8f4c4db90fdafc86efb64318e611d00aae662ab1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Sat, 23 Nov 2013 09:37:09 -0500 Subject: SH-4611 FIX - use an observer to scroll after category rename completes --- indra/llui/llfolderview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index f32a52e6c6..ff5c2d0849 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -701,8 +701,9 @@ void LLFolderView::finishRenamingItem( void ) closeRenamer(); + // This is moved to an inventory observer in llinventorybridge.cpp, to handle updating after operation completed in AISv3 (SH-4611). // List is re-sorted alphabetically, so scroll to make sure the selected item is visible. - scrollToShowSelection(); + //scrollToShowSelection(); } void LLFolderView::closeRenamer( void ) -- cgit v1.2.3 From f6d86fcacf79c8147e2075db64caee7521f3b227 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Tue, 17 Dec 2013 18:23:09 +0000 Subject: Fixing some BOOL to bool and changing one function to void --- indra/llui/llkeywords.cpp | 15 +++++++-------- indra/llui/llkeywords.h | 8 +++----- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 5f5810812e..393681be27 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -34,10 +34,10 @@ #include "lltexteditor.h" #include "llstl.h" -inline BOOL LLKeywordToken::isHead(const llwchar* s) const +inline bool LLKeywordToken::isHead(const llwchar* s) const { // strncmp is much faster than string compare - BOOL res = TRUE; + bool res = TRUE; const llwchar* t = mToken.c_str(); S32 len = mToken.size(); for (S32 i=0; i *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); - bool initialise(LLSD SyntaxXML); + void initialise(LLSD SyntaxXML); void processTokens(); // Add the token as described -- cgit v1.2.3 From 7d4febe7bbadf6e597231d2a547f22d4bc37958e Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 4 Jan 2014 01:19:51 +0000 Subject: STORM-1831/STORM-2000 Changing LSL syntax schema to contain arguments in an array instead of a map element. --- indra/llui/llkeywords.cpp | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 393681be27..b7de4d5224 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -132,25 +132,40 @@ void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, std::string LLKeywords::getArguments(LLSD& arguments) { - std::string args = ""; - if (arguments.isMap()) + std::string argString = ""; + + if (arguments.isArray()) { - int count = arguments.size(); - LLSD::map_iterator argsIt = arguments.beginMap(); - for ( ; argsIt != arguments.endMap(); ++argsIt) + int argsCount = arguments.size(); + LLSD::array_iterator arrayIt = arguments.beginArray(); + for ( ; arrayIt != arguments.endArray(); ++arrayIt) { - args += argsIt->second.get("type").asString() + " " + argsIt->first; - if (count-- > 1) + LLSD& args = (*arrayIt); + if (args.isMap()) + { + LLSD::map_iterator argsIt = args.beginMap(); + for ( ; argsIt != args.endMap(); ++argsIt) { - args += ", "; + argString += argsIt->second.get("type").asString() + " " + argsIt->first; + if (argsCount-- > 1) + { + argString += ", "; + } } + } + else + { + LL_INFOS("SyntaxLSL") + << "Argument array does not comtain a map element!" << LL_ENDL; + } } } else if (!arguments.isUndefined()) { - LL_WARNS("Arguments") << "Not a map! Invalid LLSD passed to function.\n" << arguments << LL_ENDL; + LL_WARNS("SyntaxLSL") + << "Not an array! Invalid arguments LLSD passed to function." << arguments << LL_ENDL; } - return args == "" ? " void " : args; + return argString == "" ? " void " : argString; } std::string LLKeywords::getAttribute(const std::string& key) @@ -246,7 +261,6 @@ void LLKeywords::processTokens() void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { LLColor4 Color; - LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << Color << "'" << LL_ENDL; LLKeywordToken::TOKEN_TYPE token_type = LLKeywordToken::TT_UNKNOWN; // If a new token type is added here, it must also be added to the 'addToken' method @@ -275,12 +289,14 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) token_type = LLKeywordToken::TT_TYPE; } + Color = getColorGroup(Group); + LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << Color << "'" << LL_ENDL; + if (Tokens.isMap()) { LLSD::map_iterator outerIt = Tokens.beginMap(); for ( ; outerIt != Tokens.endMap(); ++outerIt) { - Color = getColorGroup(Group); if (outerIt->second.isMap()) { mAttributes.clear(); @@ -291,7 +307,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { if (innerIt->first == "arguments") { - if (innerIt->second.isMap()) + if (innerIt->second.isArray()) { arguments = innerIt->second; } @@ -343,6 +359,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) } 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" << LL_ENDL; for (int count = 0; count < Tokens.size(); ++count) { addToken(token_type, Tokens[count], Color, ""); -- cgit v1.2.3 From 025e0b07ab716f2ab07f6a43bf19450fe08115c5 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 11 Jan 2014 03:19:34 +0000 Subject: Correcting int to U32 --- indra/llui/llkeywords.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index b7de4d5224..050573e699 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -136,7 +136,7 @@ std::string LLKeywords::getArguments(LLSD& arguments) if (arguments.isArray()) { - int argsCount = arguments.size(); + U32 argsCount = arguments.size(); LLSD::array_iterator arrayIt = arguments.beginArray(); for ( ; arrayIt != arguments.endArray(); ++arrayIt) { -- cgit v1.2.3 From bc1cecd75435f29d360bc305ed3f20bc2d2dda7e Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Tue, 14 Jan 2014 00:22:41 +0000 Subject: Removing the value "void" from return types and empty argument lists. --- indra/llui/llkeywords.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 050573e699..9dd14f4a2f 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -165,7 +165,7 @@ std::string LLKeywords::getArguments(LLSD& arguments) LL_WARNS("SyntaxLSL") << "Not an array! Invalid arguments LLSD passed to function." << arguments << LL_ENDL; } - return argString == "" ? " void " : argString; + return argString == "" ? "" : argString; } std::string LLKeywords::getAttribute(const std::string& key) -- cgit v1.2.3 From 8df2007187236d1b77ccec916fc63f0481cf599c Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Tue, 14 Jan 2014 03:45:14 +0000 Subject: storm-1831 Enabling highlighting of deprecated and god-mode functions. --- indra/llui/llkeywords.cpp | 94 +++++++++++++++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 32 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 9dd14f4a2f..fe91c74fa0 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -177,33 +177,68 @@ std::string LLKeywords::getAttribute(const std::string& key) LLColor4 LLKeywords::getColorGroup(const std::string key_in) { std::string ColourGroup = "Black"; - if (key_in == "constants-float") { + if (key_in == "constants-float") + { ColourGroup = "SyntaxLslConstantFloat"; - } else if (key_in == "constants-integer") { + } + else if (key_in == "constants-integer") + { ColourGroup = "SyntaxLslConstantInteger"; - } else if (key_in == "constants-key") { + } + else if (key_in == "constants-key") + { ColourGroup = "SyntaxLslConstantKey"; - } else if (key_in == "constants-string") { + } + else if (key_in == "constants-string") + { ColourGroup = "SyntaxLslConstantRotation"; - } else if (key_in == "constants-string") { + } + else if (key_in == "constants-string") + { ColourGroup = "SyntaxLslConstantString"; - } else if (key_in == "constants-vector") { + } + else if (key_in == "constants-vector") + { ColourGroup = "SyntaxLslConstantVector"; - } else if (key_in == "controls") { + } + else if (key_in == "controls") + { ColourGroup = "SyntaxLslControlFlow"; - } else if (key_in == "events") { + } + else if (key_in =="deprecated") + { + ColourGroup = "SyntaxLslDeprecated"; + } + else if (key_in == "events") + { ColourGroup = "SyntaxLslEvent"; - } else if (key_in == "functions") { + } + else if (key_in == "functions") + { ColourGroup = "SyntaxLslFunction"; - } else if (key_in == "types") { + } + else if (key_in =="god-mode") + { + ColourGroup = "SyntaxLslGodMode"; + } + else if (key_in == "types") + { ColourGroup = "SyntaxLslDataType"; - } else if (key_in == "sections") { + } + else if (key_in == "sections") + { ColourGroup = "SyntaxLslSection"; - } else if (key_in == "misc-double_quotation_marks") { + } + else if (key_in == "misc-double_quotation_marks") + { ColourGroup = "SyntaxLslStringLiteral"; - } else if (key_in == "misc-comments_1_sided") { + } + else if (key_in == "misc-comments_1_sided") + { ColourGroup = "SyntaxLslComment1Sided"; - } else if (key_in == "misc-comments_2_sided") { + } + else if (key_in == "misc-comments_2_sided") + { ColourGroup = "SyntaxLslComment2Sided"; } @@ -228,20 +263,9 @@ void LLKeywords::processTokens() LLSD::map_iterator outerIt = mSyntax.beginMap(); for ( ; outerIt != mSyntax.endMap(); ++outerIt) { - if (outerIt->first == "misc") + if (outerIt->first == "llsd-lsl-syntax-version") { - if (outerIt->second.isMap()) - { - LLSD::map_iterator innerIt = outerIt->second.beginMap(); - for ( ; innerIt != outerIt->second.endMap(); ++innerIt) - { - processTokensGroup(innerIt->second, "misc-" + innerIt->first); - } - } - else - { - LL_ERRS("LSL-Tokens-Processing") << "Map for misc entries is missing! Ignoring." << LL_ENDL; - } + LL_INFOS("SyntaxLSL") << "Skipping over version key." << LL_ENDL; } else { @@ -255,12 +279,15 @@ void LLKeywords::processTokens() } } } - LL_INFOS("") << LL_ENDL; + LL_INFOS("SyntaxLSL") << "Finished processing tokens." << LL_ENDL; } void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { LLColor4 Color; + LLColor4 ColorGroup; + LLColor4 ColorDeprecated = getColorGroup("deprecated"); + LLColor4 ColorGM = getColorGroup("god-mode"); LLKeywordToken::TOKEN_TYPE token_type = LLKeywordToken::TT_UNKNOWN; // If a new token type is added here, it must also be added to the 'addToken' method @@ -289,7 +316,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) token_type = LLKeywordToken::TT_TYPE; } - Color = getColorGroup(Group); + ColorGroup = getColorGroup(Group); LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << Color << "'" << LL_ENDL; if (Tokens.isMap()) @@ -299,6 +326,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { if (outerIt->second.isMap()) { + Color = ColorGroup; mAttributes.clear(); bool deprecated = false; LLSD arguments = LLSD (); @@ -348,11 +376,13 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) tooltip += getAttribute("tooltip"); } - deprecated = getAttribute("deprecated") == "true" ? true : false; - if (deprecated) + Color = getAttribute("deprecated") == "true" ? ColorDeprecated : ColorGroup; + + if (getAttribute("god-mode") == "true") { - Color = getColorGroup("deprecated"); + Color = ColorGM; } + addToken(token_type, outerIt->first, Color, tooltip); } } -- cgit v1.2.3 From 11beaee5667a35196a481e6e2543123c63843821 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Tue, 14 Jan 2014 18:27:15 +0000 Subject: Fixing LL_INFOS out put for group colour that previous commit broke. --- indra/llui/llkeywords.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index fe91c74fa0..0395334b6e 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -317,7 +317,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) } ColorGroup = getColorGroup(Group); - LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << Color << "'" << LL_ENDL; + LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << ColorGroup << "'" << LL_ENDL; if (Tokens.isMap()) { -- cgit v1.2.3 From 81170ed939ce88ec9996ed5ecf2ae34684d199ec Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Wed, 15 Jan 2014 21:33:09 +0000 Subject: Adding error output for attributes containing MAP or ARRAY elements. --- indra/llui/llkeywords.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 0395334b6e..34dff22729 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -340,10 +340,14 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) arguments = innerIt->second; } } - else + else if (!innerIt->second.isMap() && !innerIt->second.isArray()) { mAttributes[innerIt->first] = innerIt->second.asString(); } + else + { + LL_ERRS("SyntaxLSL") << "Not a valid attribute" << LL_ENDL; + } } std::string tooltip = ""; -- cgit v1.2.3 From 93022725ea11dcae531440a3cce85b933a404c46 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 30 Jan 2014 15:32:04 +0000 Subject: minor white-space fixes --- indra/llui/llkeywords.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 34dff22729..fd4ef33f59 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -76,8 +76,6 @@ LLKeywords::~LLKeywords() std::for_each(mDelimiterTokenList.begin(), mDelimiterTokenList.end(), DeletePointer()); } - - void LLKeywords::addColorGroup(const std::string key_in, const LLColor4 color) { WStringMapIndex key ( utf8str_to_wstring(key_in) ); @@ -94,7 +92,7 @@ void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, std::string tip_text = tool_tip_in; LLStringUtil::replaceString(tip_text, "\\n", "\n" ); LLStringUtil::replaceString(tip_text, "\t", " " ); - if (tip_text =="") + if (tip_text == "") { tip_text = "[no info]"; } -- cgit v1.2.3 From 00a99d9097131c02c6486112b32e57f534bf61be Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 6 Feb 2014 16:47:27 +0000 Subject: Adding clear methods to remove any highlighting. --- indra/llui/llkeywords.cpp | 11 ++++++++++- indra/llui/llkeywords.h | 1 + indra/llui/lltexteditor.cpp | 8 ++++++++ indra/llui/lltexteditor.h | 3 ++- 4 files changed, 21 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index fd4ef33f59..c5e8f76a73 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -128,6 +128,16 @@ void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, } } +void LLKeywords::clear() +{ + clearLoaded(); + mSyntax = LLSD(); + + std::for_each(mWordTokenMap.begin(), mWordTokenMap.end(), DeletePairedPointer()); + std::for_each(mLineTokenList.begin(), mLineTokenList.end(), DeletePointer()); + std::for_each(mDelimiterTokenList.begin(), mDelimiterTokenList.end(), DeletePointer()); +} + std::string LLKeywords::getArguments(LLSD& arguments) { std::string argString = ""; @@ -326,7 +336,6 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { Color = ColorGroup; mAttributes.clear(); - bool deprecated = false; LLSD arguments = LLSD (); LLSD::map_iterator innerIt = outerIt->second.beginMap(); for ( ; innerIt != outerIt->second.endMap(); ++innerIt) diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 689fd75bcd..de7645a5d2 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -110,6 +110,7 @@ public: ~LLKeywords(); void addColorGroup(const std::string key_in, const LLColor4 color); + void clear(); void clearLoaded() { mLoaded = false; } LLColor4 getColorGroup(const std::string key_in); bool isLoaded() const { return mLoaded; } diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 303bc48933..e11636682e 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2529,6 +2529,14 @@ void LLTextEditor::loadKeywords() } } +void LLTextEditor::clearSegments() +{ + if (!mSegments.empty()) + { + mSegments.clear(); + } +} + void LLTextEditor::updateSegments() { if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly) diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index d7f6c7f643..698153587f 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -207,7 +207,8 @@ public: const LLUUID& getSourceID() const { return mSourceID; } const LLTextSegmentPtr getPreviousSegment() const; - void getSelectedSegments(segment_vec_t& segments) const; + void getSelectedSegments(segment_vec_t& segments) const; + void clearSegments(); void setShowContextMenu(bool show) { mShowContextMenu = show; } bool getShowContextMenu() const { return mShowContextMenu; } -- cgit v1.2.3 From 0b9eeb02abe4d10c4e252fe35ea55ba4b54b581e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 24 Feb 2014 18:36:13 -0800 Subject: MAINT-2059 FIX Corner scaling doesn't highlight distance text much cleanup of vector math also made Stretch Both Sides checkbox clickable via label --- indra/llui/llfloater.cpp | 24 ++++++++++++------------ indra/llui/lllayoutstack.cpp | 10 +++++----- indra/llui/llpanel.cpp | 8 ++++---- indra/llui/lltabcontainer.cpp | 10 +++++----- indra/llui/lluictrl.cpp | 24 ++++++++++++------------ indra/llui/llview.cpp | 20 ++++++++++---------- 6 files changed, 48 insertions(+), 48 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 96964b528e..41aa68e0b3 100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -505,48 +505,48 @@ void LLFloater::destroy() // virtual LLFloater::~LLFloater() { - LL_INFOS("Baker") << "[3555] ~LLFloater() -------------------------------------------------" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() -------------------------------------------------" << LL_ENDL; LLFloaterReg::removeInstance(mInstanceName, mKey); - LL_INFOS("Baker") << "[3555] ~LLFloater() - Does child have keyboard focus?" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Does child have keyboard focus?" << LL_ENDL; if( gFocusMgr.childHasKeyboardFocus(this)) { - LL_INFOS("Baker") << "[3555] ~LLFloater() - Yes, release the focus." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Yes, release the focus." << LL_ENDL; // Just in case we might still have focus here, release it. releaseFocus(); } - LL_INFOS("Baker") << "[3555] ~LLFloater() - Setting minimized to false" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Setting minimized to false" << LL_ENDL; // This is important so that floaters with persistent rects (i.e., those // created with rect control rather than an LLRect) are restored in their // correct, non-minimized positions. setMinimized( FALSE ); - LL_INFOS("Baker") << "[3555] ~LLFloater() - Deleting the drag handle." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Deleting the drag handle." << LL_ENDL; delete mDragHandle; for (S32 i = 0; i < 4; i++) { - LL_INFOS("Baker") << "[3555] ~LLFloater() - Deleting mResizeBar[" << i << "]" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Deleting mResizeBar[" << i << "]" << LL_ENDL; delete mResizeBar[i]; - LL_INFOS("Baker") << "[3555] ~LLFloater() - Deleting mResizeHandle[" << i << "]" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Deleting mResizeHandle[" << i << "]" << LL_ENDL; delete mResizeHandle[i]; } - LL_INFOS("Baker") << "[3555] ~LLFloater() - Setting visibility (false)" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Setting visibility (false)" << LL_ENDL; setVisible(false); // We're not visible if we're destroyed - LL_INFOS("Baker") << "[3555] ~LLFloater() - Storing visibility control" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Storing visibility control" << LL_ENDL; storeVisibilityControl(); - LL_INFOS("Baker") << "[3555] ~LLFloater() - Storing dock state control" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Storing dock state control" << LL_ENDL; storeDockStateControl(); - LL_INFOS("Baker") << "[3555] ~LLFloater() - Delete mMinimizeSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLFloater() - Delete mMinimizeSignal" << LL_ENDL; delete mMinimizeSignal; - LL_INFOS("Baker") << "[3555] Exiting ~LLFloater()" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] Exiting ~LLFloater()" << LL_ENDL; } void LLFloater::storeRectControl() diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 953025abbf..ec0795fc89 100755 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -245,18 +245,18 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) LLLayoutStack::~LLLayoutStack() { - LL_INFOS("Baker") << "[3555] ~LLLayoutStack() -------------------------------------------------" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLLayoutStack() -------------------------------------------------" << LL_ENDL; - LL_INFOS("Baker") << "[3555] ~LLLayoutStack() - Copying panel pointers." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLLayoutStack() - Copying panel pointers." << LL_ENDL; e_panel_list_t panels = mPanels; // copy list of panel pointers - LL_INFOS("Baker") << "[3555] ~LLLayoutStack() - Clearing mPanels." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLLayoutStack() - Clearing mPanels." << LL_ENDL; mPanels.clear(); // clear so that removeChild() calls don't cause trouble - LL_INFOS("Baker") << "[3555] ~LLLayoutStack() - Deleing copied panel pointers." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLLayoutStack() - Deleing copied panel pointers." << LL_ENDL; std::for_each(panels.begin(), panels.end(), DeletePointer()); - LL_INFOS("Baker") << "[3555] Exiting ~LLLayoutStack()" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] Exiting ~LLLayoutStack()" << LL_ENDL; } void LLLayoutStack::draw() diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 3ee93150f5..dafb6a534a 100755 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -126,13 +126,13 @@ LLPanel::LLPanel(const LLPanel::Params& p) LLPanel::~LLPanel() { - LL_INFOS("Baker") << "[3555] ~LLPanel() -------------------------------------------------" << LL_ENDL; - LL_INFOS("Baker") << "[3555] ~LLPanel() - Deleting mVisibleSignal..." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLPanel() -------------------------------------------------" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLPanel() - Deleting mVisibleSignal..." << LL_ENDL; delete mVisibleSignal; - LL_INFOS("Baker") << "[3555] ~LLPanel() - deleted." << LL_ENDL; - LL_INFOS("Baker") << "[3555] Exiting ~LLPanel()" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLPanel() - deleted." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] Exiting ~LLPanel()" << LL_ENDL; } // virtual diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 203bf5b50e..99237c74ba 100755 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -280,16 +280,16 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) LLTabContainer::~LLTabContainer() { - LL_INFOS("Baker") << "[3555] ~LLTabContainer() -------------------------------------------------" << LL_ENDL; - LL_INFOS("Baker") << "[3555] ~LLTabContainer() - Deleting mTabList contents..." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLTabContainer() -------------------------------------------------" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLTabContainer() - Deleting mTabList contents..." << LL_ENDL; std::for_each(mTabList.begin(), mTabList.end(), DeletePointer()); - LL_INFOS("Baker") << "[3555] ~LLTabContainer() - Clearing mTabList" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLTabContainer() - Clearing mTabList" << LL_ENDL; mTabList.clear(); - LL_INFOS("Baker") << "[3555] ~LLTabContainer() - done." << LL_ENDL; - LL_INFOS("Baker") << "[3555] Exiting ~LLTabContainer()" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLTabContainer() - done." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] Exiting ~LLTabContainer()" << LL_ENDL; } //virtual diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 801d39ac70..ad0fe0c556 100755 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -207,11 +207,11 @@ void LLUICtrl::initFromParams(const Params& p) LLUICtrl::~LLUICtrl() { - LL_INFOS("Baker") << "[3555] ~LLUICtrl() -------------------------------------------------" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() -------------------------------------------------" << LL_ENDL; gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - Released focus if needed." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - Released focus if needed." << LL_ENDL; if( gFocusMgr.getTopCtrl() == this ) { @@ -220,34 +220,34 @@ LLUICtrl::~LLUICtrl() gFocusMgr.removeTopCtrlWithoutCallback( this ); } - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - deleting mCommitSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - deleting mCommitSignal" << LL_ENDL; delete mCommitSignal; - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - deleting mValidateSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - deleting mValidateSignal" << LL_ENDL; delete mValidateSignal; - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - deleting mMouseEnterSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - deleting mMouseEnterSignal" << LL_ENDL; delete mMouseEnterSignal; - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - deleting mMouseLeaveSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - deleting mMouseLeaveSignal" << LL_ENDL; delete mMouseLeaveSignal; - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - deleting mMouseDownSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - deleting mMouseDownSignal" << LL_ENDL; delete mMouseDownSignal; - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - deleting mMouseUpSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - deleting mMouseUpSignal" << LL_ENDL; delete mMouseUpSignal; - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - deleting mRightMouseDownSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - deleting mRightMouseDownSignal" << LL_ENDL; delete mRightMouseDownSignal; - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - deleting mRightMouseUpSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - deleting mRightMouseUpSignal" << LL_ENDL; delete mRightMouseUpSignal; - LL_INFOS("Baker") << "[3555] ~LLUICtrl() - deleting mDoubleClickSignal" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLUICtrl() - deleting mDoubleClickSignal" << LL_ENDL; delete mDoubleClickSignal; - LL_INFOS("Baker") << "[3555] Exiting ~LLUICtrl()" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] Exiting ~LLUICtrl()" << LL_ENDL; } void default_commit_handler(LLUICtrl* ctrl, const LLSD& param) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index daa87e8334..8d1c0a28c8 100755 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -150,15 +150,15 @@ LLView::LLView(const LLView::Params& p) LLView::~LLView() { - LL_INFOS("Baker") << "[3555] ~LLView -------------------------------------------------" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLView -------------------------------------------------" << LL_ENDL; - LL_INFOS("Baker") << "[3555] ~LLView() - Dirtying view rect" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLView() - Dirtying view rect" << LL_ENDL; dirtyRect(); //llinfos << "Deleting view " << mName << ":" << (void*) this << llendl; - LL_INFOS("Baker") << "[3555] ~LLView() - Deleting view " << mName << ":" << (void*) this << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLView() - Deleting view " << mName << ":" << (void*) this << LL_ENDL; if (LLView::sIsDrawing) { - LL_INFOS("Baker") << "[3555] ~LLView() - Deleting view " << mName << " during UI draw() phase" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLView() - Deleting view " << mName << " during UI draw() phase" << LL_ENDL; lldebugs << "Deleting view " << mName << " during UI draw() phase" << llendl; } @@ -169,30 +169,30 @@ LLView::~LLView() if( hasMouseCapture() ) { //llwarns << "View holding mouse capture deleted: " << getName() << ". Mouse capture removed." << llendl; - LL_INFOS("Baker") << "[3555] ~LLView() - View holding mouse capture deleted: " << getName() << ". Mouse capture removed." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLView() - View holding mouse capture deleted: " << getName() << ". Mouse capture removed." << LL_ENDL; gFocusMgr.removeMouseCaptureWithoutCallback( this ); } - LL_INFOS("Baker") << "[3555] ~LLView() - Deleting all children..." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLView() - Deleting all children..." << LL_ENDL; deleteAllChildren(); - LL_INFOS("Baker") << "[3555] ~LLView() - done." << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLView() - done." << LL_ENDL; if (mParentView != NULL) { - LL_INFOS("Baker") << "[3555] ~LLView() - Removing this child view" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLView() - Removing this child view" << LL_ENDL; mParentView->removeChild(this); } if (mDefaultWidgets) { - LL_INFOS("Baker") << "[3555] ~LLView() - Deleting default widgets" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] ~LLView() - Deleting default widgets" << LL_ENDL; delete mDefaultWidgets; mDefaultWidgets = NULL; } - LL_INFOS("Baker") << "[3555] Exiting ~LLView()" << LL_ENDL; + LL_DEBUGS("Baker") << "[3555] Exiting ~LLView()" << LL_ENDL; } // virtual -- cgit v1.2.3 From 7a45e6fd7716ede5cf7b5481542cde039de62509 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 28 Feb 2014 15:33:09 +0200 Subject: MAINT-358 FIXED [PUBLIC]Verbs buttons are available for landmarks folder if it was selected via keyboard --- indra/llui/llfolderview.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 13d231d712..173279fa81 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1127,18 +1127,18 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if((mSelectedItems.size() > 0) && mScrollContainer) { LLFolderViewItem* last_selected = getCurSelectedItem(); + BOOL shift_select = mask & MASK_SHIFT; + // don't shift select down to children of folders (they are implicitly selected through parent) + LLFolderViewItem* next = last_selected->getNextOpenNode(!shift_select); - if (!mKeyboardSelection) + if (!mKeyboardSelection || (!shift_select && (!next || next == last_selected))) { setSelection(last_selected, FALSE, TRUE); mKeyboardSelection = TRUE; } - LLFolderViewItem* next = NULL; - if (mask & MASK_SHIFT) + if (shift_select) { - // don't shift select down to children of folders (they are implicitly selected through parent) - next = last_selected->getNextOpenNode(FALSE); if (next) { if (next->isSelected()) @@ -1155,7 +1155,6 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) } else { - next = last_selected->getNextOpenNode(); if( next ) { if (next == last_selected) @@ -1191,18 +1190,18 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if((mSelectedItems.size() > 0) && mScrollContainer) { LLFolderViewItem* last_selected = mSelectedItems.back(); + BOOL shift_select = mask & MASK_SHIFT; + // don't shift select down to children of folders (they are implicitly selected through parent) + LLFolderViewItem* prev = prev = last_selected->getPreviousOpenNode(!shift_select); - if (!mKeyboardSelection) + if (!mKeyboardSelection || (!shift_select && prev == this)) { setSelection(last_selected, FALSE, TRUE); mKeyboardSelection = TRUE; } - LLFolderViewItem* prev = NULL; - if (mask & MASK_SHIFT) + if (shift_select) { - // don't shift select down to children of folders (they are implicitly selected through parent) - prev = last_selected->getPreviousOpenNode(FALSE); if (prev) { if (prev->isSelected()) @@ -1219,7 +1218,6 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) } else { - prev = last_selected->getPreviousOpenNode(); if( prev ) { if (prev == this) -- cgit v1.2.3 From 65850279964bed111e0d11b99f26867cd46b91b7 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Wed, 5 Mar 2014 12:25:52 +0200 Subject: fix build problem --- indra/llui/llfolderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 173279fa81..c9ea0c0e1b 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1192,7 +1192,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) LLFolderViewItem* last_selected = mSelectedItems.back(); BOOL shift_select = mask & MASK_SHIFT; // don't shift select down to children of folders (they are implicitly selected through parent) - LLFolderViewItem* prev = prev = last_selected->getPreviousOpenNode(!shift_select); + LLFolderViewItem* prev = last_selected->getPreviousOpenNode(!shift_select); if (!mKeyboardSelection || (!shift_select && prev == this)) { -- cgit v1.2.3 From 635a3309f05f77e302ea430ca2277fea193a41f4 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Thu, 6 Mar 2014 05:51:49 +0200 Subject: MAINT-3610 FIXED SL viewer partly 'eats' chat-messages --- indra/llui/llchatentry.cpp | 10 +--------- indra/llui/lltexteditor.cpp | 5 +++-- indra/llui/lltexteditor.h | 2 ++ 3 files changed, 6 insertions(+), 11 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index c04b70eb64..dac001afab 100755 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp @@ -51,6 +51,7 @@ LLChatEntry::LLChatEntry(const Params& p) mCurrentHistoryLine = mLineHistory.begin(); mAutoIndent = false; + keepSelectionOnReturn(true); } LLChatEntry::~LLChatEntry() @@ -179,15 +180,6 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) { BOOL handled = FALSE; - // In the case of a chat entry, pressing RETURN when something is selected - // should NOT erase the selection (unlike a notecard, for example) - if (key == KEY_RETURN) - { - endOfDoc(); - startSelection(); - endSelection(); - } - LLTextEditor::handleSpecialKey(key, mask); switch(key) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3bac15c5d4..6c4d031907 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -264,7 +264,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : mContextMenu(NULL), mShowContextMenu(p.show_context_menu), mEnableTooltipPaste(p.enable_tooltip_paste), - mPassDelete(FALSE) + mPassDelete(FALSE), + mKeepSelectionOnReturn(false) { mSourceID.generate(); @@ -1664,7 +1665,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) case KEY_RETURN: if (mask == MASK_NONE) { - if( hasSelection() ) + if( hasSelection() && !mKeepSelectionOnReturn ) { deleteSelection(FALSE); } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index d3b7bc0eb7..02a76d2f8a 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -295,6 +295,7 @@ protected: /*virtual*/ void updateSegments(); void updateLinkSegments(); + void keepSelectionOnReturn(bool keep) { mKeepSelectionOnReturn = keep; } private: // @@ -338,6 +339,7 @@ private: bool mParseOnTheFly; bool mEnableTooltipPaste; bool mPassDelete; + bool mKeepSelectionOnReturn; // disabling of removing selected text after pressing of Enter LLUUID mSourceID; -- cgit v1.2.3 From a2c084849f6c977c4c1c3151e0762c0137d34d0d Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 6 Mar 2014 16:11:59 +0000 Subject: storm-1831: Fixing constants not getting highlighted. Fixing ratation constant treated as string. Adding logging of unrecognised token groups. --- indra/llui/llkeywords.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index c5e8f76a73..6a349f3916 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -197,7 +197,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) { ColourGroup = "SyntaxLslConstantKey"; } - else if (key_in == "constants-string") + else if (key_in == "constants-rotation") { ColourGroup = "SyntaxLslConstantRotation"; } @@ -249,6 +249,10 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) { ColourGroup = "SyntaxLslComment2Sided"; } + else + { + LL_WARNS("SyntaxLSL") << "Color key '" << key_in << "' not recognised!" << LL_ENDL; + } return LLUIColorTable::instance().getColor(ColourGroup); } @@ -334,7 +338,6 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) { if (outerIt->second.isMap()) { - Color = ColorGroup; mAttributes.clear(); LLSD arguments = LLSD (); LLSD::map_iterator innerIt = outerIt->second.beginMap(); @@ -360,7 +363,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) std::string tooltip = ""; if (token_type == LLKeywordToken::TT_CONSTANT) { - Color = getColorGroup(Group + "-" + getAttribute("type")); + ColorGroup = getColorGroup(Group + "-" + getAttribute("type")); tooltip = "Type: " + getAttribute("type") + ", Value: " + getAttribute("value"); } else if (token_type == LLKeywordToken::TT_EVENT) -- cgit v1.2.3 From 06bdcef531c79db7f6901e2c5f5f63b2f75ad4e5 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 9 Mar 2014 04:55:46 +0000 Subject: storm-1831 Fixing identificaton of label for highlighting. --- indra/llui/llkeywords.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 6a349f3916..a251c2e4f5 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -209,7 +209,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) { ColourGroup = "SyntaxLslConstantVector"; } - else if (key_in == "controls") + else if (key_in == "misc-flow-label") { ColourGroup = "SyntaxLslControlFlow"; } -- cgit v1.2.3 From 3ee3d4a8f4b74a5f0b75fa54cb8e1cef0b1ef28e Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 14 Mar 2014 16:19:21 -0400 Subject: correct logging levels (ERR causes a crash), and a minor style fix --- indra/llui/llkeywords.cpp | 17 ++++++++--------- indra/llui/lltextbase.cpp | 3 ++- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index a251c2e4f5..9b924c84a9 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -163,15 +163,14 @@ std::string LLKeywords::getArguments(LLSD& arguments) } else { - LL_INFOS("SyntaxLSL") - << "Argument array does not comtain a map element!" << LL_ENDL; + LL_WARNS("SyntaxLSL") + << "Argument array comtains a non-map element!" << LL_ENDL; } } } else if (!arguments.isUndefined()) { - LL_WARNS("SyntaxLSL") - << "Not an array! Invalid arguments LLSD passed to function." << arguments << LL_ENDL; + LL_WARNS("SyntaxLSL") << "Not an array! Invalid arguments LLSD passed to function." << arguments << LL_ENDL; } return argString == "" ? "" : argString; } @@ -251,7 +250,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) } else { - LL_WARNS("SyntaxLSL") << "Color key '" << key_in << "' not recognised!" << LL_ENDL; + LL_WARNS("SyntaxLSL") << "Color key '" << key_in << "' not recognized!" << LL_ENDL; } return LLUIColorTable::instance().getColor(ColourGroup); @@ -287,7 +286,7 @@ void LLKeywords::processTokens() } else { - LL_ERRS("LSL-Tokens-Processing") << "Map for " + outerIt->first + " entries is missing! Ignoring." << LL_ENDL; + LL_WARNS("LSL-Tokens-Processing") << "Map for " + outerIt->first + " entries is missing! Ignoring." << LL_ENDL; } } } @@ -356,7 +355,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) } else { - LL_ERRS("SyntaxLSL") << "Not a valid attribute" << LL_ENDL; + LL_WARNS("SyntaxLSL") << "Not a valid attribute" << LL_ENDL; } } @@ -403,7 +402,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) } 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" << LL_ENDL; + LL_WARNS("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, ""); @@ -411,7 +410,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) } else { - LL_INFOS("Tokens") << "Invalid map/array passed: '" << Tokens << "'" << LL_ENDL; + LL_WARNS("Tokens") << "Invalid map/array passed: '" << Tokens << "'" << LL_ENDL; } } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 5ec4cf4fe5..bc11d59a65 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -571,7 +571,8 @@ void LLTextBase::drawText() if ( (getSpellCheck()) && (getWText().length() > 2) ) { // Calculate start and end indices for the spell checking range - S32 start = line_start, end = getLineEnd(last_line); + S32 start = line_start; + S32 end = getLineEnd(last_line); if ( (mSpellCheckStart != start) || (mSpellCheckEnd != end) ) { -- cgit v1.2.3 From bc7a579ba285fa64876a2bc116685f0357fe25dc Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 14 Mar 2014 16:33:47 -0400 Subject: STORM-1831 initialize LLKeywords::mLoaded in constructor (fixes black-on-black text in various places) --- indra/llui/llkeywords.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 9b924c84a9..b4932489b5 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -67,7 +67,10 @@ inline bool LLKeywordToken::isTail(const llwchar* s) const return res; } -LLKeywords::LLKeywords() { } +LLKeywords::LLKeywords() : + mLoaded(false) +{ +} LLKeywords::~LLKeywords() { -- cgit v1.2.3 From bd4f4ee7932797008ed15f8c0301f5a0e5911a64 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 19 Mar 2014 14:17:13 -0400 Subject: logging cleanup in support of debugging text editor problems --- indra/llui/llkeywords.cpp | 16 ++++++++++------ indra/llui/lltextbase.cpp | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 82b50f43ab..a3e033d894 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -169,8 +169,7 @@ std::string LLKeywords::getArguments(LLSD& arguments) } else { - LL_WARNS("SyntaxLSL") - << "Argument array comtains a non-map element!" << LL_ENDL; + LL_WARNS("SyntaxLSL") << "Argument array comtains a non-map element!" << LL_ENDL; } } } @@ -265,11 +264,16 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) void LLKeywords::initialise(LLSD SyntaxXML) { mSyntax = SyntaxXML; - mLoaded = TRUE; + mLoaded = true; } void LLKeywords::processTokens() { + if (!mLoaded) + { + return; + } + // Add 'standard' stuff: Quotes, Comments, Strings, Labels, etc. before processing the LLSD std::string delimiter; addToken(LLKeywordToken::TT_LABEL, "@", getColorGroup("misc-flow-label"), "Label\nTarget for jump statement", delimiter ); @@ -282,7 +286,7 @@ void LLKeywords::processTokens() { if (outerIt->first == "llsd-lsl-syntax-version") { - LL_INFOS("SyntaxLSL") << "Skipping over version key." << LL_ENDL; + // Skip over version key. } else { @@ -361,7 +365,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) } else { - LL_WARNS("SyntaxLSL") << "Not a valid attribute" << LL_ENDL; + LL_WARNS("SyntaxLSL") << "Not a valid attribute: " << innerIt->first << LL_ENDL; } } @@ -408,7 +412,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group) } else if (Tokens.isArray()) // Currently nothing should need this, but it's here for completeness { - LL_WARNS("SyntaxLSL") << "Curious, shouldn't be an array here; adding all using color " << Color << LL_ENDL; + 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, ""); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index c4664d6fe0..ee16d3de7c 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -923,6 +923,7 @@ void LLTextBase::createDefaultSegment() // ensures that there is always at least one segment if (mSegments.empty()) { + LLStyleConstSP sp(new LLStyle(getStyleParams())); LLTextSegmentPtr default_segment = new LLNormalTextSegment( sp, 0, getLength() + 1, *this); mSegments.insert(default_segment); -- cgit v1.2.3 From 776aadf4ef65681084268c3866058172c89b4259 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 19 Mar 2014 17:30:07 -0400 Subject: OPEN-199: replace the confusing STANDALONE switch with USESYSTEMLIBS --- indra/llui/llxuiparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 6322da9123..0b84b9f694 100755 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -30,7 +30,7 @@ #include "llxmlnode.h" -#ifdef LL_STANDALONE +#ifdef LL_USESYSTEMLIBS #include #else #include "expat/expat.h" -- cgit v1.2.3 From 0fddf9656b5ff704859f590eac9df522cbe39ef0 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 27 Mar 2014 20:03:08 -0400 Subject: DRTVWR-363: re-enable commented-out LLNotificationsListener::listChannels() and its caller. --- indra/llui/llnotificationslistener.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp index 9e8e943ee6..3bbeb3a778 100644 --- a/indra/llui/llnotificationslistener.cpp +++ b/indra/llui/llnotificationslistener.cpp @@ -42,11 +42,10 @@ LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications "Add a notification with specified [\"name\"], [\"substitutions\"] and [\"payload\"].\n" "If optional [\"reply\"] specified, arrange to send user response on that LLEventPump.", &LLNotificationsListener::requestAdd); - /* add("listChannels", + add("listChannels", "Post to [\"reply\"] a map of info on existing channels", &LLNotificationsListener::listChannels, LLSD().with("reply", LLSD())); - */ add("listChannelNotifications", "Post to [\"reply\"] an array of info on notifications in channel [\"channel\"]", &LLNotificationsListener::listChannelNotifications, @@ -117,15 +116,11 @@ void LLNotificationsListener::NotificationResponder(const std::string& reply_pum reponse_event["response"] = response; LLEventPumps::getInstance()->obtain(reply_pump).post(reponse_event); } -/* + void LLNotificationsListener::listChannels(const LLSD& params) const { LLReqID reqID(params); LLSD response(reqID.makeResponse()); - for (LLNotifications:: - - - for (LLNotifications::ChannelMap::const_iterator cmi(mNotifications.mChannels.begin()), cmend(mNotifications.mChannels.end()); cmi != cmend; ++cmi) @@ -136,7 +131,7 @@ void LLNotificationsListener::listChannels(const LLSD& params) const } LLEventPumps::instance().obtain(params["reply"]).post(response); } -*/ + void LLNotificationsListener::listChannelNotifications(const LLSD& params) const { LLReqID reqID(params); -- cgit v1.2.3 From ba892274b393550be3cc7a25ff0e8f86cc1344a9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 28 Mar 2014 10:30:03 -0400 Subject: DRTVWR-363: Fix LLNotificationsListener::listChannels() channel walk. LLNotifications::ChannelMap went away when LLNotificationChannel became an LLInstanceTracker subclass. Iterate the universe of channels using LLNotificationChannel::beginInstances(), endInstances() instead. More troubling is that LLNotificationChannel::getParentChannelName() went away too. When LLNotificationChannel acquired a Params block and corresponding constructor, it acquired the ability to listen on multiple upstream sources. That meant that a single mParent string became inapplicable, and its access method was removed. (Curiously, mParent was not itself removed, but it was left unused.) Change mParent to mParents, a vector, built by connectToChannel(). Introduce getParents(), an accessor returning an iterator_range over that vector. Change LLNotificationsListener::listChannels() to collect a "parents" key in the map returned for each channel, and -- for backwards compatibility -- capture the first entry in the "parents" array as "parent". --- indra/llui/llnotifications.cpp | 1 + indra/llui/llnotifications.h | 8 +++++++- indra/llui/llnotificationslistener.cpp | 16 +++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 5c288c3f03..99641ae104 100755 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1189,6 +1189,7 @@ void LLNotificationChannel::connectToChannel( const std::string& channel_name ) } else { + mParents.push_back(channel_name); LLNotificationChannelPtr p = LLNotifications::instance().getChannel(channel_name); p->connectChanged(boost::bind(&LLNotificationChannelBase::updateItem, this, _1)); } diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 6ac4a98806..39426d9a89 100755 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -88,6 +88,7 @@ #include #include #include +#include #include "llevents.h" #include "llfunctorregistry.h" @@ -839,6 +840,11 @@ public: typedef LLNotificationSet::iterator Iterator; std::string getName() const { return mName; } + typedef std::vector::const_iterator parents_iter; + boost::iterator_range getParents() const + { + return boost::iterator_range(mParents); + } void connectToChannel(const std::string& channel_name); @@ -853,7 +859,7 @@ public: private: std::string mName; - std::string mParent; + std::vector mParents; }; // An interface class to provide a clean linker seam to the LLNotifications class. diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp index 3bbeb3a778..b6a32a0e78 100644 --- a/indra/llui/llnotificationslistener.cpp +++ b/indra/llui/llnotificationslistener.cpp @@ -32,6 +32,7 @@ #include "llnotificationtemplate.h" #include "llsd.h" #include "llui.h" +#include LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) : LLEventAPI("LLNotifications", @@ -121,13 +122,18 @@ void LLNotificationsListener::listChannels(const LLSD& params) const { LLReqID reqID(params); LLSD response(reqID.makeResponse()); - for (LLNotifications::ChannelMap::const_iterator cmi(mNotifications.mChannels.begin()), - cmend(mNotifications.mChannels.end()); + for (LLNotificationChannel::instance_iter cmi(LLNotificationChannel::beginInstances()), + cmend(LLNotificationChannel::endInstances()); cmi != cmend; ++cmi) { - LLSD channelInfo; - channelInfo["parent"] = cmi->second->getParentChannelName(); - response[cmi->first] = channelInfo; + LLSD channelInfo, parents; + BOOST_FOREACH(const std::string& parent, cmi->getParents()) + { + parents.append(parent); + } + channelInfo["parents"] = parents; + channelInfo["parent"] = parents.size()? parents[0] : ""; + response[cmi->getName()] = channelInfo; } LLEventPumps::instance().obtain(params["reply"]).post(response); } -- cgit v1.2.3 From 8bc42784122619e3f37afabbc5888821c3430369 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Fri, 28 Mar 2014 17:21:36 +0000 Subject: strom-1831: Cleaning out commented and unused code --- indra/llui/llkeywords.cpp | 10 ---------- indra/llui/llkeywords.h | 1 - 2 files changed, 11 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 82b50f43ab..b495709ce0 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -134,16 +134,6 @@ void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, } } -void LLKeywords::clear() -{ - clearLoaded(); - mSyntax = LLSD(); - - std::for_each(mWordTokenMap.begin(), mWordTokenMap.end(), DeletePairedPointer()); - std::for_each(mLineTokenList.begin(), mLineTokenList.end(), DeletePointer()); - std::for_each(mDelimiterTokenList.begin(), mDelimiterTokenList.end(), DeletePointer()); -} - std::string LLKeywords::getArguments(LLSD& arguments) { std::string argString = ""; diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index de7645a5d2..689fd75bcd 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -110,7 +110,6 @@ public: ~LLKeywords(); void addColorGroup(const std::string key_in, const LLColor4 color); - void clear(); void clearLoaded() { mLoaded = false; } LLColor4 getColorGroup(const std::string key_in); bool isLoaded() const { return mLoaded; } -- cgit v1.2.3 From 0039e80d7c625e466833b86df5767c723f698034 Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 16 Apr 2014 11:52:27 -0600 Subject: bool not U32 --- indra/llui/llkeywords.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 21129853de..e2ffd30f8d 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -37,14 +37,14 @@ inline bool LLKeywordToken::isHead(const llwchar* s) const { // strncmp is much faster than string compare - bool res = TRUE; + bool res = true; const llwchar* t = mToken.c_str(); S32 len = mToken.size(); for (S32 i=0; i Date: Wed, 16 Apr 2014 11:52:46 -0600 Subject: Orphaned definition --- indra/llui/llkeywords.h | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 689fd75bcd..2f7932f815 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -172,7 +172,6 @@ protected: LLColor4 readColor(LLSD& sd); void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); void insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); - BOOL loadIntoLLSD( const std::string& filename, LLSD& data ); LLSD mColors; bool mLoaded; -- cgit v1.2.3 From 8c39617c9ac469a8635d511142148ad5a38de836 Mon Sep 17 00:00:00 2001 From: Cinder Date: Fri, 18 Apr 2014 12:52:07 -0600 Subject: Begin moving script editor portions of LLTextEditor to their own derived class. This should fix the run off segment bugs by not overriding LLTextBase::clearSegments() in LLTextEditor TODO: Move the rest of the script stuff out of LLTextEditor for simplicity sake --- indra/llui/lltextbase.cpp | 1 - indra/llui/lltexteditor.cpp | 8 -------- indra/llui/lltexteditor.h | 1 - 3 files changed, 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index ee16d3de7c..c4664d6fe0 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -923,7 +923,6 @@ void LLTextBase::createDefaultSegment() // ensures that there is always at least one segment if (mSegments.empty()) { - LLStyleConstSP sp(new LLStyle(getStyleParams())); LLTextSegmentPtr default_segment = new LLNormalTextSegment( sp, 0, getLength() + 1, *this); mSegments.insert(default_segment); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index df8d37e3aa..8120f3f9a1 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2529,14 +2529,6 @@ void LLTextEditor::loadKeywords() } } -void LLTextEditor::clearSegments() -{ - if (!mSegments.empty()) - { - mSegments.clear(); - } -} - void LLTextEditor::updateSegments() { if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly) diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 698153587f..09c56fca5a 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -208,7 +208,6 @@ public: const LLTextSegmentPtr getPreviousSegment() const; void getSelectedSegments(segment_vec_t& segments) const; - void clearSegments(); void setShowContextMenu(bool show) { mShowContextMenu = show; } bool getShowContextMenu() const { return mShowContextMenu; } -- cgit v1.2.3 From dcffb97518cb2888489c93b90862518f761967dd Mon Sep 17 00:00:00 2001 From: Cinder Date: Fri, 18 Apr 2014 23:13:57 -0600 Subject: Move some more script editor functions from LLTextEditor to LLScriptEditor --- indra/llui/llkeywords.cpp | 6 +++--- indra/llui/llkeywords.h | 12 ++++++------ indra/llui/lltexteditor.cpp | 37 ------------------------------------- indra/llui/lltexteditor.h | 15 ++------------- 4 files changed, 11 insertions(+), 59 deletions(-) (limited to 'indra/llui') 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* 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( const std::string& name, BOOL recurse) const; #endif -#endif // LL_TEXTEDITOR_ +#endif // LL_TEXTEDITOR_H -- cgit v1.2.3 From 72c11c0e578b466eccc64e15fcaeb8d977c15e70 Mon Sep 17 00:00:00 2001 From: Stinson Linden Date: Wed, 30 Apr 2014 01:45:09 +0100 Subject: MAINT-4009: Patching another memory leak in LLBadgeOwner that indirectly was also causing leaks in llimage. --- indra/llui/llbadgeowner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index 1860a05edd..9b2a9569f7 100755 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -45,6 +45,7 @@ void LLBadgeOwner::initBadgeParams(const LLBadge::Params& p) if (!p.equals(LLUICtrlFactory::getDefaultParams())) { mBadge = createBadge(p); + addBadgeToParentPanel(); } } @@ -53,7 +54,6 @@ void LLBadgeOwner::setBadgeLabel(const LLStringExplicit& label) if (mBadge == NULL) { mBadge = createBadge(LLUICtrlFactory::getDefaultParams()); - addBadgeToParentPanel(); } -- cgit v1.2.3 From e5375795e1ac519eb62b79807d5f5d4c5841990d Mon Sep 17 00:00:00 2001 From: Stinson Linden Date: Wed, 30 Apr 2014 23:10:35 +0100 Subject: MAINT-4009: Patching the LLTabContainer that was leaking some child views and their associated llimage allocations. --- indra/llui/lltabcontainer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index ebc6183b8b..273e9c1ef6 100755 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1140,6 +1140,17 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) addChild( btn, 0 ); } } + else + { + if (textbox) + { + LLUICtrl::addChild(textbox, 0); + } + if (btn) + { + LLUICtrl::addChild(btn, 0); + } + } if (child) { -- cgit v1.2.3 From 8247f51684ecc73cc60fa64b2fb0de3dce2a0c26 Mon Sep 17 00:00:00 2001 From: Stinson Linden Date: Fri, 2 May 2014 00:32:31 +0100 Subject: MAINT-4009: Patching the memory leak occurring in the scenario where avatar icon was being created, but the tab container did not have a button to accept the gieven icon. --- indra/llui/lltabcontainer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 273e9c1ef6..6f858cdeb3 100755 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1647,16 +1647,26 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon) { LLTabTuple* tuple = getTabByPanel(child); LLCustomButtonIconCtrl* button; + bool hasButton = false; if(tuple) { button = dynamic_cast(tuple->mButton); if(button) { + hasButton = true; button->setIcon(icon); reshapeTuple(tuple); } } + + if (!hasButton && (icon != NULL)) + { + // It was assumed that the tab's button would take ownership of the icon pointer. + // But since the tab did not have a button, kill the icon to prevent the memory + // leak. + icon->die(); + } } void LLTabContainer::reshapeTuple(LLTabTuple* tuple) -- cgit v1.2.3 From 001621dfc21942a6ae0075ca3eef31720f42477b Mon Sep 17 00:00:00 2001 From: Stinson Linden Date: Mon, 5 May 2014 23:24:34 +0100 Subject: MAINT-4009: Patching a small memory leak for when menu items were being created before the viewer window initialization had created the menu holder. Also, added llasserts in other cases when referencing the menu holder to ensure the holder is non-null. --- indra/llui/llfolderview.cpp | 1 + indra/llui/lllineeditor.cpp | 1 + indra/llui/llmenubutton.cpp | 1 + indra/llui/llscrolllistctrl.cpp | 1 + indra/llui/lltextbase.cpp | 1 + indra/llui/lltexteditor.cpp | 1 + indra/llui/lltoolbar.cpp | 1 + 7 files changed, 7 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 53f2e15ed0..2ec7ed861f 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -231,6 +231,7 @@ LLFolderView::LLFolderView(const Params& p) // make the popup menu available + llassert(LLMenuGL::sMenuContainer != NULL); LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile(p.options_menu, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (!menu) { diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index d410a2de33..b09c927782 100755 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -192,6 +192,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) setPrevalidateInput(p.prevalidate_input_callback()); setPrevalidate(p.prevalidate_callback()); + llassert(LLMenuGL::sMenuContainer != NULL); LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile ("menu_text_editor.xml", LLMenuGL::sMenuContainer, diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 0609cd8b42..303afcda15 100755 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -93,6 +93,7 @@ void LLMenuButton::setMenu(const std::string& menu_filename, EMenuPosition posit return; } + llassert(LLMenuGL::sMenuContainer != NULL); LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (!menu) { diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 3708071e11..5f72ee3ac6 100755 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1815,6 +1815,7 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) // create the context menu from the XUI file and display it std::string menu_name = is_group ? "menu_url_group.xml" : "menu_url_agent.xml"; delete mPopupMenu; + llassert(LLMenuGL::sMenuContainer != NULL); mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile( menu_name, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (mPopupMenu) diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 62edbadb07..30e6c6248e 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1955,6 +1955,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) // create and return the context menu from the XUI file delete mPopupMenu; + llassert(LLMenuGL::sMenuContainer != NULL); mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile(xui_file, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (mIsFriendSignal) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 494666df8a..517142bf17 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2031,6 +2031,7 @@ void LLTextEditor::showContextMenu(S32 x, S32 y) { if (!mContextMenu) { + llassert(LLMenuGL::sMenuContainer != NULL); mContextMenu = LLUICtrlFactory::instance().createFromFile("menu_text_editor.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index f9bdd87087..abc2b6e9ca 100755 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -148,6 +148,7 @@ void LLToolBar::createContextMenu() enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2)); // Create the context menu + llassert(LLMenuGL::sMenuContainer != NULL); LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (menu) -- cgit v1.2.3 From e8422e5bed6c593c8a26b533f33103911a1d3da6 Mon Sep 17 00:00:00 2001 From: Cinder Date: Tue, 6 May 2014 11:09:50 -0600 Subject: Let's get started: some code policy cleanup, reference arguments where we can, correct spelling --- indra/llui/llkeywords.cpp | 130 +++++++++++++++++++++++----------------------- indra/llui/llkeywords.h | 6 +-- 2 files changed, 68 insertions(+), 68 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 07c84e57c0..bae604e270 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,79 +176,79 @@ 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) @@ -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..b17e9dd942 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -109,9 +109,9 @@ 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 *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); @@ -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& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); -- cgit v1.2.3 From 1e851a2eb70e5f6b12a47c382efb3b9b17674993 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 7 May 2014 15:18:44 -0400 Subject: correct bad merges from 3.7.7-release --- indra/llui/llkeywords.cpp | 4 ++-- indra/llui/lltexteditor.cpp | 28 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 07c84e57c0..c79468ba5b 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -523,13 +523,13 @@ LLColor4 LLKeywords::readColor(LLSD& sd) } } -LLFastTimer::DeclareTimer FTM_SYNTAX_COLORING("Syntax Coloring"); +LLTrace::BlockTimerStatHandle FTM_SYNTAX_COLORING("Syntax Coloring"); // Walk through a string, applying the rules specified by the keyword token list and // create a list of color segments. void LLKeywords::findSegments(std::vector* seg_list, const LLWString& wtext, const LLColor4 &defaultColor, LLTextEditor& editor) { - LLFastTimer ft(FTM_SYNTAX_COLORING); + LL_RECORD_BLOCK_TIME(FTM_SYNTAX_COLORING); seg_list->clear(); if( wtext.empty() ) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index b18c545f30..7818f6e285 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -792,7 +792,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) setCursorAtLocalPos( clamped_x, clamped_y, true ); mSelectionEnd = mCursorPos; } - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; getWindow()->setCursor(UI_CURSOR_IBEAM); handled = TRUE; } @@ -2567,20 +2567,20 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) instream.getline(tbuf, MAX_STRING); if( 1 != sscanf(tbuf, "Linden text version %d", &version) ) { - llwarns << "Invalid Linden text file header " << llendl; + LL_WARNS() << "Invalid Linden text file header " << LL_ENDL; return FALSE; } if( 1 != version ) { - llwarns << "Invalid Linden text file version: " << version << llendl; + LL_WARNS() << "Invalid Linden text file version: " << version << LL_ENDL; return FALSE; } instream.getline(tbuf, MAX_STRING); if( 0 != sscanf(tbuf, "{") ) { - llwarns << "Invalid Linden text file format" << llendl; + LL_WARNS() << "Invalid Linden text file format" << LL_ENDL; return FALSE; } @@ -2588,13 +2588,13 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) instream.getline(tbuf, MAX_STRING); if( 1 != sscanf(tbuf, "Text length %d", &text_len) ) { - llwarns << "Invalid Linden text length field" << llendl; + LL_WARNS() << "Invalid Linden text length field" << LL_ENDL; return FALSE; } if( text_len > mMaxTextByteLength ) { - llwarns << "Invalid Linden text length: " << text_len << llendl; + LL_WARNS() << "Invalid Linden text length: " << text_len << LL_ENDL; return FALSE; } @@ -2603,21 +2603,21 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) char* text = new char[ text_len + 1]; if (text == NULL) { - llerrs << "Memory allocation failure." << llendl; + LL_ERRS() << "Memory allocation failure." << LL_ENDL; return FALSE; } instream.get(text, text_len + 1, '\0'); text[text_len] = '\0'; if( text_len != (S32)strlen(text) )/* Flawfinder: ignore */ { - llwarns << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << llendl;/* Flawfinder: ignore */ + LL_WARNS() << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << LL_ENDL;/* Flawfinder: ignore */ success = FALSE; } instream.getline(tbuf, MAX_STRING); if( success && (0 != sscanf(tbuf, "}")) ) { - llwarns << "Invalid Linden text file format: missing terminal }" << llendl; + LL_WARNS() << "Invalid Linden text file format: missing terminal }" << LL_ENDL; success = FALSE; } @@ -2680,7 +2680,7 @@ void LLTextEditor::resetPreedit() { if (hasPreeditString()) { - llwarns << "Preedit and selection!" << llendl; + LL_WARNS() << "Preedit and selection!" << LL_ENDL; deselect(); } else @@ -2690,6 +2690,12 @@ void LLTextEditor::resetPreedit() } if (hasPreeditString()) { + if (hasSelection()) + { + LL_WARNS() << "Preedit and selection!" << LL_ENDL; + deselect(); + } + setCursorPos(mPreeditPositions.front()); removeStringNoUndo(mCursorPos, mPreeditPositions.back() - mCursorPos); insertStringNoUndo(mCursorPos, mPreeditOverwrittenWString); @@ -2879,7 +2885,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length) setCursorPos(position); if (hasPreeditString()) { - llwarns << "markAsPreedit invoked when hasPreeditString is true." << llendl; + LL_WARNS() << "markAsPreedit invoked when hasPreeditString is true." << LL_ENDL; } mPreeditWString = LLWString( getWText(), position, length ); if (length > 0) -- cgit v1.2.3 From 8501d6494bceeea962d7251d882ddc244a8daa7f Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 7 May 2014 19:58:56 -0600 Subject: Code policy --- indra/llui/llkeywords.cpp | 2 +- indra/llui/llkeywords.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index bae604e270..346b9a83bd 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -251,7 +251,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string& key_in) return LLUIColorTable::instance().getColor(color_group); } -void LLKeywords::initialise(LLSD SyntaxXML) +void LLKeywords::initialize(LLSD SyntaxXML) { mSyntax = SyntaxXML; mLoaded = true; diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index b17e9dd942..eecb327fee 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -115,7 +115,7 @@ public: bool isLoaded() const { return mLoaded; } void findSegments(std::vector *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 -- cgit v1.2.3 From b34cdbaa697f99673588d6b2f49fd917fed3ee09 Mon Sep 17 00:00:00 2001 From: Stinson Linden Date: Mon, 12 May 2014 23:43:36 +0100 Subject: MAINT-4009: Patching a minor leak for when the status text box for the folder view has not been reparented. --- indra/llui/llfolderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 2ec7ed861f..602bd1a23a 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -227,7 +227,7 @@ LLFolderView::LLFolderView(const Params& p) mStatusTextBox = LLUICtrlFactory::create (text_p); mStatusTextBox->setFollowsLeft(); mStatusTextBox->setFollowsTop(); - //addChild(mStatusTextBox); + addChild(mStatusTextBox); // make the popup menu available -- cgit v1.2.3 From c073bad6b29fa3c5167c28c286171a1bda9b5e4a Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 14 May 2014 11:04:53 -0600 Subject: Begin syntax coloring personalization --- indra/llui/llkeywords.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 2d8bd926c0..f633f3e4af 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -237,11 +237,11 @@ LLColor4 LLKeywords::getColorGroup(const std::string& key_in) } else if (key_in == "misc-comments_1_sided") { - color_group = "SyntaxLslComment1Sided"; + color_group = "SyntaxLslComment"; } else if (key_in == "misc-comments_2_sided") { - color_group = "SyntaxLslComment2Sided"; + color_group = "SyntaxLslComment"; } else { -- cgit v1.2.3 From e776b600b1a76fcbe316041fc6fa8e885464daee Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 14 May 2014 14:08:24 -0600 Subject: Refactor more script editor properties away from LLTextEditor to LLScriptEditor --- indra/llui/lltexteditor.cpp | 77 +-------------------------------------------- indra/llui/lltexteditor.h | 7 +---- 2 files changed, 2 insertions(+), 82 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 7818f6e285..268c830a75 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -75,8 +75,6 @@ template class LLTextEditor* LLView::getChild( // // Constants // -const S32 UI_TEXTEDITOR_LINE_NUMBER_MARGIN = 32; -const S32 UI_TEXTEDITOR_LINE_NUMBER_DIGITS = 4; const S32 SPACES_PER_TAB = 4; const F32 SPELLCHECK_DELAY = 0.5f; // delay between the last keypress and spell checking the word the cursor is on @@ -236,7 +234,6 @@ LLTextEditor::Params::Params() prevalidate_callback("prevalidate_callback"), embedded_items("embedded_items", false), ignore_tab("ignore_tab", true), - show_line_numbers("show_line_numbers", false), auto_indent("auto_indent", true), default_color("default_color"), commit_on_focus_lost("commit_on_focus_lost", false), @@ -252,8 +249,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : mBaseDocIsPristine(TRUE), mPristineCmd( NULL ), mLastCmd( NULL ), - mDefaultColor( p.default_color() ), - mShowLineNumbers ( p.show_line_numbers ), + mDefaultColor( p.default_color() ), mAutoIndent(p.auto_indent), mCommitOnFocusLost( p.commit_on_focus_lost), mAllowEmbeddedItems( p.embedded_items ), @@ -277,14 +273,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : params.visible = p.border_visible; mBorder = LLUICtrlFactory::create (params); addChild( mBorder ); - setText(p.default_text()); - - if (mShowLineNumbers) - { - mHPad += UI_TEXTEDITOR_LINE_NUMBER_MARGIN; - updateRects(); - } mParseOnTheFly = TRUE; } @@ -2196,69 +2185,6 @@ void LLTextEditor::drawPreeditMarker() } } - -void LLTextEditor::drawLineNumbers() -{ - LLGLSUIDefault gls_ui; - LLRect scrolled_view_rect = getVisibleDocumentRect(); - LLRect content_rect = getVisibleTextRect(); - LLLocalClipRect clip(content_rect); - S32 first_line = getFirstVisibleLine(); - S32 num_lines = getLineCount(); - if (first_line >= num_lines) - { - return; - } - - S32 cursor_line = mLineInfoList[getLineNumFromDocIndex(mCursorPos)].mLineNum; - - if (mShowLineNumbers) - { - S32 left = 0; - S32 top = getRect().getHeight(); - S32 bottom = 0; - - gl_rect_2d(left, top, UI_TEXTEDITOR_LINE_NUMBER_MARGIN, bottom, mReadOnlyBgColor.get() ); // line number area always read-only - gl_rect_2d(UI_TEXTEDITOR_LINE_NUMBER_MARGIN, top, UI_TEXTEDITOR_LINE_NUMBER_MARGIN-1, bottom, LLColor4::grey3); // separator - - S32 last_line_num = -1; - - for (S32 cur_line = first_line; cur_line < num_lines; cur_line++) - { - line_info& line = mLineInfoList[cur_line]; - - if ((line.mRect.mTop - scrolled_view_rect.mBottom) < mVisibleTextRect.mBottom) - { - break; - } - - S32 line_bottom = line.mRect.mBottom - scrolled_view_rect.mBottom + mVisibleTextRect.mBottom; - // draw the line numbers - if(line.mLineNum != last_line_num && line.mRect.mTop <= scrolled_view_rect.mTop) - { - const LLFontGL *num_font = LLFontGL::getFontMonospace(); - const LLWString ltext = utf8str_to_wstring(llformat("%d", line.mLineNum )); - BOOL is_cur_line = cursor_line == line.mLineNum; - const U8 style = is_cur_line ? LLFontGL::BOLD : LLFontGL::NORMAL; - const LLColor4 fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor; - num_font->render( - ltext, // string to draw - 0, // begin offset - UI_TEXTEDITOR_LINE_NUMBER_MARGIN - 2, // x - line_bottom, // y - fg_color, - LLFontGL::RIGHT, // horizontal alignment - LLFontGL::BOTTOM, // vertical alignment - style, - LLFontGL::NO_SHADOW, - S32_MAX, // max chars - UI_TEXTEDITOR_LINE_NUMBER_MARGIN - 2); // max pixels - last_line_num = line.mLineNum; - } - } - } -} - void LLTextEditor::draw() { { @@ -2270,7 +2196,6 @@ void LLTextEditor::draw() } LLTextBase::draw(); - drawLineNumbers(); drawPreeditMarker(); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 404275026c..2408613824 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -58,7 +58,6 @@ public: Optional embedded_items, ignore_tab, - show_line_numbers, commit_on_focus_lost, show_context_menu, enable_tooltip_paste, @@ -279,11 +278,11 @@ protected: protected: LLUIColor mDefaultColor; - BOOL mShowLineNumbers; bool mAutoIndent; bool mParseOnTheFly; void updateLinkSegments(); + class LLViewBorder* mBorder; private: // @@ -293,8 +292,6 @@ private: void cleanStringForPaste(LLWString & clean_string); void pasteTextWithLinebreaks(LLWString & clean_string); - void drawLineNumbers(); - void onKeyStroke(); // Concrete TextCmd sub-classes used by the LLTextEditor base class @@ -303,8 +300,6 @@ private: class TextCmdOverwriteChar; class TextCmdRemove; - class LLViewBorder* mBorder; - BOOL mBaseDocIsPristine; TextCmd* mPristineCmd; -- cgit v1.2.3 From 8c970eae222eb94d42e951e47153b97de744f6e5 Mon Sep 17 00:00:00 2001 From: Cinder Date: Fri, 16 May 2014 09:18:38 -0600 Subject: Remove orphaned LLKeywords methods --- indra/llui/llkeywords.cpp | 34 ---------------------------------- indra/llui/llkeywords.h | 4 ---- 2 files changed, 38 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index f633f3e4af..b4e3ccbf5e 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -82,12 +82,6 @@ LLKeywords::~LLKeywords() mDelimiterTokenList.clear(); } -void LLKeywords::addColorGroup(const std::string& key_in, const LLColor4& color) -{ - WStringMapIndex key ( utf8str_to_wstring(key_in) ); - mColorGroupMap[key] = color; -} - // Add the token as described void LLKeywords::addToken(LLKeywordToken::ETokenType type, const std::string& key_in, @@ -495,34 +489,6 @@ bool LLKeywords::WStringMapIndex::operator<(const LLKeywords::WStringMapIndex &o return result; } -LLColor4 LLKeywords::readColor( const std::string& s ) -{ - F32 r, g, b; - r = g = b = 0.0f; - S32 values_read = sscanf(s.c_str(), "%f, %f, %f]", &r, &g, &b ); - if( values_read != 3 ) - { - llinfos << " poorly formed color in keyword file" << llendl; - } - return LLColor4( r, g, b, 1.f); -} - -LLColor4 LLKeywords::readColor(LLSD& sd) -{ - if (sd.isArray()) - { - 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 ); - } - else - { - return LLColor4::black; - } -} - LLTrace::BlockTimerStatHandle FTM_SYNTAX_COLORING("Syntax Coloring"); // Walk through a string, applying the rules specified by the keyword token list and diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index eecb327fee..4e20b4459e 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -109,7 +109,6 @@ public: LLKeywords(); ~LLKeywords(); - void addColorGroup(const std::string& key_in, const LLColor4& color); void clearLoaded() { mLoaded = false; } LLColor4 getColorGroup(const std::string& key_in); bool isLoaded() const { return mLoaded; } @@ -168,12 +167,9 @@ public: protected: void processTokensGroup(const LLSD& Tokens, const std::string& Group); - LLColor4 readColor(const std::string& s); - LLColor4 readColor(LLSD& sd); void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); void insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); - LLSD mColors; bool mLoaded; LLSD mSyntax; word_token_map_t mWordTokenMap; -- cgit v1.2.3 From c84217cc5bf49354b39ea3521e4805c791a15c8c Mon Sep 17 00:00:00 2001 From: Stinson Linden Date: Tue, 27 May 2014 22:45:02 +0100 Subject: MAINT-4009: Ensuring that the view listeners are properly cleaned up at app close. --- indra/llui/llmenugl.cpp | 1 + indra/llui/llmenugl.h | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 7383a8c307..604dc92789 100755 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -63,6 +63,7 @@ // static LLMenuHolderGL *LLMenuGL::sMenuContainer = NULL; +view_listener_t::listener_map_t view_listener_t::sListeners; S32 MENU_BAR_HEIGHT = 0; S32 MENU_BAR_WIDTH = 0; diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index feafaab199..ae9b169691 100755 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -895,7 +895,8 @@ class view_listener_t : public boost::signals2::trackable { public: virtual bool handleEvent(const LLSD& userdata) = 0; - virtual ~view_listener_t() {} + view_listener_t() { sListeners.insert(this); } + virtual ~view_listener_t() { sListeners.erase(this); } static void addEnable(view_listener_t* listener, const std::string& name) { @@ -913,6 +914,20 @@ public: addEnable(listener, name); addCommit(listener, name); } + + static void cleanup() + { + listener_vector_t listeners(sListeners.begin(), sListeners.end()); + sListeners.clear(); + + std::for_each(listeners.begin(), listeners.end(), DeletePointer()); + listeners.clear(); + } + +private: + typedef std::set listener_map_t; + typedef std::vector listener_vector_t; + static listener_map_t sListeners; }; #endif // LL_LLMENUGL_H -- cgit v1.2.3 From 72dba8742c3120fcb76b42aa6ede796bdad8554d Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Wed, 28 May 2014 13:20:12 +0300 Subject: MAINT-4070 FIXED Use icon in urls when content is trusted. --- indra/llui/lltextbase.cpp | 4 ++-- indra/llui/lltextbase.h | 2 ++ indra/llui/lltextutil.cpp | 4 ++-- indra/llui/lltextutil.h | 2 +- indra/llui/llurlregistry.cpp | 11 +++++++++-- indra/llui/llurlregistry.h | 4 +++- 6 files changed, 19 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 30e6c6248e..8906a6e736 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2038,7 +2038,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para LLUrlMatch match; std::string text = new_text; while ( LLUrlRegistry::instance().findUrl(text, match, - boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3)) ) + boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3),isContentTrusted())) { start = match.getStart(); end = match.getEnd()+1; @@ -2075,7 +2075,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para } } - LLTextUtil::processUrlMatch(&match,this); + LLTextUtil::processUrlMatch(&match,this,isContentTrusted()); // move on to the rest of the text after the Url if (end < (S32)text.length()) diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index d1f66b6cfe..ecbfdaf84c 100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -367,7 +367,9 @@ public: bool getWordWrap() { return mWordWrap; } bool getUseEllipses() { return mUseEllipses; } bool truncate(); // returns true of truncation occurred + bool isContentTrusted() {return mTrustedContent;} + void setContentTrusted(bool trusted_content) { mTrustedContent = trusted_content; } // TODO: move into LLTextSegment? void createUrlContextMenu(S32 x, S32 y, const std::string &url); // create a popup context menu for the given Url diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp index 4df2c3363f..fff04b34f2 100755 --- a/indra/llui/lltextutil.cpp +++ b/indra/llui/lltextutil.cpp @@ -72,7 +72,7 @@ const std::string& LLTextUtil::formatPhoneNumber(const std::string& phone_str) return formatted_phone_str; } -bool LLTextUtil::processUrlMatch(LLUrlMatch* match,LLTextBase* text_base) +bool LLTextUtil::processUrlMatch(LLUrlMatch* match,LLTextBase* text_base, bool is_content_trusted) { if (match == 0 || text_base == 0) return false; @@ -85,7 +85,7 @@ bool LLTextUtil::processUrlMatch(LLUrlMatch* match,LLTextBase* text_base) } // output an optional icon before the Url - if (!match->getIcon().empty() ) + if (is_content_trusted && !match->getIcon().empty() ) { LLUIImagePtr image = LLUI::getUIImage(match->getIcon()); if (image) diff --git a/indra/llui/lltextutil.h b/indra/llui/lltextutil.h index bf7dbb58ce..798f14d086 100755 --- a/indra/llui/lltextutil.h +++ b/indra/llui/lltextutil.h @@ -64,7 +64,7 @@ namespace LLTextUtil */ const std::string& formatPhoneNumber(const std::string& phone_str); - bool processUrlMatch(LLUrlMatch* match,LLTextBase* text_base); + bool processUrlMatch(LLUrlMatch* match,LLTextBase* text_base, bool is_content_trusted); class TextHelpers { diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 523ee5d78c..bccc646821 100755 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -41,7 +41,8 @@ LLUrlRegistry::LLUrlRegistry() // Urls are matched in the order that they were registered registerUrl(new LLUrlEntryNoLink()); - registerUrl(new LLUrlEntryIcon()); + mUrlEntryIcon = new LLUrlEntryIcon(); + registerUrl(mUrlEntryIcon); registerUrl(new LLUrlEntrySLURL()); registerUrl(new LLUrlEntryHTTP()); registerUrl(new LLUrlEntryHTTPLabel()); @@ -145,7 +146,7 @@ static bool stringHasUrl(const std::string &text) text.find("::iterator it; for (it = mUrlEntry.begin(); it != mUrlEntry.end(); ++it) { + //Skip for url entry icon if content is not trusted + if(!is_content_trusted && (mUrlEntryIcon == *it)) + { + continue; + } + LLUrlEntryBase *url_entry = *it; U32 start = 0, end = 0; diff --git a/indra/llui/llurlregistry.h b/indra/llui/llurlregistry.h index da16171a97..6270df1bbb 100755 --- a/indra/llui/llurlregistry.h +++ b/indra/llui/llurlregistry.h @@ -73,7 +73,8 @@ public: /// get the next Url in an input string, starting at a given character offset /// your callback is invoked if the matched Url's label changes in the future bool findUrl(const std::string &text, LLUrlMatch &match, - const LLUrlLabelCallback &cb = &LLUrlRegistryNullCallback); + const LLUrlLabelCallback &cb = &LLUrlRegistryNullCallback, + bool is_content_trusted = false); /// a slightly less efficient version of findUrl for wide strings bool findUrl(const LLWString &text, LLUrlMatch &match, @@ -92,6 +93,7 @@ private: friend class LLSingleton; std::vector mUrlEntry; + LLUrlEntryBase* mUrlEntryIcon; }; #endif -- cgit v1.2.3 From ec2b00c2e5fccd7432ef1b5a5ab5c88d098e95f2 Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 28 May 2014 12:15:37 -0600 Subject: Don't hardcode black as the default color for syntax --- indra/llui/llkeywords.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index b4e3ccbf5e..29b9c5c2f1 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -172,7 +172,7 @@ std::string LLKeywords::getAttribute(const std::string& key) LLColor4 LLKeywords::getColorGroup(const std::string& key_in) { - std::string color_group = "Black"; + std::string color_group = "ScriptText"; if (key_in == "constants-float") { color_group = "SyntaxLslConstantFloat"; @@ -239,7 +239,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string& key_in) } else { - LL_WARNS("SyntaxLSL") << "Color key '" << key_in << "' not recognized!" << LL_ENDL; + LL_WARNS("SyntaxLSL") << "Color key '" << key_in << "' not recognized." << LL_ENDL; } return LLUIColorTable::instance().getColor(color_group); -- cgit v1.2.3 From 274327e1e2b2486eddb66d787e410b54d37e4437 Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 28 May 2014 13:01:51 -0600 Subject: Half of STORM-2025, fix flow-control highlighting --- indra/llui/llkeywords.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 29b9c5c2f1..8b5fb54877 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -197,6 +197,10 @@ LLColor4 LLKeywords::getColorGroup(const std::string& key_in) { color_group = "SyntaxLslConstantVector"; } + else if (key_in == "controls") + { + color_group = "SyntaxLslControlFlow"; + } else if (key_in == "misc-flow-label") { color_group = "SyntaxLslControlFlow"; -- cgit v1.2.3 From 51e0cc8140a2cbe92363cb902144ccc9bf34b7c7 Mon Sep 17 00:00:00 2001 From: Stinson Linden Date: Sat, 31 May 2014 02:30:12 +0100 Subject: MAINT-4114: Refactoring the LLBadge code to ensure a parent view always has the badge (to preserve memory cleanliness), but to also allow for badge reparenting so that the NEW badge works in the inventory window. This change relates to 9e0d629da1487f850beb2767bd47734c4ccc393e. --- indra/llui/llbadgeowner.cpp | 45 +++++++++------------------------------------ indra/llui/llbadgeowner.h | 8 +++----- indra/llui/llbutton.cpp | 2 +- 3 files changed, 13 insertions(+), 42 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index 9b2a9569f7..55e64bb940 100755 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -35,8 +35,9 @@ // LLBadgeOwner::LLBadgeOwner(LLHandle< LLView > viewHandle) - : mBadge(NULL) - , mBadgeOwnerView(viewHandle) + : mHasBadgeHolderParent(false), + mBadge(NULL), + mBadgeOwnerView(viewHandle) { } @@ -45,31 +46,12 @@ void LLBadgeOwner::initBadgeParams(const LLBadge::Params& p) if (!p.equals(LLUICtrlFactory::getDefaultParams())) { mBadge = createBadge(p); - addBadgeToParentPanel(); - } -} - -void LLBadgeOwner::setBadgeLabel(const LLStringExplicit& label) -{ - if (mBadge == NULL) - { - mBadge = createBadge(LLUICtrlFactory::getDefaultParams()); - addBadgeToParentPanel(); - } + mHasBadgeHolderParent = false; - if (mBadge) - { - mBadge->setLabel(label); - - // - // Push the badge to the front so it renders on top - // - - LLView * parent = mBadge->getParent(); - - if (parent) + LLView * owner_view = mBadgeOwnerView.get(); + if (owner_view) { - parent->sendChildToFront(mBadge); + mBadge->addToView(owner_view); } } } @@ -82,10 +64,8 @@ void LLBadgeOwner::setBadgeVisibility(bool visible) } } -bool LLBadgeOwner::addBadgeToParentPanel() +void LLBadgeOwner::addBadgeToParentHolder() { - bool badge_added = false; - LLView * owner_view = mBadgeOwnerView.get(); if (mBadge && owner_view) @@ -110,16 +90,9 @@ bool LLBadgeOwner::addBadgeToParentPanel() if (badge_holder) { - badge_added = badge_holder->addBadge(mBadge); - } - else - { - // Badge parent is fallback badge owner if no valid holder exists in the hierarchy - badge_added = mBadge->addToView(owner_view); + mHasBadgeHolderParent = badge_holder->addBadge(mBadge); } } - - return badge_added; } LLBadge* LLBadgeOwner::createBadge(const LLBadge::Params& p) diff --git a/indra/llui/llbadgeowner.h b/indra/llui/llbadgeowner.h index 8d03e30645..53c2de95c8 100755 --- a/indra/llui/llbadgeowner.h +++ b/indra/llui/llbadgeowner.h @@ -41,11 +41,9 @@ public: LLBadgeOwner(LLHandle< LLView > viewHandle); void initBadgeParams(const LLBadge::Params& p); - bool addBadgeToParentPanel(); + void addBadgeToParentHolder(); - bool badgeHasParent() const { return (mBadge && mBadge->getParent()); } - - void setBadgeLabel(const LLStringExplicit& label); + bool hasBadgeHolderParent() const { return mHasBadgeHolderParent; }; void setBadgeVisibility(bool visible); private: @@ -53,7 +51,7 @@ private: LLBadge* createBadge(const LLBadge::Params& p); private: - + bool mHasBadgeHolderParent; LLBadge* mBadge; LLHandle< LLView > mBadgeOwnerView; }; diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 093d91d44d..ce8383857c 100755 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -384,7 +384,7 @@ BOOL LLButton::postBuild() { autoResize(); - addBadgeToParentPanel(); + addBadgeToParentHolder(); return LLUICtrl::postBuild(); } -- cgit v1.2.3 From 4170ae1027b1c8e5f63b0e6c4c9f919d8d3b66c0 Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 4 Jun 2014 12:52:27 -0600 Subject: STORM-2025: Part 2 - After consulting with Oz, remove subcategories of constants and fix highlighting --- indra/llui/llkeywords.cpp | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 8b5fb54877..9be15d8f1d 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -173,29 +173,9 @@ std::string LLKeywords::getAttribute(const std::string& key) LLColor4 LLKeywords::getColorGroup(const std::string& key_in) { std::string color_group = "ScriptText"; - if (key_in == "constants-float") + if (key_in == "constants") { - color_group = "SyntaxLslConstantFloat"; - } - else if (key_in == "constants-integer") - { - color_group = "SyntaxLslConstantInteger"; - } - else if (key_in == "constants-key") - { - color_group = "SyntaxLslConstantKey"; - } - else if (key_in == "constants-rotation") - { - color_group = "SyntaxLslConstantRotation"; - } - else if (key_in == "constants-string") - { - color_group = "SyntaxLslConstantString"; - } - else if (key_in == "constants-vector") - { - color_group = "SyntaxLslConstantVector"; + color_group = "SyntaxLslConstant"; } else if (key_in == "controls") { @@ -229,18 +209,6 @@ LLColor4 LLKeywords::getColorGroup(const std::string& key_in) { color_group = "SyntaxLslSection"; } - else if (key_in == "misc-double_quotation_marks") - { - color_group = "SyntaxLslStringLiteral"; - } - else if (key_in == "misc-comments_1_sided") - { - color_group = "SyntaxLslComment"; - } - else if (key_in == "misc-comments_2_sided") - { - color_group = "SyntaxLslComment"; - } else { LL_WARNS("SyntaxLSL") << "Color key '" << key_in << "' not recognized." << LL_ENDL; @@ -265,9 +233,9 @@ void LLKeywords::processTokens() // Add 'standard' stuff: Quotes, Comments, Strings, Labels, etc. before processing the LLSD std::string delimiter; addToken(LLKeywordToken::TT_LABEL, "@", getColorGroup("misc-flow-label"), "Label\nTarget for jump statement", delimiter ); - addToken(LLKeywordToken::TT_ONE_SIDED_DELIMITER, "//", getColorGroup("misc-comments_1_sided"), "Comment (single-line)\nNon-functional commentary or disabled code", delimiter ); - 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", "\"" ); + addToken(LLKeywordToken::TT_ONE_SIDED_DELIMITER, "//", LLUIColorTable::instance().getColor("SyntaxLslComment"), "Comment (single-line)\nNon-functional commentary or disabled code", delimiter ); + addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "/*", LLUIColorTable::instance().getColor("SyntaxLslComment"), "Comment (multi-line)\nNon-functional commentary or disabled code", "*/" ); + addToken(LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS, "\"", LLUIColorTable::instance().getColor("SyntaxLslStringLiteral"), "String literal", "\"" ); LLSD::map_iterator itr = mSyntax.beginMap(); for ( ; itr != mSyntax.endMap(); ++itr) @@ -401,7 +369,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group 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) + for (S32 count = 0; count < tokens.size(); ++count) { addToken(token_type, tokens[count], color, ""); } -- cgit v1.2.3 From e6b20328c2e25223359dede17357682b5b4e7ea1 Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 4 Jun 2014 22:51:20 -0600 Subject: A little more cleanup in LLSyntaxIDLSL and LLKeywords --- indra/llui/llkeywords.cpp | 65 +++++++++++++++++++++++++---------------------- indra/llui/llkeywords.h | 24 ++++++++++++----- 2 files changed, 53 insertions(+), 36 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 9be15d8f1d..9c5a339b6d 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -67,8 +67,8 @@ inline bool LLKeywordToken::isTail(const llwchar* s) const return res; } -LLKeywords::LLKeywords() : - mLoaded(false) +LLKeywords::LLKeywords() +: mLoaded(false) { } @@ -92,7 +92,7 @@ void LLKeywords::addToken(LLKeywordToken::ETokenType type, std::string tip_text = tool_tip_in; LLStringUtil::replaceString(tip_text, "\\n", "\n" ); LLStringUtil::replaceString(tip_text, "\t", " " ); - if (tip_text == "") + if (tip_text.empty()) { tip_text = "[no info]"; } @@ -161,7 +161,7 @@ std::string LLKeywords::getArguments(LLSD& arguments) { LL_WARNS("SyntaxLSL") << "Not an array! Invalid arguments LLSD passed to function." << arguments << LL_ENDL; } - return argString == "" ? "" : argString; + return argString; } std::string LLKeywords::getAttribute(const std::string& key) @@ -299,14 +299,14 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group if (tokens.isMap()) { LLSD::map_const_iterator outer_itr = tokens.beginMap(); - for ( ; outer_itr != tokens.endMap(); ++outer_itr) + for ( ; outer_itr != tokens.endMap(); ++outer_itr ) { if (outer_itr->second.isMap()) { mAttributes.clear(); LLSD arguments = LLSD(); LLSD::map_const_iterator inner_itr = outer_itr->second.beginMap(); - for ( ; inner_itr != outer_itr->second.endMap(); ++inner_itr) + for ( ; inner_itr != outer_itr->second.endMap(); ++inner_itr ) { if (inner_itr->first == "arguments") { @@ -326,33 +326,34 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group } std::string tooltip = ""; - if (token_type == LLKeywordToken::TT_CONSTANT) + switch (token_type) { - color_group = getColorGroup(group + "-" + getAttribute("type")); - tooltip = "Type: " + getAttribute("type") + ", Value: " + getAttribute("value"); - } - else if (token_type == LLKeywordToken::TT_EVENT) - { - tooltip = outer_itr->first + "(" + getArguments(arguments) + ")"; - } - else if (token_type == LLKeywordToken::TT_FUNCTION) - { - tooltip = getAttribute("return") + " " + outer_itr->first + "(" + getArguments(arguments) + ");"; - tooltip += "\nEnergy: "; - tooltip += getAttribute("energy") == "" ? "0.0" : getAttribute("energy"); - if (getAttribute("sleep") != "") - { - tooltip += ", Sleep: " + getAttribute("sleep"); - } + case LLKeywordToken::TT_CONSTANT: + color_group = getColorGroup(group + "-" + getAttribute("type")); + tooltip = "Type: " + getAttribute("type") + ", Value: " + getAttribute("value"); + break; + case LLKeywordToken::TT_EVENT: + tooltip = outer_itr->first + "(" + getArguments(arguments) + ")"; + break; + case LLKeywordToken::TT_FUNCTION: + tooltip = getAttribute("return") + " " + outer_itr->first + "(" + getArguments(arguments) + ");"; + tooltip.append("\nEnergy: "); + tooltip.append(getAttribute("energy").empty() ? "0.0" : getAttribute("energy")); + if (!getAttribute("sleep").empty()) + { + tooltip += ", Sleep: " + getAttribute("sleep"); + } + default: + break; } - if (getAttribute("tooltip") != "") + if (!getAttribute("tooltip").empty()) { - if (tooltip != "") + if (!tooltip.empty()) { - tooltip += "\n"; + tooltip.append("\n"); } - tooltip += getAttribute("tooltip"); + tooltip.append(getAttribute("tooltip")); } color = getAttribute("deprecated") == "true" ? color_deprecated : color_group; @@ -399,15 +400,19 @@ LLKeywords::WStringMapIndex::WStringMapIndex(const LLWString& str) copyData(str.data(), str.size()); } -LLKeywords::WStringMapIndex::WStringMapIndex(const llwchar *start, size_t length): -mData(start), mLength(length), mOwner(false) +LLKeywords::WStringMapIndex::WStringMapIndex(const llwchar *start, size_t length) +: mData(start) +, mLength(length) +, mOwner(false) { } LLKeywords::WStringMapIndex::~WStringMapIndex() { - if(mOwner) + if (mOwner) + { delete[] mData; + } } void LLKeywords::WStringMapIndex::copyData(const llwchar *start, size_t length) diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 4e20b4459e..18e2ed06c5 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -113,7 +113,10 @@ public: LLColor4 getColorGroup(const std::string& key_in); bool isLoaded() const { return mLoaded; } - void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); + void findSegments(std::vector *seg_list, + const LLWString& text, + const LLColor4 &defaultColor, + class LLTextEditor& editor); void initialize(LLSD SyntaxXML); void processTokens(); @@ -167,8 +170,19 @@ public: protected: void processTokensGroup(const LLSD& Tokens, const std::string& Group); - void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); - void insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); + void insertSegment(std::vector& seg_list, + LLTextSegmentPtr new_segment, + S32 text_len, + const LLColor4 &defaultColor, + class LLTextEditor& editor); + void insertSegments(const LLWString& wtext, + std::vector& seg_list, + LLKeywordToken* token, + S32 text_len, + S32 seg_start, + S32 seg_end, + const LLColor4 &defaultColor, + LLTextEditor& editor); bool mLoaded; LLSD mSyntax; @@ -182,9 +196,7 @@ protected: element_attributes_t mAttributes; std::string getAttribute(const std::string& key); - std::string getArguments(LLSD& args); - -private: + std::string getArguments(LLSD& arguments); }; #endif // LL_LLKEYWORDS_H -- cgit v1.2.3 From 904fd4245b517a44140a333a828d383ce4ed3005 Mon Sep 17 00:00:00 2001 From: Cinder Date: Sun, 8 Jun 2014 17:10:57 -0600 Subject: "sections" is apparently unused as well. --- indra/llui/llkeywords.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 9c5a339b6d..fe050d6107 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -205,10 +205,6 @@ LLColor4 LLKeywords::getColorGroup(const std::string& key_in) { color_group = "SyntaxLslDataType"; } - else if (key_in == "sections") - { - color_group = "SyntaxLslSection"; - } else { LL_WARNS("SyntaxLSL") << "Color key '" << key_in << "' not recognized." << LL_ENDL; -- cgit v1.2.3 From 6a6508f0fdcf5964018289315d7b6e6a62696a7e Mon Sep 17 00:00:00 2001 From: Cinder Date: Sun, 8 Jun 2014 17:51:31 -0600 Subject: Use a common SyntaxLSL broad tag to make debugging easier --- indra/llui/llkeywords.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index fe050d6107..95bdfa6fb3 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -290,7 +290,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group } color_group = getColorGroup(group); - LL_INFOS("Tokens") << "Group: '" << group << "', using color: '" << color_group << "'" << LL_ENDL; + LL_INFOS("SyntaxLSL") << "Group: '" << group << "', using color: '" << color_group << "'" << LL_ENDL; if (tokens.isMap()) { @@ -373,7 +373,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group } else { - LL_WARNS("Tokens") << "Invalid map/array passed: '" << tokens << "'" << LL_ENDL; + LL_WARNS("SyntaxLSL") << "Invalid map/array passed: '" << tokens << "'" << LL_ENDL; } } -- cgit v1.2.3 From b06e63acedbbbc0dafe24a04e866fcb4363601e8 Mon Sep 17 00:00:00 2001 From: Cinder Date: Sun, 8 Jun 2014 18:28:10 -0600 Subject: Fix lsl constant highlighting and sort the if-else chain to parse a little quicker --- indra/llui/llkeywords.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 95bdfa6fb3..75773d7dfd 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -173,37 +173,43 @@ std::string LLKeywords::getAttribute(const std::string& key) LLColor4 LLKeywords::getColorGroup(const std::string& key_in) { std::string color_group = "ScriptText"; - if (key_in == "constants") + if (key_in == "functions") { - color_group = "SyntaxLslConstant"; + color_group = "SyntaxLslFunction"; } else if (key_in == "controls") { color_group = "SyntaxLslControlFlow"; } - else if (key_in == "misc-flow-label") + else if (key_in == "events") { - color_group = "SyntaxLslControlFlow"; + color_group = "SyntaxLslEvent"; } - else if (key_in =="deprecated") + else if (key_in == "types") { - color_group = "SyntaxLslDeprecated"; + color_group = "SyntaxLslDataType"; } - else if (key_in == "events") + else if (key_in == "misc-flow-label") { - color_group = "SyntaxLslEvent"; + color_group = "SyntaxLslControlFlow"; } - else if (key_in == "functions") + else if (key_in =="deprecated") { - color_group = "SyntaxLslFunction"; + color_group = "SyntaxLslDeprecated"; } else if (key_in =="god-mode") { color_group = "SyntaxLslGodMode"; } - else if (key_in == "types") + else if (key_in == "constants" + || key_in == "constants-integer" + || key_in == "constants-float" + || key_in == "constants-string" + || key_in == "constants-key" + || key_in == "constants-rotation" + || key_in == "constants-vector") { - color_group = "SyntaxLslDataType"; + color_group = "SyntaxLslConstant"; } else { -- cgit v1.2.3 From 8d2e0fb3a047e349b88db80afa09fc97a7f4ff74 Mon Sep 17 00:00:00 2001 From: Cinder Date: Fri, 20 Jun 2014 13:43:31 -0600 Subject: STORM-2035 - Invert the background color in script editors for highlighting sections. Since the background color can be changed by the user, this ensures distinctive highlighting --- indra/llui/lltextbase.cpp | 51 ++++++++++++++++++++--------------------------- indra/llui/lltextbase.h | 40 +++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 44 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index ebfd227f06..71db0ac030 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -70,43 +70,36 @@ bool LLTextBase::compare_segment_end::operator()(const LLTextSegmentPtr& a, cons // helper functors -struct LLTextBase::compare_bottom +bool LLTextBase::compare_bottom::operator()(const S32& a, const LLTextBase::line_info& b) const { - bool operator()(const S32& a, const LLTextBase::line_info& b) const - { - return a > b.mRect.mBottom; // bottom of a is higher than bottom of b - } - - bool operator()(const LLTextBase::line_info& a, const S32& b) const - { - return a.mRect.mBottom > b; // bottom of a is higher than bottom of b - } + return a > b.mRect.mBottom; // bottom of a is higher than bottom of b +} - bool operator()(const LLTextBase::line_info& a, const LLTextBase::line_info& b) const - { - return a.mRect.mBottom > b.mRect.mBottom; // bottom of a is higher than bottom of b - } +bool LLTextBase::compare_bottom::operator()(const LLTextBase::line_info& a, const S32& b) const +{ + return a.mRect.mBottom > b; // bottom of a is higher than bottom of b +} -}; +bool LLTextBase::compare_bottom::operator()(const LLTextBase::line_info& a, const LLTextBase::line_info& b) const +{ + return a.mRect.mBottom > b.mRect.mBottom; // bottom of a is higher than bottom of b +} // helper functors -struct LLTextBase::compare_top +bool LLTextBase::compare_top::operator()(const S32& a, const LLTextBase::line_info& b) const { - bool operator()(const S32& a, const LLTextBase::line_info& b) const - { - return a > b.mRect.mTop; // top of a is higher than top of b - } + return a > b.mRect.mTop; // top of a is higher than top of b +} - bool operator()(const LLTextBase::line_info& a, const S32& b) const - { - return a.mRect.mTop > b; // top of a is higher than top of b - } +bool LLTextBase::compare_top::operator()(const LLTextBase::line_info& a, const S32& b) const +{ + return a.mRect.mTop > b; // top of a is higher than top of b +} - bool operator()(const LLTextBase::line_info& a, const LLTextBase::line_info& b) const - { - return a.mRect.mTop > b.mRect.mTop; // top of a is higher than top of b - } -}; +bool LLTextBase::compare_top::operator()(const LLTextBase::line_info& a, const LLTextBase::line_info& b) const +{ + return a.mRect.mTop > b.mRect.mTop; // top of a is higher than top of b +} struct LLTextBase::line_end_compare { diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index ecbfdaf84c..738b4d5b8e 100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -451,9 +451,31 @@ public: LLScrollContainer* getScrollContainer() const { return mScroller; } protected: + // protected member variables + // List of offsets and segment index of the start of each line. Always has at least one node (0). + struct line_info + { + line_info(S32 index_start, S32 index_end, LLRect rect, S32 line_num); + S32 mDocIndexStart; + S32 mDocIndexEnd; + LLRect mRect; + S32 mLineNum; // actual line count (ignoring soft newlines due to word wrap) + }; + typedef std::vector line_list_t; + // helper structs - struct compare_bottom; - struct compare_top; + struct compare_bottom + { + bool operator()(const S32& a, const line_info& b) const; + bool operator()(const line_info& a, const S32& b) const; + bool operator()(const line_info& a, const line_info& b) const; + }; + struct compare_top + { + bool operator()(const S32& a, const line_info& b) const; + bool operator()(const line_info& a, const S32& b) const; + bool operator()(const line_info& a, const line_info& b) const; + }; struct line_end_compare; typedef std::vector segment_vec_t; @@ -501,18 +523,6 @@ protected: }; typedef std::multiset segment_set_t; - // protected member variables - // List of offsets and segment index of the start of each line. Always has at least one node (0). - struct line_info - { - line_info(S32 index_start, S32 index_end, LLRect rect, S32 line_num); - S32 mDocIndexStart; - S32 mDocIndexEnd; - LLRect mRect; - S32 mLineNum; // actual line count (ignoring soft newlines due to word wrap) - }; - typedef std::vector line_list_t; - // member functions LLTextBase(const Params &p); virtual ~LLTextBase(); @@ -522,7 +532,7 @@ protected: virtual bool useLabel() const; // draw methods - void drawSelectionBackground(); // draws the black box behind the selected text + virtual void drawSelectionBackground(); // draws the black box behind the selected text void drawCursor(); void drawText(); -- cgit v1.2.3