From 84ff3391c3eab6978b7d8c6716b68b4044882ffa Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 11 Nov 2019 22:15:18 +0200 Subject: [PATCH] Fixed: Compiler warnings, issue #339 --HG-- branch : develop --- code/nel/include/nel/gui/css_style.h | 8 ++++---- code/nel/include/nel/gui/css_types.h | 16 +++++++++++++--- code/nel/src/gui/css_border_renderer.cpp | 18 +++++++++--------- code/nel/src/gui/css_style.cpp | 10 +++++----- code/nel/src/gui/group_html.cpp | 12 ++++++------ code/nel/src/gui/html_element.cpp | 4 ++-- 6 files changed, 39 insertions(+), 29 deletions(-) diff --git a/code/nel/include/nel/gui/css_style.h b/code/nel/include/nel/gui/css_style.h index d972940e1..5521818a4 100644 --- a/code/nel/include/nel/gui/css_style.h +++ b/code/nel/include/nel/gui/css_style.h @@ -66,8 +66,8 @@ namespace NLGUI MaxWidth=-1; MaxHeight=-1; // border style - BorderTopWidth = BorderRightWidth = BorderBottomWidth = BorderLeftWidth = CSSLineWidth::MEDIUM; - BorderTopStyle = BorderRightStyle = BorderBottomStyle = BorderLeftStyle = CSSLineStyle::NONE; + BorderTopWidth = BorderRightWidth = BorderBottomWidth = BorderLeftWidth = CSS_LINE_WIDTH_MEDIUM; + BorderTopStyle = BorderRightStyle = BorderBottomStyle = BorderLeftStyle = CSS_LINE_STYLE_NONE; BorderTopColor = BorderRightColor = BorderBottomColor = BorderLeftColor = NLMISC::CRGBA::Transparent; // background BackgroundColor=NLMISC::CRGBA::Black; @@ -215,8 +215,8 @@ namespace NLGUI Current.MaxWidth=-1; Current.MaxHeight=-1; - Current.BorderTopWidth = Current.BorderRightWidth = Current.BorderBottomWidth = Current.BorderLeftWidth = CSSLineWidth::MEDIUM; - Current.BorderTopStyle = Current.BorderRightStyle = Current.BorderBottomStyle = Current.BorderLeftStyle = CSSLineStyle::NONE; + Current.BorderTopWidth = Current.BorderRightWidth = Current.BorderBottomWidth = Current.BorderLeftWidth = CSS_LINE_WIDTH_MEDIUM; + Current.BorderTopStyle = Current.BorderRightStyle = Current.BorderBottomStyle = Current.BorderLeftStyle = CSS_LINE_STYLE_NONE; Current.BorderTopColor = Current.BorderRightColor = Current.BorderBottomColor = Current.BorderLeftColor = Current.TextColor; Current.PaddingTop = Current.PaddingRight = Current.PaddingBottom = Current.PaddingLeft = 0; diff --git a/code/nel/include/nel/gui/css_types.h b/code/nel/include/nel/gui/css_types.h index aa673a63e..9dd41de36 100644 --- a/code/nel/include/nel/gui/css_types.h +++ b/code/nel/include/nel/gui/css_types.h @@ -26,11 +26,21 @@ namespace NLGUI * \date 2019-09-03 10:50 GMT * \author Meelis Mägi (Nimetu) */ - // ie. border-style - enum CSSLineStyle { NONE = 0, HIDDEN, SOLID, INSET, OUTSET }; + enum CSSLineStyle { + CSS_LINE_STYLE_NONE = 0, + CSS_LINE_STYLE_HIDDEN, + CSS_LINE_STYLE_SOLID, + CSS_LINE_STYLE_INSET, + CSS_LINE_STYLE_OUTSET + }; + // ie, border-width (px) - enum CSSLineWidth { THIN = 1, MEDIUM = 3, THICK = 5 }; + enum CSSLineWidth { + CSS_LINE_WIDTH_THIN = 1, + CSS_LINE_WIDTH_MEDIUM = 3, + CSS_LINE_WIDTH_THICK = 5 + }; }//namespace diff --git a/code/nel/src/gui/css_border_renderer.cpp b/code/nel/src/gui/css_border_renderer.cpp index fd3ad569f..a7002cd9a 100644 --- a/code/nel/src/gui/css_border_renderer.cpp +++ b/code/nel/src/gui/css_border_renderer.cpp @@ -36,7 +36,7 @@ namespace NLGUI { TopWidth = RightWidth = BottomWidth = LeftWidth = 0; TopColor = RightColor = BottomColor = LeftColor = CRGBA(128, 128, 128, 255); - TopStyle = RightStyle = BottomStyle = LeftStyle = CSSLineStyle::SOLID; + TopStyle = RightStyle = BottomStyle = LeftStyle = CSS_LINE_STYLE_SOLID; CurrentAlpha = 255; _RenderLayer = 0; @@ -127,7 +127,7 @@ namespace NLGUI // ---------------------------------------------------------------------------- uint32 CSSBorderRenderer::getTopWidth() const { - if (TopStyle == CSSLineStyle::NONE || TopStyle == CSSLineStyle::HIDDEN) + if (TopStyle == CSS_LINE_STYLE_NONE || TopStyle == CSS_LINE_STYLE_HIDDEN) return 0; return TopWidth; @@ -136,7 +136,7 @@ namespace NLGUI // ---------------------------------------------------------------------------- uint32 CSSBorderRenderer::getRightWidth() const { - if (RightStyle == CSSLineStyle::NONE || RightStyle == CSSLineStyle::HIDDEN) + if (RightStyle == CSS_LINE_STYLE_NONE || RightStyle == CSS_LINE_STYLE_HIDDEN) return 0; return RightWidth; @@ -145,7 +145,7 @@ namespace NLGUI // ---------------------------------------------------------------------------- uint32 CSSBorderRenderer::getBottomWidth() const { - if (BottomStyle == CSSLineStyle::NONE || BottomStyle == CSSLineStyle::HIDDEN) + if (BottomStyle == CSS_LINE_STYLE_NONE || BottomStyle == CSS_LINE_STYLE_HIDDEN) return 0; return BottomWidth; @@ -154,7 +154,7 @@ namespace NLGUI // ---------------------------------------------------------------------------- uint32 CSSBorderRenderer::getLeftWidth() const { - if (LeftStyle == CSSLineStyle::NONE || LeftStyle == CSSLineStyle::HIDDEN) + if (LeftStyle == CSS_LINE_STYLE_NONE || LeftStyle == CSS_LINE_STYLE_HIDDEN) return 0; return LeftWidth; @@ -269,7 +269,7 @@ namespace NLGUI if (_BorderTop) { CRGBA borderColorT = TopColor; - if (TopStyle == CSSLineStyle::INSET) + if (TopStyle == CSS_LINE_STYLE_INSET) borderColorT = blend(borderColorT, CRGBA::Black, 0.5f); if (_ModulateGlobalColor) @@ -281,7 +281,7 @@ namespace NLGUI if (_BorderRight) { CRGBA borderColorR = RightColor; - if (RightStyle == CSSLineStyle::OUTSET) + if (RightStyle == CSS_LINE_STYLE_OUTSET) borderColorR = blend(borderColorR, CRGBA::Black, 0.5f); if (_ModulateGlobalColor) @@ -293,7 +293,7 @@ namespace NLGUI if (_BorderBottom) { CRGBA borderColorB = BottomColor; - if (BottomStyle == CSSLineStyle::OUTSET) + if (BottomStyle == CSS_LINE_STYLE_OUTSET) borderColorB = blend(borderColorB, CRGBA::Black, 0.5f); if (_ModulateGlobalColor) @@ -305,7 +305,7 @@ namespace NLGUI if (_BorderLeft) { CRGBA borderColorL = LeftColor; - if (LeftStyle == CSSLineStyle::INSET) + if (LeftStyle == CSS_LINE_STYLE_INSET) borderColorL = blend(borderColorL, CRGBA::Black, 0.5f); if (_ModulateGlobalColor) diff --git a/code/nel/src/gui/css_style.cpp b/code/nel/src/gui/css_style.cpp index fe2dab4fd..396bff062 100644 --- a/code/nel/src/gui/css_style.cpp +++ b/code/nel/src/gui/css_style.cpp @@ -557,15 +557,15 @@ namespace NLGUI if (value == "inherit") *dest = currentStyle; else if (value == "none") - *dest = CSSLineStyle::NONE; + *dest = CSS_LINE_STYLE_NONE; else if (value == "hidden") - *dest = CSSLineStyle::HIDDEN; + *dest = CSS_LINE_STYLE_HIDDEN; else if (value == "inset") - *dest = CSSLineStyle::INSET; + *dest = CSS_LINE_STYLE_INSET; else if (value == "outset") - *dest = CSSLineStyle::OUTSET; + *dest = CSS_LINE_STYLE_OUTSET; else if (value == "solid") - *dest = CSSLineStyle::SOLID; + *dest = CSS_LINE_STYLE_SOLID; } void CCssStyle::applyPaddingWidth(const std::string &value, uint32 *dest, const uint32 currentPadding, uint32 fontSize) const diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 23bd2e671..1f739cc5f 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -2941,7 +2941,7 @@ namespace NLGUI CViewBitmap *newImage = new CViewBitmap (TCtorParam()); newImage->setId(id); - addImageDownload(img, newImage, style, TImageType::NormalImage); + addImageDownload(img, newImage, style, NormalImage); newImage->setRenderLayer(getRenderLayer()+1); getParagraph()->addChild(newImage); @@ -3520,7 +3520,7 @@ namespace NLGUI else bitmap->setSizeRef(""); - addImageDownload(bgtex, view, CStyleParams(), TImageType::NormalImage, ""); + addImageDownload(bgtex, view, CStyleParams(), NormalImage, ""); } } } @@ -6664,7 +6664,7 @@ namespace NLGUI table->CellBorder = (borderWidth > 0); table->Border->setWidth(borderWidth, borderWidth, borderWidth, borderWidth); table->Border->setColor(borderColor, borderColor, borderColor, borderColor); - table->Border->setStyle(CSSLineStyle::OUTSET, CSSLineStyle::OUTSET, CSSLineStyle::OUTSET, CSSLineStyle::OUTSET); + table->Border->setStyle(CSS_LINE_STYLE_OUTSET, CSS_LINE_STYLE_OUTSET, CSS_LINE_STYLE_OUTSET, CSS_LINE_STYLE_OUTSET); } else { @@ -6696,7 +6696,7 @@ namespace NLGUI table->setTextureScale(true); string image = _Style.getStyle("background-image"); - addImageDownload(image, table, CStyleParams(), TImageType::NormalImage, ""); + addImageDownload(image, table, CStyleParams(), NormalImage, ""); } // setting ModulateGlobalColor must be after addImageDownload @@ -6777,7 +6777,7 @@ namespace NLGUI if (_Style.hasStyle("background-image")) { string image = _Style.getStyle("background-image"); - addImageDownload(image, _Cells.back(), CStyleParams(), TImageType::NormalImage, ""); + addImageDownload(image, _Cells.back(), CStyleParams(), NormalImage, ""); } if (elm.hasNonEmptyAttribute("colspan")) @@ -6824,7 +6824,7 @@ namespace NLGUI { _Cells.back()->Border->setWidth(1, 1, 1, 1); _Cells.back()->Border->setColor(table->Border->TopColor, table->Border->RightColor, table->Border->BottomColor, table->Border->LeftColor); - _Cells.back()->Border->setStyle(CSSLineStyle::INSET, CSSLineStyle::INSET, CSSLineStyle::INSET, CSSLineStyle::INSET); + _Cells.back()->Border->setStyle(CSS_LINE_STYLE_INSET, CSS_LINE_STYLE_INSET, CSS_LINE_STYLE_INSET, CSS_LINE_STYLE_INSET); } if (_Style.hasStyle("border-top-width")) _Cells.back()->Border->TopWidth = _Style.Current.BorderTopWidth; diff --git a/code/nel/src/gui/html_element.cpp b/code/nel/src/gui/html_element.cpp index 141fa87af..f0b764640 100644 --- a/code/nel/src/gui/html_element.cpp +++ b/code/nel/src/gui/html_element.cpp @@ -188,11 +188,11 @@ namespace NLGUI result += Value.substr(start, pos - start); if (Value[pos] == '\n') { - result += "⏎"; + result += "\xE2\x8F\x8E"; // \u23CE } else if (Value[pos] == '\t') { - result += "⇥"; + result += "\xE2\x87\xA5"; // \u21E5 } start = pos+1;