From cd4914ab94063d33586e2aba172e4379f1c41bbf Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 1 May 2021 12:37:41 +0300 Subject: [PATCH 01/13] Cleanup CGroupHTML old properties --- nel/include/nel/gui/group_html.h | 23 - nel/src/gui/group_html.cpp | 393 +----------------- .../src/interface_v3/group_quick_help.cpp | 4 +- 3 files changed, 4 insertions(+), 416 deletions(-) diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 600c9b248..a16a16d82 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -139,37 +139,15 @@ namespace NLGUI float getTimeout() const {return (float)_TimeoutValue;} // Some constants - NLMISC::CRGBA BgColor; NLMISC::CRGBA ErrorColor; NLMISC::CRGBA LinkColor; - NLMISC::CRGBA TextColor; - NLMISC::CRGBA H1Color; - NLMISC::CRGBA H2Color; - NLMISC::CRGBA H3Color; - NLMISC::CRGBA H4Color; - NLMISC::CRGBA H5Color; - NLMISC::CRGBA H6Color; bool ErrorColorGlobalColor; bool LinkColorGlobalColor; bool TextColorGlobalColor; - bool H1ColorGlobalColor; - bool H2ColorGlobalColor; - bool H3ColorGlobalColor; - bool H4ColorGlobalColor; - bool H5ColorGlobalColor; - bool H6ColorGlobalColor; - uint TextFontSize; - uint H1FontSize; - uint H2FontSize; - uint H3FontSize; - uint H4FontSize; - uint H5FontSize; - uint H6FontSize; uint TDBeginSpace; uint PBeginSpace; uint LIBeginSpace; uint ULBeginSpace; - uint LIIndent; uint ULIndent; float LineSpaceFontFactor; std::string DefaultButtonGroup; @@ -184,7 +162,6 @@ namespace NLGUI std::string DefaultRadioButtonBitmapPushed; std::string DefaultRadioButtonBitmapOver; std::string DefaultBackgroundBitmapView; - std::string CurrentLinkTitle; struct TFormField { public: diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 04988b790..9939b4794 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -1460,37 +1460,15 @@ namespace NLGUI CWidgetManager::getInstance()->registerClockMsgTarget(this); // HTML parameters - BgColor = CRGBA::Black; ErrorColor = CRGBA(255, 0, 0); LinkColor = CRGBA(0, 0, 255); - TextColor = CRGBA(255, 255, 255); - H1Color = CRGBA(255, 255, 255); - H2Color = CRGBA(255, 255, 255); - H3Color = CRGBA(255, 255, 255); - H4Color = CRGBA(255, 255, 255); - H5Color = CRGBA(255, 255, 255); - H6Color = CRGBA(255, 255, 255); ErrorColorGlobalColor = false; LinkColorGlobalColor = false; TextColorGlobalColor = false; - H1ColorGlobalColor = false; - H2ColorGlobalColor = false; - H3ColorGlobalColor = false; - H4ColorGlobalColor = false; - H5ColorGlobalColor = false; - H6ColorGlobalColor = false; - TextFontSize = 9; - H1FontSize = 18; - H2FontSize = 15; - H3FontSize = 12; - H4FontSize = 9; - H5FontSize = 9; - H6FontSize = 9; LIBeginSpace = 4; ULBeginSpace = 12; PBeginSpace = 12; TDBeginSpace = 0; - LIIndent = -10; ULIndent = 30; LineSpaceFontFactor = 0.5f; DefaultButtonGroup = "html_text_button"; @@ -1562,11 +1540,6 @@ namespace NLGUI return _TitlePrefix; } else - if( name == "background_color" ) - { - return toString( BgColor ); - } - else if( name == "error_color" ) { return toString( ErrorColor ); @@ -1577,36 +1550,6 @@ namespace NLGUI return toString( LinkColor ); } else - if( name == "h1_color" ) - { - return toString( H1Color ); - } - else - if( name == "h2_color" ) - { - return toString( H2Color ); - } - else - if( name == "h3_color" ) - { - return toString( H3Color ); - } - else - if( name == "h4_color" ) - { - return toString( H4Color ); - } - else - if( name == "h5_color" ) - { - return toString( H5Color ); - } - else - if( name == "h6_color" ) - { - return toString( H6Color ); - } - else if( name == "error_color_global_color" ) { return toString( ErrorColorGlobalColor ); @@ -1622,71 +1565,6 @@ namespace NLGUI return toString( TextColorGlobalColor ); } else - if( name == "h1_color_global_color" ) - { - return toString( H1ColorGlobalColor ); - } - else - if( name == "h2_color_global_color" ) - { - return toString( H2ColorGlobalColor ); - } - else - if( name == "h3_color_global_color" ) - { - return toString( H3ColorGlobalColor ); - } - else - if( name == "h4_color_global_color" ) - { - return toString( H4ColorGlobalColor ); - } - else - if( name == "h5_color_global_color" ) - { - return toString( H5ColorGlobalColor ); - } - else - if( name == "h6_color_global_color" ) - { - return toString( H6ColorGlobalColor ); - } - else - if( name == "text_font_size" ) - { - return toString( TextFontSize ); - } - else - if( name == "h1_font_size" ) - { - return toString( H1FontSize ); - } - else - if( name == "h2_font_size" ) - { - return toString( H2FontSize ); - } - else - if( name == "h3_font_size" ) - { - return toString( H3FontSize ); - } - else - if( name == "h4_font_size" ) - { - return toString( H4FontSize ); - } - else - if( name == "h5_font_size" ) - { - return toString( H5FontSize ); - } - else - if( name == "h6_font_size" ) - { - return toString( H6FontSize ); - } - else if( name == "td_begin_space" ) { return toString( TDBeginSpace ); @@ -1707,11 +1585,6 @@ namespace NLGUI return toString( ULBeginSpace ); } else - if( name == "li_indent" ) - { - return toString( LIIndent ); - } - else if( name == "ul_indent" ) { return toString( ULIndent ); @@ -1824,14 +1697,6 @@ namespace NLGUI return; } else - if( name == "background_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - BgColor = c; - return; - } - else if( name == "error_color" ) { CRGBA c; @@ -1848,54 +1713,6 @@ namespace NLGUI return; } else - if( name == "h1_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H1Color = c; - return; - } - else - if( name == "h2_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H2Color = c; - return; - } - else - if( name == "h3_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H3Color = c; - return; - } - else - if( name == "h4_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H4Color = c; - return; - } - else - if( name == "h5_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H5Color = c; - return; - } - else - if( name == "h6_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H6Color = c; - return; - } - else if( name == "error_color_global_color" ) { bool b; @@ -1920,110 +1737,6 @@ namespace NLGUI return; } else - if( name == "h1_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H1ColorGlobalColor = b; - return; - } - else - if( name == "h2_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H2ColorGlobalColor = b; - return; - } - else - if( name == "h3_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H3ColorGlobalColor = b; - return; - } - else - if( name == "h4_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H4ColorGlobalColor = b; - return; - } - else - if( name == "h5_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H5ColorGlobalColor = b; - return; - } - else - if( name == "h6_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H6ColorGlobalColor = b; - return; - } - else - if( name == "text_font_size" ) - { - uint i; - if( fromString( value, i ) ) - TextFontSize = i; - return; - } - else - if( name == "h1_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H1FontSize = i; - return; - } - else - if( name == "h2_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H2FontSize = i; - return; - } - else - if( name == "h3_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H3FontSize = i; - return; - } - else - if( name == "h4_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H4FontSize = i; - return; - } - else - if( name == "h5_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H5FontSize = i; - return; - } - else - if( name == "h6_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H6FontSize = i; - return; - } - else if( name == "td_begin_space" ) { uint i; @@ -2056,14 +1769,6 @@ namespace NLGUI return; } else - if( name == "li_indent" ) - { - uint i; - if( fromString( value, i ) ) - LIIndent = i; - return; - } - else if( name == "ul_indent" ) { uint i; @@ -2222,16 +1927,8 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "type", BAD_CAST "html" ); xmlSetProp( node, BAD_CAST "url", BAD_CAST _URL.c_str() ); xmlSetProp( node, BAD_CAST "title_prefix", BAD_CAST _TitlePrefix.c_str() ); - xmlSetProp( node, BAD_CAST "background_color", BAD_CAST toString( BgColor ).c_str() ); xmlSetProp( node, BAD_CAST "error_color", BAD_CAST toString( ErrorColor ).c_str() ); xmlSetProp( node, BAD_CAST "link_color", BAD_CAST toString( LinkColor ).c_str() ); - xmlSetProp( node, BAD_CAST "background_color", BAD_CAST toString( BgColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h1_color", BAD_CAST toString( H1Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h2_color", BAD_CAST toString( H2Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h3_color", BAD_CAST toString( H3Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h4_color", BAD_CAST toString( H4Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h5_color", BAD_CAST toString( H5Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h6_color", BAD_CAST toString( H6Color ).c_str() ); xmlSetProp( node, BAD_CAST "error_color_global_color", BAD_CAST toString( ErrorColorGlobalColor ).c_str() ); @@ -2239,31 +1936,11 @@ namespace NLGUI BAD_CAST toString( LinkColorGlobalColor ).c_str() ); xmlSetProp( node, BAD_CAST "text_color_global_color", BAD_CAST toString( TextColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h1_color_global_color", - BAD_CAST toString( H1ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h2_color_global_color", - BAD_CAST toString( H2ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h3_color_global_color", - BAD_CAST toString( H3ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h4_color_global_color", - BAD_CAST toString( H4ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h5_color_global_color", - BAD_CAST toString( H5ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h6_color_global_color", - BAD_CAST toString( H6ColorGlobalColor ).c_str() ); - - xmlSetProp( node, BAD_CAST "text_font_size", BAD_CAST toString( TextFontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h1_font_size", BAD_CAST toString( H1FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h2_font_size", BAD_CAST toString( H2FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h3_font_size", BAD_CAST toString( H3FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h4_font_size", BAD_CAST toString( H4FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h5_font_size", BAD_CAST toString( H5FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h6_font_size", BAD_CAST toString( H6FontSize ).c_str() ); + xmlSetProp( node, BAD_CAST "td_begin_space", BAD_CAST toString( TDBeginSpace ).c_str() ); xmlSetProp( node, BAD_CAST "paragraph_begin_space", BAD_CAST toString( PBeginSpace ).c_str() ); xmlSetProp( node, BAD_CAST "li_begin_space", BAD_CAST toString( LIBeginSpace ).c_str() ); xmlSetProp( node, BAD_CAST "ul_begin_space", BAD_CAST toString( ULBeginSpace ).c_str() ); - xmlSetProp( node, BAD_CAST "li_indent", BAD_CAST toString( LIIndent ).c_str() ); xmlSetProp( node, BAD_CAST "ul_indent", BAD_CAST toString( ULIndent ).c_str() ); xmlSetProp( node, BAD_CAST "multi_line_space_factor", BAD_CAST toString( LineSpaceFontFactor ).c_str() ); xmlSetProp( node, BAD_CAST "form_text_area_group", BAD_CAST DefaultFormTextGroup.c_str() ); @@ -2315,36 +1992,12 @@ namespace NLGUI _TitlePrefix = CI18N::get((const char*)ptr); // Parameters - ptr = xmlGetProp (cur, (xmlChar*)"background_color"); - if (ptr) - BgColor = convertColor(ptr); ptr = xmlGetProp (cur, (xmlChar*)"error_color"); if (ptr) ErrorColor = convertColor(ptr); ptr = xmlGetProp (cur, (xmlChar*)"link_color"); if (ptr) LinkColor = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"text_color"); - if (ptr) - TextColor = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h1_color"); - if (ptr) - H1Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h2_color"); - if (ptr) - H2Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h3_color"); - if (ptr) - H3Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h4_color"); - if (ptr) - H4Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h5_color"); - if (ptr) - H5Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h6_color"); - if (ptr) - H6Color = convertColor(ptr); ptr = xmlGetProp (cur, (xmlChar*)"error_color_global_color"); if (ptr) ErrorColorGlobalColor = convertBool(ptr); @@ -2354,45 +2007,6 @@ namespace NLGUI ptr = xmlGetProp (cur, (xmlChar*)"text_color_global_color"); if (ptr) TextColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h1_color_global_color"); - if (ptr) - H1ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h2_color_global_color"); - if (ptr) - H2ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h3_color_global_color"); - if (ptr) - H3ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h4_color_global_color"); - if (ptr) - H4ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h5_color_global_color"); - if (ptr) - H5ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h6_color_global_color"); - if (ptr) - H6ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"text_font_size"); - if (ptr) - fromString((const char*)ptr, TextFontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h1_font_size"); - if (ptr) - fromString((const char*)ptr, H1FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h2_font_size"); - if (ptr) - fromString((const char*)ptr, H2FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h3_font_size"); - if (ptr) - fromString((const char*)ptr, H3FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h4_font_size"); - if (ptr) - fromString((const char*)ptr, H4FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h5_font_size"); - if (ptr) - fromString((const char*)ptr, H5FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h6_font_size"); - if (ptr) - fromString((const char*)ptr, H6FontSize); ptr = xmlGetProp (cur, (xmlChar*)"td_begin_space"); if (ptr) fromString((const char*)ptr, TDBeginSpace); @@ -2405,9 +2019,6 @@ namespace NLGUI ptr = xmlGetProp (cur, (xmlChar*)"ul_begin_space"); if (ptr) fromString((const char*)ptr, ULBeginSpace); - ptr = xmlGetProp (cur, (xmlChar*)"li_indent"); - if (ptr) - fromString((const char*)ptr, LIIndent); ptr = xmlGetProp (cur, (xmlChar*)"ul_indent"); if (ptr) fromString((const char*)ptr, ULIndent); @@ -4395,7 +4006,7 @@ namespace NLGUI clearContext(); // Reset default background color - setBackgroundColor (BgColor); + setBackgroundColor (_BrowserStyle.Current.BackgroundColor); setBackground ("blank.tga", true, false); paragraphChange (); diff --git a/ryzom/client/src/interface_v3/group_quick_help.cpp b/ryzom/client/src/interface_v3/group_quick_help.cpp index 8a5e925cf..c8d5fdd9b 100644 --- a/ryzom/client/src/interface_v3/group_quick_help.cpp +++ b/ryzom/client/src/interface_v3/group_quick_help.cpp @@ -168,8 +168,8 @@ void CGroupQuickHelp::setGroupTextSize (CInterfaceGroup *group, bool selected) { bool globalColor = selected ? TextColorGlobalColor : _NonSelectedGlobalColor; bool linkGlobalColor = selected ? LinkColorGlobalColor : _NonSelectedGlobalColor; - uint fontSize = selected ? TextFontSize : _NonSelectedSize; - NLMISC::CRGBA color = selected ? TextColor : _NonSelectedColor; + uint fontSize = selected ? _BrowserStyle.Current.FontSize : _NonSelectedSize; + NLMISC::CRGBA color = selected ? _BrowserStyle.Current.TextColor : _NonSelectedColor; NLMISC::CRGBA linkColor = selected ? LinkColor : _NonSelectedLinkColor; // Look for text in this group From f8d498e4b25e44921dfee99656356b68336994f4 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 3 May 2021 13:10:42 +0300 Subject: [PATCH 02/13] Minor refactor --- nel/include/nel/gui/group_html.h | 4 +++ nel/src/gui/group_html.cpp | 50 ++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index a16a16d82..351c232d2 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -36,6 +36,7 @@ typedef void CURLM; namespace NLGUI { + class CViewLink; class CCtrlButton; class CCtrlTextButton; class CCtrlScroll; @@ -301,6 +302,9 @@ namespace NLGUI // Translate a char bool translateChar(u32char &output, u32char input, u32char lastChar) const; + // return true if text has same style + bool isSameStyle(CViewLink *text, const CStyleParams &style) const; + // Add a string in the current paragraph void addString(const std::string &str); diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 9939b4794..b649693cd 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -2359,6 +2359,34 @@ namespace NLGUI } } + // *************************************************************************** + bool CGroupHTML::isSameStyle(CViewLink *text, const CStyleParams &style) const + { + if (!text) return false; + + bool embolden = style.FontWeight >= FONT_WEIGHT_BOLD; + bool sameShadow = style.TextShadow.Enabled && text->getShadow(); + if (sameShadow && style.TextShadow.Enabled) + { + sint sx, sy; + text->getShadowOffset(sx, sy); + sameShadow = (style.TextShadow.Color == text->getShadowColor()); + sameShadow = sameShadow && (style.TextShadow.Outline == text->getShadowOutline()); + sameShadow = sameShadow && (style.TextShadow.X == sx) && (style.TextShadow.Y == sy); + } + // Compatible with current parameters ? + return sameShadow && + (style.TextColor == text->getColor()) && + (style.FontFamily == text->getFontName()) && + (style.FontSize == (uint)text->getFontSize()) && + (style.Underlined == text->getUnderlined()) && + (style.StrikeThrough == text->getStrikeThrough()) && + (embolden == text->getEmbolden()) && + (style.FontOblique == text->getOblique()) && + (getLink() == text->Link) && + (style.GlobalColor == text->getModulateGlobalColor()); + } + // *************************************************************************** void CGroupHTML::addString(const std::string &str) @@ -2433,32 +2461,12 @@ namespace NLGUI // Text added ? bool added = false; - bool embolden = style.FontWeight >= FONT_WEIGHT_BOLD; // Number of child in this paragraph if (_CurrentViewLink) { bool skipLine = !_CurrentViewLink->getText().empty() && *(_CurrentViewLink->getText().rbegin()) == '\n'; - bool sameShadow = style.TextShadow.Enabled && _CurrentViewLink->getShadow(); - if (sameShadow && style.TextShadow.Enabled) - { - sint sx, sy; - _CurrentViewLink->getShadowOffset(sx, sy); - sameShadow = (style.TextShadow.Color == _CurrentViewLink->getShadowColor()); - sameShadow = sameShadow && (style.TextShadow.Outline == _CurrentViewLink->getShadowOutline()); - sameShadow = sameShadow && (style.TextShadow.X == sx) && (style.TextShadow.Y == sy); - } - // Compatible with current parameters ? - if (!skipLine && sameShadow && - (style.TextColor == _CurrentViewLink->getColor()) && - (style.FontFamily == _CurrentViewLink->getFontName()) && - (style.FontSize == (uint)_CurrentViewLink->getFontSize()) && - (style.Underlined == _CurrentViewLink->getUnderlined()) && - (style.StrikeThrough == _CurrentViewLink->getStrikeThrough()) && - (embolden == _CurrentViewLink->getEmbolden()) && - (style.FontOblique == _CurrentViewLink->getOblique()) && - (getLink() == _CurrentViewLink->Link) && - (style.GlobalColor == _CurrentViewLink->getModulateGlobalColor())) + if (!skipLine && isSameStyle(_CurrentViewLink, style)) { // Concat the text _CurrentViewLink->setText(_CurrentViewLink->getText()+tmpStr); From 624d78fe1af7ba07904e65792b2629719b61debc Mon Sep 17 00:00:00 2001 From: Nimetu Date: Tue, 4 May 2021 12:26:32 +0300 Subject: [PATCH 03/13] Methods to serialize CHtmlElement back to string --- nel/include/nel/gui/html_element.h | 12 ++++ nel/src/gui/html_element.cpp | 98 ++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/nel/include/nel/gui/html_element.h b/nel/include/nel/gui/html_element.h index 22f037cd4..d96b00508 100644 --- a/nel/include/nel/gui/html_element.h +++ b/nel/include/nel/gui/html_element.h @@ -75,6 +75,18 @@ namespace NLGUI // update Children index/parent/next/prevSibling pointers void reindexChilds(); + // escape text tag or attribute value + std::string htmlEscape(std::string val, bool isAttribute = false) const; + + // serialize element attributes as string + std::string serializeAttributes() const; + + // serialize child elements as html string + std::string serializeChilds() const; + + // serialize itself and children as html string + std::string serialize() const; + // debug std::string toString(bool tree = false, uint depth = 0) const; diff --git a/nel/src/gui/html_element.cpp b/nel/src/gui/html_element.cpp index 8735cc56e..454833a5a 100644 --- a/nel/src/gui/html_element.cpp +++ b/nel/src/gui/html_element.cpp @@ -18,6 +18,7 @@ #include "stdpch.h" #include "nel/gui/html_element.h" +#include "nel/gui/libwww.h" using namespace std; using namespace NLMISC; @@ -137,6 +138,103 @@ namespace NLGUI return ""; } + // *************************************************************************** + std::string CHtmlElement::htmlEscape(std::string val, bool isAttribute) const + { + static const std::vector searchReplace = { + "&", "&", + "<", "<", + ">", ">", + "\xA0", " ", + }; + + for(uint i = 0; i < searchReplace.size(); i+=2) + val = strFindReplaceAll(val, searchReplace[i], searchReplace[i+1]); + + if (isAttribute) + { + static const std::string q = "\""; + static const std::string quot = """; + val = strFindReplaceAll(val, q, quot); + } + + return val; + } + + // *************************************************************************** + std::string CHtmlElement::serializeAttributes() const + { + std::string result; + for(std::map::const_iterator it = Attributes.begin(); it != Attributes.end(); ++it) + { + if (it->first == "class") + { + result += " class=\""; + for(std::set::const_iterator it2 = ClassNames.begin(); it2 != ClassNames.end(); ++it2) + { + if (it2 != ClassNames.begin()) + { + result += " "; + } + result += htmlEscape(*it2, true); + } + result += "\""; + } + else + { + result += " " + it->first + "=\"" + htmlEscape(it->second, true) + "\""; + } + } + return result; + } + + // *************************************************************************** + std::string CHtmlElement::serializeChilds() const + { + std::string result; + for(std::list::const_iterator it = Children.begin(); it != Children.end(); ++it) + result += it->serialize(); + + return result; + } + + // *************************************************************************** + std::string CHtmlElement::serialize() const + { + if (Type == TEXT_NODE) + { + if (parent && (parent->ID == HTML_SCRIPT || parent->ID == HTML_STYLE || + parent->ID == HTML_IFRAME || parent->ID == HTML_NOEMBED || + parent->ID == HTML_NOSCRIPT)) + { + return Value; + } else { + return htmlEscape(Value); + } + } + + std::string result = "<" + Value + serializeAttributes() + ">"; + + if (ID == HTML_AREA || ID == HTML_BASE || ID == HTML_BR || + ID == HTML_COL || ID == HTML_EMBED || ID == HTML_HR || + ID == HTML_IMG || ID == HTML_INPUT || ID == HTML_LINK || + ID == HTML_META || ID == HTML_PARAM || ID == HTML_WBR) + { + return result; + } + + // first linebreak that will be ignored on parse time + if (ID == HTML_PRE || ID == HTML_TEXTAREA) + result += "\n"; + + if (!Children.empty()) + result += serializeChilds(); + + result += ""; + + return result; + } + // *************************************************************************** std::string CHtmlElement::toString(bool tree, uint depth) const { From aaa699014eb746896fd5a9977986cf4ac4d17b36 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Tue, 4 May 2021 12:28:31 +0300 Subject: [PATCH 04/13] Ignore any tags inside title, textarea elements. --- nel/include/nel/gui/group_html.h | 4 --- nel/src/gui/group_html.cpp | 60 ++++++++++---------------------- 2 files changed, 19 insertions(+), 45 deletions(-) diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 351c232d2..26eb7d83a 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -730,9 +730,7 @@ namespace NLGUI bool _Localize; // Current node is a text area - bool _TextArea; std::string _TextAreaTemplate; - std::string _TextAreaContent; std::string _TextAreaName; uint _TextAreaRow; uint _TextAreaCols; @@ -983,11 +981,9 @@ namespace NLGUI void htmlTD(const CHtmlElement &elm); void htmlTDend(const CHtmlElement &elm); void htmlTEXTAREA(const CHtmlElement &elm); - void htmlTEXTAREAend(const CHtmlElement &elm); void htmlTH(const CHtmlElement &elm); void htmlTHend(const CHtmlElement &elm); void htmlTITLE(const CHtmlElement &elm); - void htmlTITLEend(const CHtmlElement &elm); void htmlTR(const CHtmlElement &elm); void htmlTRend(const CHtmlElement &elm); //void htmlU(const CHtmlElement &elm); diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index b649693cd..179232566 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -1231,10 +1231,10 @@ namespace NLGUI case HTML_TABLE: htmlTABLEend(elm); break; case HTML_TD: htmlTDend(elm); break; case HTML_TBODY: renderPseudoElement(":after", elm); break; - case HTML_TEXTAREA: htmlTEXTAREAend(elm); break; + case HTML_TEXTAREA: break; case HTML_TFOOT: renderPseudoElement(":after", elm); break; case HTML_TH: htmlTHend(elm); break; - case HTML_TITLE: htmlTITLEend(elm); break; + case HTML_TITLE: break; case HTML_TR: htmlTRend(elm); break; case HTML_U: renderPseudoElement(":after", elm); break; case HTML_UL: htmlULend(elm); break; @@ -1396,9 +1396,9 @@ namespace NLGUI { beginElement(elm); - std::list::iterator it = elm.Children.begin(); if (!_IgnoreChildElements) { + std::list::iterator it = elm.Children.begin(); while(it != elm.Children.end()) { renderDOM(*it); @@ -2426,15 +2426,7 @@ namespace NLGUI } // In title ? - if (_Title) - { - _TitleString += tmpStr; - } - else if (_TextArea) - { - _TextAreaContent += tmpStr; - } - else if (_Object) + if (_Object) { _ObjectScript += tmpStr; } @@ -2899,8 +2891,6 @@ namespace NLGUI _Anchors.clear(); _AnchorName.clear(); _CellParams.clear(); - _Title = false; - _TextArea = false; _Object = false; _Localize = false; _ReadingHeadTag = false; @@ -3036,12 +3026,10 @@ namespace NLGUI void CGroupHTML::setTitle(const std::string &title) { - _TitleString.clear(); - if(!_TitlePrefix.empty()) - { - _TitleString = _TitlePrefix + " - "; - } - _TitleString += title; + if(_TitlePrefix.empty()) + _TitleString = title; + else + _TitleString = _TitlePrefix + " - " + title; setContainerTitle(_TitleString); } @@ -6601,6 +6589,9 @@ namespace NLGUI // *************************************************************************** void CGroupHTML::htmlTEXTAREA(const CHtmlElement &elm) { + _IgnoreChildElements = true; + + // TODO: allow textarea without form if (_Forms.empty()) return; @@ -6615,7 +6606,6 @@ namespace NLGUI _TextAreaName.clear(); _TextAreaRow = 1; _TextAreaCols = 10; - _TextAreaContent.clear(); _TextAreaMaxLength = 1024; if (elm.hasNonEmptyAttribute("name")) _TextAreaName = elm.getAttribute("name"); @@ -6627,16 +6617,11 @@ namespace NLGUI fromString(elm.getAttribute("maxlength"), _TextAreaMaxLength); _TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup; - _TextArea = true; - _PRE.push_back(true); - } - void CGroupHTML::htmlTEXTAREAend(const CHtmlElement &elm) - { - if (_Forms.empty()) - return; + std::string content = strFindReplaceAll(elm.serializeChilds(), std::string("\t"), std::string(" ")); + content = strFindReplaceAll(content, std::string("\n"), std::string(" ")); - CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent, _TextAreaMaxLength); + CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, content, _TextAreaMaxLength); if (textArea) { // Add the text area to the form @@ -6645,9 +6630,6 @@ namespace NLGUI entry.TextArea = textArea; _Forms.back().Entries.push_back (entry); } - - _TextArea = false; - popIfNotEmpty (_PRE); } // *************************************************************************** @@ -6664,18 +6646,14 @@ namespace NLGUI // *************************************************************************** void CGroupHTML::htmlTITLE(const CHtmlElement &elm) { + _IgnoreChildElements = true; + // TODO: only from // if (!_ReadingHeadTag) return; - if(!_TitlePrefix.empty()) - _TitleString = _TitlePrefix + " - "; - else - _TitleString.clear(); - _Title = true; - } - void CGroupHTML::htmlTITLEend(const CHtmlElement &elm) - { - _Title = false; + // consume all child elements + _TitleString = strFindReplaceAll(elm.serializeChilds(), std::string("\t"), std::string(" ")); + _TitleString = strFindReplaceAll(_TitleString, std::string("\n"), std::string(" ")); setTitle(_TitleString); } From acd12c7c37f8deb35c847f0395f955dba008f242 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Tue, 4 May 2021 21:45:47 +0300 Subject: [PATCH 05/13] Add initial support for centered multiline text in table --- nel/include/nel/gui/group_paragraph.h | 7 +++++++ nel/src/gui/group_html.cpp | 16 ++++++++++++++++ nel/src/gui/group_paragraph.cpp | 11 +++++++++++ 3 files changed, 34 insertions(+) diff --git a/nel/include/nel/gui/group_paragraph.h b/nel/include/nel/gui/group_paragraph.h index 20bc50585..b05d4e12e 100644 --- a/nel/include/nel/gui/group_paragraph.h +++ b/nel/include/nel/gui/group_paragraph.h @@ -55,6 +55,8 @@ namespace NLGUI Right }; + enum TTextAlign { AlignLeft = 0, AlignCenter, AlignRight, AlignJustify }; + ///constructor CGroupParagraph(const TCtorParam ¶m); @@ -98,6 +100,8 @@ namespace NLGUI // the same, but with id taken from the database void addTextChildID (const std::string &dbPath, bool multiLine = true); + void setTextAlign(const TTextAlign align) { _TextAlign = align; } + protected: void delChild (CViewBase* child); @@ -271,6 +275,9 @@ namespace NLGUI // (the element drawn are stored in _views, _contrlos or _childrengroups of cinterfacegroup std::vector _Elements; + // Horizontal align for elements + TTextAlign _TextAlign; + // Last parent width sint32 _LastW; diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 179232566..a95914ef6 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -2158,6 +2158,17 @@ namespace NLGUI newParagraph->setResizeFromChildH(true); newParagraph->setMarginLeft(getIndent()); + if (!_Style.Current.TextAlign.empty()) + { + if (_Style.Current.TextAlign == "left") + newParagraph->setTextAlign(CGroupParagraph::AlignLeft); + else if (_Style.Current.TextAlign == "center") + newParagraph->setTextAlign(CGroupParagraph::AlignCenter); + else if (_Style.Current.TextAlign == "right") + newParagraph->setTextAlign(CGroupParagraph::AlignRight); + else if (_Style.Current.TextAlign == "justify") + newParagraph->setTextAlign(CGroupParagraph::AlignJustify); + } // Add to the group addHtmlGroup (newParagraph, beginSpace); @@ -4986,6 +4997,11 @@ namespace NLGUI cellParams.Align = CGroupCell::Center; else if (align == "right") cellParams.Align = CGroupCell::Right; + else if (align != "justify") + align.clear(); + + // copy td align (can be empty) attribute back into css + _Style.Current.TextAlign = align; } { diff --git a/nel/src/gui/group_paragraph.cpp b/nel/src/gui/group_paragraph.cpp index 4ca13c8ae..623975b98 100644 --- a/nel/src/gui/group_paragraph.cpp +++ b/nel/src/gui/group_paragraph.cpp @@ -65,6 +65,7 @@ namespace NLGUI _Indent = 0; _FirstViewIndentView = false; _TextId = 0; + _TextAlign = AlignLeft; } // ---------------------------------------------------------------------------- @@ -713,6 +714,10 @@ namespace NLGUI CViewText *viewText = dynamic_cast(_Elements[i].Element); if (viewText) { + // FIXME: this does not work with multiple view text on same line + if (_TextAlign == AlignCenter && elmCount == 1) + viewText->setTextMode(CViewText::Centered); + viewText->setFirstLineX(x + ((i==0)?_FirstViewIndentView:0)); viewText->setX(0); viewText->updateTextContext(); @@ -730,6 +735,12 @@ namespace NLGUI // Does we balance the last line height ? if (viewText) { + if (_TextAlign == AlignCenter && elmCount == 1) + { + sint pad = width - viewText->getWReal(); + viewText->setX(pad/2); + } + changeLine = viewText->getNumLine() > 1; if (!viewText->getText().empty() && *(viewText->getText().rbegin()) == '\n') { From 825d70a80ec88792d8b7e4854c76d2583c17ca3a Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 7 May 2021 13:26:33 +0300 Subject: [PATCH 06/13] Minor refactor --- nel/include/nel/gui/group_html.h | 3 + nel/src/gui/group_html.cpp | 153 ++++++++++++++++--------------- 2 files changed, 84 insertions(+), 72 deletions(-) diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 26eb7d83a..90a51ea68 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -304,6 +304,9 @@ namespace NLGUI // return true if text has same style bool isSameStyle(CViewLink *text, const CStyleParams &style) const; + // add text link using template + void newTextButton(const std::string &text, const std::string &tpl); + void newTextLink(const std::string &text); // Add a string in the current paragraph void addString(const std::string &str); diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index a95914ef6..8a0073245 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -2398,6 +2398,85 @@ namespace NLGUI (style.GlobalColor == text->getModulateGlobalColor()); } + // *************************************************************************** + void CGroupHTML::newTextButton(const std::string &text, const std::string &tpl) + { + _CurrentViewLink = NULL; + _CurrentViewImage = NULL; + + // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" + string param = "name=" + this->_Id + "|url=" + getLink(); + string name; + if (!_AnchorName.empty()) + name = _AnchorName.back(); + + typedef pair TTmplParam; + vector tmplParams; + tmplParams.push_back(TTmplParam("id", "")); + tmplParams.push_back(TTmplParam("onclick", "browse")); + tmplParams.push_back(TTmplParam("onclick_param", param)); + tmplParams.push_back(TTmplParam("active", "true")); + CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(tpl, getId()+":"+name, tmplParams); + if (!buttonGroup) + { + nlinfo("Text button template '%s' not found", tpl.c_str()); + return; + } + buttonGroup->setId(getId()+":"+name); + + // Add the ctrl button + CCtrlTextButton *ctrlButton = dynamic_cast(buttonGroup->getCtrl("button")); + if (!ctrlButton) ctrlButton = dynamic_cast(buttonGroup->getCtrl("b")); + if (!ctrlButton) + { + nlinfo("Text button template '%s' is missing :button or :b text element", tpl.c_str()); + return; + } + ctrlButton->setModulateGlobalColorAll(false); + + // Translate the tooltip + ctrlButton->setText(text); + ctrlButton->setDefaultContextHelp(std::string(getLinkTitle())); + // empty url / button disabled + ctrlButton->setFrozen(*getLink() == '\0'); + + setTextButtonStyle(ctrlButton, _Style.Current); + + _Paragraph->addChild(buttonGroup); + } + + // *************************************************************************** + void CGroupHTML::newTextLink(const std::string &text) + { + CViewLink *newLink = new CViewLink(CViewBase::TCtorParam()); + if (getA()) + { + newLink->Link = getLink(); + newLink->LinkTitle = getLinkTitle(); + if (!newLink->Link.empty()) + { + newLink->setHTMLView (this); + newLink->setActionOnLeftClick("browse"); + newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link); + } + } + newLink->setText(text); + newLink->setMultiLineSpace((uint)((float)(_Style.Current.FontSize)*LineSpaceFontFactor)); + newLink->setMultiLine(true); + newLink->setModulateGlobalColor(_Style.Current.GlobalColor); + setTextStyle(newLink, _Style.Current); + + registerAnchor(newLink); + + if (getA() && !newLink->Link.empty()) + getParagraph()->addChildLink(newLink); + else + getParagraph()->addChild(newLink); + + _CurrentViewLink = newLink; + _CurrentViewImage = NULL; + } + // *************************************************************************** void CGroupHTML::addString(const std::string &str) @@ -2465,7 +2544,6 @@ namespace NLGUI // Text added ? bool added = false; - // Number of child in this paragraph if (_CurrentViewLink) { bool skipLine = !_CurrentViewLink->getText().empty() && *(_CurrentViewLink->getText().rbegin()) == '\n'; @@ -2482,78 +2560,9 @@ namespace NLGUI if (!added) { if (getA() && string(getLinkClass()) == "ryzom-ui-button") - { - string buttonTemplate = DefaultButtonGroup; - // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" - string param = "name=" + this->_Id + "|url=" + getLink(); - string name; - if (!_AnchorName.empty()) - name = _AnchorName.back(); - typedef pair TTmplParam; - vector tmplParams; - tmplParams.push_back(TTmplParam("id", "")); - tmplParams.push_back(TTmplParam("onclick", "browse")); - tmplParams.push_back(TTmplParam("onclick_param", param)); - tmplParams.push_back(TTmplParam("active", "true")); - CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(buttonTemplate, getId()+":"+name, tmplParams); - if (buttonGroup) - { - buttonGroup->setId(getId()+":"+name); - // Add the ctrl button - CCtrlTextButton *ctrlButton = dynamic_cast(buttonGroup->getCtrl("button")); - if (!ctrlButton) ctrlButton = dynamic_cast(buttonGroup->getCtrl("b")); - if (ctrlButton) - { - ctrlButton->setModulateGlobalColorAll (false); - - // Translate the tooltip - ctrlButton->setDefaultContextHelp(getLinkTitle()); - ctrlButton->setText(tmpStr); - // empty url / button disabled - bool disabled = string(getLink()).empty(); - ctrlButton->setFrozen(disabled); - - setTextButtonStyle(ctrlButton, style); - } - getParagraph()->addChild (buttonGroup); - paragraphChange (); - } - - } + newTextButton(tmpStr, DefaultButtonGroup); else - { - CViewLink *newLink = new CViewLink(CViewBase::TCtorParam()); - if (getA()) - { - newLink->Link = getLink(); - newLink->LinkTitle = getLinkTitle(); - if (!newLink->Link.empty()) - { - newLink->setHTMLView (this); - - newLink->setActionOnLeftClick("browse"); - newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link); - } - } - newLink->setText(tmpStr); - newLink->setMultiLineSpace((uint)((float)(style.FontSize)*LineSpaceFontFactor)); - newLink->setMultiLine(true); - newLink->setModulateGlobalColor(style.GlobalColor); - setTextStyle(newLink, style); - // newLink->setLineAtBottom (true); - - registerAnchor(newLink); - - if (getA() && !newLink->Link.empty()) - { - getParagraph()->addChildLink(newLink); - } - else - { - getParagraph()->addChild(newLink); - } - paragraphChange (); - } + newTextLink(tmpStr); } } } From a7bc98b0b469ba1273fe60163f2c8a7a9779e976 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 19 May 2021 20:17:48 +0300 Subject: [PATCH 07/13] Fix mission give item window sometimes not appearing. --- ryzom/client/src/user_entity.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/ryzom/client/src/user_entity.cpp b/ryzom/client/src/user_entity.cpp index dce3191dd..2ed7355b0 100644 --- a/ryzom/client/src/user_entity.cpp +++ b/ryzom/client/src/user_entity.cpp @@ -2670,17 +2670,6 @@ void CUserEntity::selection(const CLFECOMMON::TCLEntityId &slot) // virtual { playerGiftNeeded->setValue32(0); } - // - missionOption = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:TITLE", (int) k), false); - if (missionOption) - { - missionOption->setValue32(0); - } - playerGiftNeeded = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:PLAYER_GIFT_NEEDED", (int) k), false); - if (playerGiftNeeded) - { - playerGiftNeeded->setValue32(0); - } } /* TODO ULU : Add RP tags */ From 5abdccfd6362073e78b732487ff3fe43fba20428 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 20 May 2021 08:49:31 +0300 Subject: [PATCH 08/13] Inherit -ryzom-modulate-bgcolor in table/td --- nel/src/gui/group_html.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 8a0073245..e9505abdc 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -6423,10 +6423,12 @@ namespace NLGUI string image = _Style.getStyle("background-image"); addImageDownload(image, table, CStyleParams(), NormalImage, ""); } + else + { + // will be set in addImageDownload if background-image exists + table->setModulateGlobalColor(_Style.Current.GlobalColor); + } - // setting ModulateGlobalColor must be after addImageDownload - if (_Style.checkStyle("-ryzom-modulate-bgcolor", "true")) - table->setModulateGlobalColor(true); table->setMarginLeft(getIndent()); addHtmlGroup (table, 0); @@ -6510,6 +6512,11 @@ namespace NLGUI string image = _Style.getStyle("background-image"); addImageDownload(image, _Cells.back(), CStyleParams(), NormalImage, ""); } + else + { + // will be set in addImageDownload if background-image is set + _Cells.back()->setModulateGlobalColor(_Style.Current.GlobalColor); + } if (elm.hasNonEmptyAttribute("colspan")) fromString(elm.getAttribute("colspan"), _Cells.back()->ColSpan); @@ -6546,10 +6553,6 @@ namespace NLGUI _Cells.back()->NewLine = getTR(); - // setting ModulateGlobalColor must be after addImageDownload - if (_Style.checkStyle("-ryzom-modulate-bgcolor", "true")) - _Cells.back()->setModulateGlobalColor(true); - // border from if (table->CellBorder) { From 1e465b6cff2080cd17edf05a6b25b203f85d4f75 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 15 Feb 2021 13:25:37 +0200 Subject: [PATCH 09/13] Show reload link when curl fails to open connection to website --- nel/include/nel/gui/group_html.h | 3 +++ nel/src/gui/group_html.cpp | 28 +++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 90a51ea68..b37d80272 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -118,6 +118,9 @@ namespace NLGUI // Browse error void browseError (const char *msg); + // Error message with html content + void browseErrorHtml(const std::string &html); + bool isBrowsing(); // Update coords diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index e9505abdc..eb75c1481 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -2262,6 +2262,17 @@ namespace NLGUI invalidateCoords(); } + void CGroupHTML::browseErrorHtml(const std::string &html) + { + releaseDownloads(); + removeContent(); + + renderHtmlString(html); + + updateRefreshButton(); + invalidateCoords(); + } + // *************************************************************************** bool CGroupHTML::isBrowsing() @@ -3586,11 +3597,22 @@ namespace NLGUI { if (!success) { + CUrlParser uri(_CurlWWW->Url); + + // potentially unwanted chars + std::string url = _CurlWWW->Url; + url = strFindReplaceAll(url, string("<"), string("%3C")); + url = strFindReplaceAll(url, string(">"), string("%3E")); + url = strFindReplaceAll(url, string("\""), string("%22")); + url = strFindReplaceAll(url, string("'"), string("%27")); + std::string err; - err = "Connection failed with cURL error: "; + err = "cURL error"; + err += "

Connection failed with cURL error

"; err += error; - err += "\nURL '" + _CurlWWW->Url + "'"; - browseError(err.c_str()); + err += "
(" + uri.scheme + "://" + uri.host + ") reload"; + err += ""; + browseErrorHtml(err); return; } From 474802810bb53e161ad5599ce5d8ae11cee2a2e3 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 20 May 2021 12:37:01 +0300 Subject: [PATCH 10/13] Fixed throw(type) deprecated in C++11 warning --- nel/include/nel/misc/streamed_package.h | 4 ++-- nel/src/misc/streamed_package.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nel/include/nel/misc/streamed_package.h b/nel/include/nel/misc/streamed_package.h index 82a138482..093f87a30 100644 --- a/nel/include/nel/misc/streamed_package.h +++ b/nel/include/nel/misc/streamed_package.h @@ -32,7 +32,7 @@ public: uint32 Size; uint32 LastModified; - void serial(NLMISC::IStream &f) throw(NLMISC::EStream); + void serial(NLMISC::IStream &f); }; @@ -40,7 +40,7 @@ public: CStreamedPackage(); ~CStreamedPackage(); - void serial(NLMISC::IStream &f) throw(NLMISC::EStream); + void serial(NLMISC::IStream &f); /// result: [out] ex. /00/00/000000000.. /// hash: [in] diff --git a/nel/src/misc/streamed_package.cpp b/nel/src/misc/streamed_package.cpp index 28e2db956..ad013cccf 100644 --- a/nel/src/misc/streamed_package.cpp +++ b/nel/src/misc/streamed_package.cpp @@ -32,7 +32,7 @@ CStreamedPackage::~CStreamedPackage() // release } -void CStreamedPackage::serial(NLMISC::IStream &f) throw(NLMISC::EStream) +void CStreamedPackage::serial(NLMISC::IStream &f) { f.serialCheck(NELID("SNPK")); @@ -42,7 +42,7 @@ void CStreamedPackage::serial(NLMISC::IStream &f) throw(NLMISC::EStream) f.serialCont(Entries); } -void CStreamedPackage::CEntry::serial(NLMISC::IStream &f) throw(NLMISC::EStream) +void CStreamedPackage::CEntry::serial(NLMISC::IStream &f) { uint version = 1; f.serialVersion(version); From 3b91146d230cef081d4c111f070b9c4ed8c9e528 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 25 Jun 2020 14:44:45 +0300 Subject: [PATCH 11/13] Changed: Allow to use 2x/4x hi-res texture atlas for GUI elements --- nel/include/nel/gui/view_renderer.h | 4 ++++ nel/src/gui/view_renderer.cpp | 26 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/nel/include/nel/gui/view_renderer.h b/nel/include/nel/gui/view_renderer.h index aefbb315f..4498a436a 100644 --- a/nel/include/nel/gui/view_renderer.h +++ b/nel/include/nel/gui/view_renderer.h @@ -444,9 +444,13 @@ namespace NLGUI SGlobalTexture () { FromGlobaleTexture = true; + Scale = 1.f; } uint32 Width, Height; uint32 DefaultWidth, DefaultHeight; + // used by texture atlas to unscale individual texture + // getTextureSizeFromId() calls to return 1x size for GUI. + float Scale; NL3D::UTexture *Texture; std::string Name; bool FromGlobaleTexture; diff --git a/nel/src/gui/view_renderer.cpp b/nel/src/gui/view_renderer.cpp index 66aea4cfb..76e064dfd 100644 --- a/nel/src/gui/view_renderer.cpp +++ b/nel/src/gui/view_renderer.cpp @@ -622,9 +622,7 @@ namespace NLGUI return; sint32 txw, txh; - SImage &rImage = *getSImage(nTxId); - txw = (sint32)((rImage.UVMax.U - rImage.UVMin.U)*rImage.GlobalTexturePtr->Width+0.5f); - txh = (sint32)((rImage.UVMax.V - rImage.UVMin.V)*rImage.GlobalTexturePtr->Height+0.5f); + getTextureSizeFromId(nTxId, txw, txh); drawRotFlipBitmap (layerId, x, y, txw, txh, rot, flipv, nTxId, col); } @@ -860,6 +858,14 @@ namespace NLGUI CIFile ifTmp; if (ifTmp.open(filename)) CBitmap::loadSize (ifTmp, gt.Width, gt.Height); + + // extract textures scale from filename + // texture_interface_v3_2x.tga / texture_interface_v3_4x.tga + if (textureFileName.find("_2x.") != std::string::npos) + gt.Scale = 2.f; + else if (textureFileName.find("_4x.") != std::string::npos) + gt.Scale = 4.f; + gt.Texture = driver->createTextureFile (filename); // Force to generate the texture now. This way we can extract the mouse bitmaps from it now without having to load it again. // Its why we don't release it at the end, because it is likely to be uploaded soon) @@ -934,6 +940,10 @@ namespace NLGUI CBitmap curs; curs.resize(x1 - x0, y1 - y0); curs.blit(*texDatas, x0, y0, (x1 - x0), (y1 - y0), 0, 0); + // TODO: scaled cursors not supported + if (gt.Scale > 1.f) { + curs.resample((sint)(curs.getWidth() / gt.Scale), (sint)(curs.getHeight() / gt.Scale)); + } driver->addCursor(image.Name, curs); } } @@ -1359,8 +1369,8 @@ namespace NLGUI else { SImage &rImage = *getSImage(id); - width = (sint32)((rImage.UVMax.U - rImage.UVMin.U)*rImage.GlobalTexturePtr->Width+0.5f); - height = (sint32)((rImage.UVMax.V - rImage.UVMin.V)*rImage.GlobalTexturePtr->Height+0.5f); + width = (sint32)(((rImage.UVMax.U - rImage.UVMin.U)*rImage.GlobalTexturePtr->Width / rImage.GlobalTexturePtr->Scale)+0.5f); + height = (sint32)(((rImage.UVMax.V - rImage.UVMin.V)*rImage.GlobalTexturePtr->Height / rImage.GlobalTexturePtr->Scale)+0.5f); } } /* @@ -1375,9 +1385,11 @@ namespace NLGUI SImage &rImage = *getSImage(id); SGlobalTexture &rGT = *rImage.GlobalTexturePtr; + // get (possibly) scaled width/height sint32 width, height; - width = (sint32)((rImage.UVMax.U - rImage.UVMin.U)*rGT.Width+0.5f); - height = (sint32)((rImage.UVMax.V - rImage.UVMin.V)*rGT.Height+0.5f); + getTextureSizeFromId(id, width, height); + if (width == 0 || height == 0) + return CRGBA(255,255,255); float xRatio = ((float)x) / ((float)(width)); float yRatio = ((float)y) / ((float)(height)); UTexture *pTF = rGT.Texture; From 52e0e71c4a968a1447395e615a1ee2078c1c7f7c Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 20 May 2021 13:27:36 +0300 Subject: [PATCH 12/13] Simple html/css test tool --- nel/tools/CMakeLists.txt | 5 + nel/tools/htmlcss_test/CMakeLists.txt | 15 ++ nel/tools/htmlcss_test/htmlcss_test.cpp | 183 ++++++++++++++++++ .../htmlcss_test/tests/01-syntax-tests.html | 28 +++ .../tests/css-tricks/01-var-toggle.html | 24 +++ .../tests/custom-properties/e01.basic.html | 18 ++ .../e02.case-sensitive-name.html | 23 +++ .../custom-properties/e03.value-syntax.html | 17 ++ .../custom-properties/e05.inherited.html | 17 ++ .../tests/custom-properties/e06.i18n.html | 15 ++ .../e07-safe-use-not-cyclic.html | 15 ++ .../tests/custom-properties/e08-cyclic.html | 14 ++ .../custom-properties/e09-not-cyclic.html | 15 ++ .../tests/custom-properties/e10.fallback.html | 24 +++ .../e11.1.invalid-property-name.html | 12 ++ .../e11.2.whitespace-after-var.html | 13 ++ .../e13.invalid-variables.html | 13 ++ 17 files changed, 451 insertions(+) create mode 100644 nel/tools/htmlcss_test/CMakeLists.txt create mode 100644 nel/tools/htmlcss_test/htmlcss_test.cpp create mode 100644 nel/tools/htmlcss_test/tests/01-syntax-tests.html create mode 100644 nel/tools/htmlcss_test/tests/css-tricks/01-var-toggle.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e01.basic.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e02.case-sensitive-name.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e03.value-syntax.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e05.inherited.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e06.i18n.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e07-safe-use-not-cyclic.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e08-cyclic.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e09-not-cyclic.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e10.fallback.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e11.1.invalid-property-name.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e11.2.whitespace-after-var.html create mode 100644 nel/tools/htmlcss_test/tests/custom-properties/e13.invalid-variables.html diff --git a/nel/tools/CMakeLists.txt b/nel/tools/CMakeLists.txt index 5297f34a4..079ded560 100644 --- a/nel/tools/CMakeLists.txt +++ b/nel/tools/CMakeLists.txt @@ -37,3 +37,8 @@ ENDIF() IF(WITH_NEL_TESTS) ADD_SUBDIRECTORY(nel_unit_test) ENDIF() + +IF(WITH_HTMLCSS_TEST) + ADD_SUBDIRECTORY(htmlcss_test) +ENDIF() + diff --git a/nel/tools/htmlcss_test/CMakeLists.txt b/nel/tools/htmlcss_test/CMakeLists.txt new file mode 100644 index 000000000..d37498f60 --- /dev/null +++ b/nel/tools/htmlcss_test/CMakeLists.txt @@ -0,0 +1,15 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.1) +CMAKE_POLICY(SET CMP0015 NEW) + +LINK_DIRECTORIES(${LINK_DIRECTORIES} ${CMAKE_LIBRARY_DIR}) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) + +FILE(GLOB SRC htmlcss_test.cpp) +ADD_EXECUTABLE(htmlcss_test ${SRC}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${LUA_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} ) +TARGET_LINK_LIBRARIES(htmlcss_test nelmisc nelgui ${LUA_LIBRARIES} ${LIBXML2_LIBRARIES}) +NL_DEFAULT_PROPS(htmlcss_test "Ryzom, Tests: html/css parser tests") +NL_ADD_RUNTIME_FLAGS(htmlcss_test) + +INSTALL(TARGETS htmlcss_test RUNTIME DESTINATION bin COMPONENT tools) +# TODO: test fixtures diff --git a/nel/tools/htmlcss_test/htmlcss_test.cpp b/nel/tools/htmlcss_test/htmlcss_test.cpp new file mode 100644 index 000000000..4e5b79843 --- /dev/null +++ b/nel/tools/htmlcss_test/htmlcss_test.cpp @@ -0,0 +1,183 @@ +/* + * File: main.cpp + * Author: Karu + * + * Created on 2015-04-11 + */ + +typedef struct _xmlNode xmlNode; + +#include +#include + +#include "nel/misc/types_nl.h" +#include "nel/misc/file.h" +#include "nel/misc/path.h" + +#include "nel/gui/html_parser.h" +#include "nel/gui/css_parser.h" +#include "nel/gui/html_element.h" +#include "nel/gui/css_style.h" + +#include "nel/gui/libwww.h" + +using namespace std; +using namespace NLMISC; +using namespace NLGUI; + +sint indent { 0 }; + +// *************************************************************************** +void checkRuleset(CHtmlElement &elm, CCssStyle &style, TStyleVec testset, bool exists) +{ + bool verbose = false; + std::string existsMessage = exists ? "exist" : "unset"; + for (auto it : testset) + { + bool failed = (exists != style.hasStyle(it.first)); + if (failed) + { + bool failed2 = true; + if (it.first == "font-size") + { + printf("[%s]: font-size: %d; expected '%s'\n", existsMessage.c_str(), style.Current.FontSize, it.second.c_str()); + printf(" (%s)\n", elm.toString().c_str()); + failed2 = false; + } + else if (it.first == "background-color") + { + printf("[%s]: background-color: '%s'; expected '%s'\n", existsMessage.c_str(), style.Current.BackgroundColor.toString().c_str(), it.second.c_str()); + printf(" (%s)\n", elm.toString().c_str()); + failed2 = false; + } + + if (failed2) + { + printf("[%s] FAIL: '%s': '%s'\n", existsMessage.c_str(), it.first.c_str(), it.second.c_str()); + printf(" (%s)\n", elm.toString().c_str()); + for (auto it2 : style.Current.StyleRules) + printf("'%s': '%s'\n", it2.first.c_str(), it2.second.c_str()); + } + } + else if (exists && !style.checkStyle(it.first, it.second)) + { + printf("[%s] FAIL: expecting '%s': '%s', got '%s'\n", existsMessage.c_str(), it.first.c_str(), it.second.c_str(), style.getStyle(it.first).c_str()); + printf(" (%s)\n", elm.toString().c_str()); + } + else if (!failed) + { + if (verbose) + printf("[%s] PASS: '%s': '%s'\n", existsMessage.c_str(), it.first.c_str(), it.second.c_str()); + } + } +} + +// *************************************************************************** +void recursiveHtmlRender(CHtmlElement &elm, CCssStyle &style) +{ + bool verbose = false; + if (elm.Type == CHtmlElement::TEXT_NODE) + { + std::string val = trim(elm.Value); + if (verbose) + if (!val.empty()) + printf("[%d] '%s'\n", indent, val.c_str()); + } + else if (elm.Type == CHtmlElement::ELEMENT_NODE) + { + style.pushStyle(); + + if (verbose) + printf("========= '%s'\n", elm.toString().c_str()); + + style.getStyleFor(elm); + style.applyStyle(elm.Style); + if (elm.hasAttribute("data-ruleset")) + { + TStyleVec testset = CCssParser::parseDecls(elm.getAttribute("data-ruleset")); + checkRuleset(elm, style, testset, true); + } + + if (elm.hasAttribute("data-ruleunset")) + { + TStyleVec testset = CCssParser::parseDecls(elm.getAttribute("data-ruleunset")); + checkRuleset(elm, style, testset, false); + } + + if (elm.hasAttribute("data-ruleset-before")) + { + TStyleVec testset = CCssParser::parseDecls(elm.getAttribute("data-ruleset-before")); + + } + + for (auto it = elm.Children.begin(); it != elm.Children.end(); ++it) + { + recursiveHtmlRender(*it, style); + } + + style.popStyle(); + } +} + +// *************************************************************************** +void runTestOnFile(const std::string &filename) +{ + CHtmlElement dom; + + CHtmlParser htmlParser; + + std::vector links; + std::vector styles; + //, elm, styles, links + + ifstream f(filename); + if (!f.is_open()) + { + printf("!! failed to open file '%s'\n", filename.c_str()); + return; + } + + printf(": %s\n", filename.c_str()); + std::string htmlString; + std::string line; + while (getline(f, line)) + htmlString += line; + + htmlParser.getDOM(htmlString, dom, styles, links); + + CCssStyle style; + for (std::string s : styles) + { + if (!s.empty()) + style.parseStylesheet(s); + } + + for (auto it = dom.Children.begin(); it != dom.Children.end(); ++it) + recursiveHtmlRender(*it, style); +} + +// *************************************************************************** +int main(int argc, const char *argv[]) +{ + CApplicationContext *appContext = new CApplicationContext; + + // htmlcss_test file.html + if (argc == 2) + { + runTestOnFile(argv[1]); + } + else + { + std::vector result; + CPath::getPathContent("tests/", true /*recursive*/, false /*wantDir*/, true /*wantFile*/, result, NULL /*callback*/, true /*showEverything*/); + printf(":: got %ld files\n", result.size()); + for (const auto &fname : result) + { + if (endsWith(fname, ".html") && fname != "tests/XX-template.html") + runTestOnFile(fname); + } + } + + printf(">>> all done\n"); + return EXIT_SUCCESS; +} diff --git a/nel/tools/htmlcss_test/tests/01-syntax-tests.html b/nel/tools/htmlcss_test/tests/01-syntax-tests.html new file mode 100644 index 000000000..f9b2c9356 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/01-syntax-tests.html @@ -0,0 +1,28 @@ + + + + +
+ + link + link + + + diff --git a/nel/tools/htmlcss_test/tests/css-tricks/01-var-toggle.html b/nel/tools/htmlcss_test/tests/css-tricks/01-var-toggle.html new file mode 100644 index 000000000..72e49b854 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/css-tricks/01-var-toggle.html @@ -0,0 +1,24 @@ + + + + +

+

+

+

+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e01.basic.html b/nel/tools/htmlcss_test/tests/custom-properties/e01.basic.html new file mode 100644 index 000000000..c5085b8ef --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e01.basic.html @@ -0,0 +1,18 @@ + + + + +
+

Header

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e02.case-sensitive-name.html b/nel/tools/htmlcss_test/tests/custom-properties/e02.case-sensitive-name.html new file mode 100644 index 000000000..1d9dc7b88 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e02.case-sensitive-name.html @@ -0,0 +1,23 @@ + + + + +
+

Header1

+

Header2

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e03.value-syntax.html b/nel/tools/htmlcss_test/tests/custom-properties/e03.value-syntax.html new file mode 100644 index 000000000..28f0a9c69 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e03.value-syntax.html @@ -0,0 +1,17 @@ + + + + +
+

Header

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e05.inherited.html b/nel/tools/htmlcss_test/tests/custom-properties/e05.inherited.html new file mode 100644 index 000000000..bafbbf37f --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e05.inherited.html @@ -0,0 +1,17 @@ + + + + +

I inherited blue from the root element!

+
I got green set directly on me!
+
+ While I got red set directly on me! +

I’m red too, because of inheritance!

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e06.i18n.html b/nel/tools/htmlcss_test/tests/custom-properties/e06.i18n.html new file mode 100644 index 000000000..861e60412 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e06.i18n.html @@ -0,0 +1,15 @@ + + + + + + link + + link + + + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e07-safe-use-not-cyclic.html b/nel/tools/htmlcss_test/tests/custom-properties/e07-safe-use-not-cyclic.html new file mode 100644 index 000000000..39ed3a299 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e07-safe-use-not-cyclic.html @@ -0,0 +1,15 @@ + + + + +
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e08-cyclic.html b/nel/tools/htmlcss_test/tests/custom-properties/e08-cyclic.html new file mode 100644 index 000000000..4d1f5fdd8 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e08-cyclic.html @@ -0,0 +1,14 @@ + + + + +
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e09-not-cyclic.html b/nel/tools/htmlcss_test/tests/custom-properties/e09-not-cyclic.html new file mode 100644 index 000000000..f3e1788ee --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e09-not-cyclic.html @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e10.fallback.html b/nel/tools/htmlcss_test/tests/custom-properties/e10.fallback.html new file mode 100644 index 000000000..5d785bffa --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e10.fallback.html @@ -0,0 +1,24 @@ + + + + +
+

header

+

text

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e11.1.invalid-property-name.html b/nel/tools/htmlcss_test/tests/custom-properties/e11.1.invalid-property-name.html new file mode 100644 index 000000000..488e733a9 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e11.1.invalid-property-name.html @@ -0,0 +1,12 @@ + + + + +
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e11.2.whitespace-after-var.html b/nel/tools/htmlcss_test/tests/custom-properties/e11.2.whitespace-after-var.html new file mode 100644 index 000000000..a67b4ba1d --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e11.2.whitespace-after-var.html @@ -0,0 +1,13 @@ + + + + + +
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e13.invalid-variables.html b/nel/tools/htmlcss_test/tests/custom-properties/e13.invalid-variables.html new file mode 100644 index 000000000..f60877d82 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e13.invalid-variables.html @@ -0,0 +1,13 @@ + + + + + + +
+ + From 96a03d1cf5a4a062af4551b010af1bca24f6f549 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 12 Mar 2020 18:17:33 +0200 Subject: [PATCH 13/13] Changed: Preserve icon text case as is --- ryzom/client/src/client_sheets/item_sheet.cpp | 1 - ryzom/client/src/client_sheets/outpost_building_sheet.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/ryzom/client/src/client_sheets/item_sheet.cpp b/ryzom/client/src/client_sheets/item_sheet.cpp index 5918ba73c..d5831167c 100644 --- a/ryzom/client/src/client_sheets/item_sheet.cpp +++ b/ryzom/client/src/client_sheets/item_sheet.cpp @@ -274,7 +274,6 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item) string IconText; if(!item.getValueByName (IconText, "3d.text overlay")) debug("key '3d.text overlay' not found."); - IconText = toLowerAscii(IconText); IdIconText = ClientSheetsStrings.add(IconText); // See if this item can be hiden when equipped diff --git a/ryzom/client/src/client_sheets/outpost_building_sheet.cpp b/ryzom/client/src/client_sheets/outpost_building_sheet.cpp index 42083c83f..0f741c1a2 100644 --- a/ryzom/client/src/client_sheets/outpost_building_sheet.cpp +++ b/ryzom/client/src/client_sheets/outpost_building_sheet.cpp @@ -131,7 +131,6 @@ void COutpostBuildingSheet::build(const NLGEORGES::UFormElm &root) string IconText; if(!root.getValueByName (IconText, "text overlay")) debug("key 'text overlay' not found."); - IconText = toLowerAscii(IconText); IdIconText = ClientSheetsStrings.add(IconText); }