diff --git a/code/nel/include/nel/gui/css_selector.h b/code/nel/include/nel/gui/css_selector.h index 84b039089..b2b5372e9 100644 --- a/code/nel/include/nel/gui/css_selector.h +++ b/code/nel/include/nel/gui/css_selector.h @@ -84,6 +84,9 @@ namespace NLGUI // NOTE: Does not check combinator bool match(const CHtmlElement &elm) const; + // debug + std::string toString() const; + private: bool matchClass(const CHtmlElement &elm) const; bool matchAttributes(const CHtmlElement &elm) const; @@ -91,7 +94,7 @@ namespace NLGUI // match An+B rule to child index (1 based) bool matchNth(sint childNr, sint a, sint b) const; - + // parse nth-child string to 'a' and 'b' components // :nth-child(odd) // :nth-child(even) diff --git a/code/nel/include/nel/gui/css_style.h b/code/nel/include/nel/gui/css_style.h index dea4a1f43..d4f9cd320 100644 --- a/code/nel/include/nel/gui/css_style.h +++ b/code/nel/include/nel/gui/css_style.h @@ -47,7 +47,7 @@ namespace NLGUI sint32 X; sint32 Y; NLMISC::CRGBA Color; - }; + }; public: CStyleParams () : FontFamily(""), TextColor(255,255,255,255), TextShadow() { @@ -61,7 +61,7 @@ namespace NLGUI Height=-1; MaxWidth=-1; MaxHeight=-1; - BorderWidth=1; + BorderWidth=-1; BackgroundColor=NLMISC::CRGBA::Black; BackgroundColorOver=NLMISC::CRGBA::Black; } @@ -110,7 +110,7 @@ namespace NLGUI // pseudo element like ':before' std::string PseudoElement; - + // returns selector specificity uint specificity() const; }; @@ -134,6 +134,12 @@ namespace NLGUI void getStyleParams(const std::string &styleString, CStyleParams &style, const CStyleParams ¤t) const; void getStyleParams(const TStyle &styleRules, CStyleParams &style, const CStyleParams ¤t) const; + // extract from styleRules into style.StyleRules (expand shorthand, normalize, calculate current font-size) + void normalize(const TStyle &styleRules, CStyleParams &style, const CStyleParams ¤t) const; + + // apply style.StyleRyles + void apply(CStyleParams &style, const CStyleParams ¤t) const; + // merge src into dest by overwriting key in dest void merge(TStyle &dst, const TStyle &src) const; @@ -170,8 +176,8 @@ namespace NLGUI Current.Height=-1; Current.MaxWidth=-1; Current.MaxHeight=-1; - Current.BorderWidth=1; - + Current.BorderWidth=-1; + Current.StyleRules.clear(); } diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 88b22ab4f..335d4fa7e 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -23,7 +23,6 @@ #include "nel/gui/group_tree.h" #include "nel/gui/ctrl_button.h" #include "nel/gui/group_table.h" -#include "nel/gui/libwww_types.h" #include "nel/gui/html_element.h" #include "nel/gui/css_style.h" @@ -108,7 +107,7 @@ namespace NLGUI void refresh(); // submit form - void submitForm (uint formId, const char *submitButtonType, const char *submitButtonName, const char *submitButtonValue, sint32 x, sint32 y); + void submitForm(uint button, sint32 x, sint32 y); // Browse error void browseError (const char *msg); @@ -333,7 +332,7 @@ namespace NLGUI // Add a button in the current paragraph. actionHandler, actionHandlerParams and tooltip can be NULL. CCtrlButton *addButton(CCtrlButton::EType type, const std::string &name, const std::string &normalBitmap, const std::string &pushedBitmap, - const std::string &overBitmap, const char *actionHandler, const char *actionHandlerParams, const char *tooltip, + const std::string &overBitmap, const char *actionHandler, const char *actionHandlerParams, const std::string &tooltip, const CStyleParams &style = CStyleParams()); // Set the background color @@ -393,6 +392,7 @@ namespace NLGUI bool _BrowseNextTime; bool _PostNextTime; uint _PostFormId; + std::string _PostFormAction; std::string _PostFormSubmitType; std::string _PostFormSubmitButton; std::string _PostFormSubmitValue; @@ -415,6 +415,7 @@ namespace NLGUI // True when the element has been encountered bool _ParsingLua; bool _IgnoreText; + bool _IgnoreChildElements; // the script to execute std::string _LuaScript; bool _LuaHrefHack; @@ -473,6 +474,64 @@ namespace NLGUI }; std::vector _UL; + class HTMLMeterElement { + public: + enum EValueRegion { + VALUE_OPTIMUM = 0, + VALUE_SUB_OPTIMAL, + VALUE_EVEN_LESS_GOOD + }; + public: + HTMLMeterElement() + : value(0.f), min(0.f), max(1.f), low(0.f), high(1.f), optimum(0.5f) + {} + + // read attributes from html element + void readValues(const CHtmlElement &elm); + + // return value ratio to min-max + float getValueRatio() const; + + // return optimum region based current value + EValueRegion getValueRegion() const; + + // return meter bar color + NLMISC::CRGBA getBarColor(const CHtmlElement &elm, CCssStyle &style) const; + + // return meter value bar color based value and optimum range + NLMISC::CRGBA getValueColor(const CHtmlElement &elm, CCssStyle &style) const; + + float value; + float min; + float max; + float low; + float high; + float optimum; + }; + + class HTMLProgressElement + { + public: + HTMLProgressElement() + : value(0.f), max(1.f) + {} + + // read attributes from html element + void readValues(const CHtmlElement &elm); + + // return value ratio to min-max + float getValueRatio() const; + + // return meter bar color + NLMISC::CRGBA getBarColor(const CHtmlElement &elm, CCssStyle &style) const; + + // return meter value bar color based value and optimum range + NLMISC::CRGBA getValueColor(const CHtmlElement &elm, CCssStyle &style) const; + + float value; + float max; + }; + // A mode std::vector _A; inline bool getA() const @@ -608,6 +667,9 @@ namespace NLGUI sint InitialSelection; // initial selection for the combo box }; + //
element "id" attribute + std::string id; + // The action the form has to perform std::string Action; @@ -615,6 +677,25 @@ namespace NLGUI std::vector Entries; }; std::vector _Forms; + + // submit buttons added to from + struct SFormSubmitButton + { + SFormSubmitButton(const std::string &form, const std::string &name, const std::string &value, const std::string &type, const std::string &formAction="") + : form(form), name(name), value(value), type(type), formAction(formAction) + { } + + std::string form; // form 'id' + std::string name; // submit button name + std::string value; // submit button value + std::string type; // button type, ie 'image' + + std::string formAction; // override form action attribute (url) + }; + + // submit buttons added to form + std::vector _FormSubmit; + std::vector _Groups; // Cells parameters @@ -824,12 +905,34 @@ namespace NLGUI // :before, :after rendering void renderPseudoElement(const std::string &pseudo, const CHtmlElement &elm); + // apply background from current style (for html, body) + void applyBackground(const CHtmlElement &elm); + + void insertFormImageButton(const std::string &name, + const std::string &tooltip, + const std::string &src, + const std::string &over, + const std::string &formId, + const std::string &formAction = "", + uint32 minWidth = 0, + const std::string &templateName = ""); + + void insertFormTextButton(const std::string &name, + const std::string &tooltip, + const std::string &value, + const std::string &formId, + const std::string &formAction = "", + uint32 minWidth = 0, + const std::string &templateName = ""); + // HTML elements void htmlA(const CHtmlElement &elm); void htmlAend(const CHtmlElement &elm); void htmlBASE(const CHtmlElement &elm); void htmlBODY(const CHtmlElement &elm); void htmlBR(const CHtmlElement &elm); + void htmlBUTTON(const CHtmlElement &elm); + void htmlBUTTONend(const CHtmlElement &elm); void htmlDD(const CHtmlElement &elm); void htmlDDend(const CHtmlElement &elm); //void htmlDEL(const CHtmlElement &elm); @@ -857,6 +960,7 @@ namespace NLGUI void htmlLUA(const CHtmlElement &elm); void htmlLUAend(const CHtmlElement &elm); void htmlMETA(const CHtmlElement &elm); + void htmlMETER(const CHtmlElement &elm); void htmlOBJECT(const CHtmlElement &elm); void htmlOBJECTend(const CHtmlElement &elm); void htmlOL(const CHtmlElement &elm); @@ -867,6 +971,7 @@ namespace NLGUI void htmlPend(const CHtmlElement &elm); void htmlPRE(const CHtmlElement &elm); void htmlPREend(const CHtmlElement &elm); + void htmlPROGRESS(const CHtmlElement &elm); void htmlSCRIPT(const CHtmlElement &elm); void htmlSCRIPTend(const CHtmlElement &elm); void htmlSELECT(const CHtmlElement &elm); diff --git a/code/nel/include/nel/gui/html_element.h b/code/nel/include/nel/gui/html_element.h index bac681c1c..b7bceb4ab 100644 --- a/code/nel/include/nel/gui/html_element.h +++ b/code/nel/include/nel/gui/html_element.h @@ -47,8 +47,6 @@ namespace NLGUI // defined style and :before/:after pseudo elements TStyle Style; - TStyle StyleBefore; - TStyle StyleAfter; // hierarchy CHtmlElement *parent; @@ -79,6 +77,16 @@ namespace NLGUI // debug std::string toString(bool tree = false, uint depth = 0) const; + + // query, get, set pseudo element style rules + void clearPseudo(); + bool hasPseudo(const std::string &key) const; + TStyle getPseudo(const std::string &key) const; + void setPseudo(const std::string &key, const TStyle &style); + + private: + // pseudo elements like ":before" and ":after" + std::map _Pseudo; }; } diff --git a/code/nel/include/nel/gui/libwww.h b/code/nel/include/nel/gui/libwww.h index 74227305c..e713f3c81 100644 --- a/code/nel/include/nel/gui/libwww.h +++ b/code/nel/include/nel/gui/libwww.h @@ -21,7 +21,6 @@ #define CL_LIB_WWW_H #include "nel/misc/rgba.h" -#include "nel/gui/libwww_types.h" // forward declaration to avoid curl.h inclusion everywhere typedef void CURL; @@ -32,251 +31,146 @@ namespace NLGUI class CCtrlScroll; class CGroupList; - // *************************************************************************** - - // Legacy function from libwww - SGML_dtd * HTML_dtd (void); - - // Init the libwww - void initLibWWW(); - - // *************************************************************************** - - // Some DTD table - - // Here, modify the DTD table to change the HTML parser (add new tags for exemples) - - #undef HTML_ATTR - #define HTML_ATTR(t,a) MY_HTML_##t##_##a - - enum - { - HTML_ATTR(HTML,DIR) = 0, - HTML_ATTR(HTML,LANG), - HTML_ATTR(HTML,VERSION), - HTML_ATTR(HTML,STYLE), - }; - - enum - { - HTML_ATTR(A,ACCESSKEY) = 0, - HTML_ATTR(A,CHARSET), - HTML_ATTR(A,CLASS), - HTML_ATTR(A,COORDS), - HTML_ATTR(A,DIR), - HTML_ATTR(A,HREF), - HTML_ATTR(A,HREFLANG), - HTML_ATTR(A,ID), - HTML_ATTR(A,NAME), - HTML_ATTR(A,REL), - HTML_ATTR(A,REV), - HTML_ATTR(A,SHAPE), - HTML_ATTR(A,STYLE), - HTML_ATTR(A,TABINDEX), - HTML_ATTR(A,TARGET), - HTML_ATTR(A,TYPE), - HTML_ATTR(A,TITLE), - HTML_ATTR(A,Z_ACTION_CATEGORY), - HTML_ATTR(A,Z_ACTION_PARAMS), - HTML_ATTR(A,Z_ACTION_SHORTCUT), - }; - - enum - { - HTML_ATTR(TABLE,ALIGN) = 0, - HTML_ATTR(TABLE,BGCOLOR), - HTML_ATTR(TABLE,BORDER), - HTML_ATTR(TABLE,BORDERCOLOR), - HTML_ATTR(TABLE,CELLPADDING), - HTML_ATTR(TABLE,CELLSPACING), - HTML_ATTR(TABLE,CLASS), - HTML_ATTR(TABLE,DIR), - HTML_ATTR(TABLE,FRAME), - HTML_ATTR(TABLE,ID), - HTML_ATTR(TABLE,L_MARGIN), - HTML_ATTR(TABLE,LANG), - HTML_ATTR(TABLE,NOWRAP), - HTML_ATTR(TABLE,RULES), - HTML_ATTR(TABLE,SUMMARY), - HTML_ATTR(TABLE,STYLE), - HTML_ATTR(TABLE,TITLE), - HTML_ATTR(TABLE,VALIGN), - HTML_ATTR(TABLE,WIDTH) - }; - - enum - { - HTML_ATTR(TR,ALIGN) = 0, - HTML_ATTR(TR,BGCOLOR), - HTML_ATTR(TR,L_MARGIN), - HTML_ATTR(TR,NOWRAP), - HTML_ATTR(TR,VALIGN), - HTML_ATTR(TR,STYLE), - }; - - enum - { - HTML_ATTR(TD,ABBR) = 0, - HTML_ATTR(TD,ALIGN), - HTML_ATTR(TD,AXIS), - HTML_ATTR(TD,BGCOLOR), - HTML_ATTR(TD,CHAR), - HTML_ATTR(TD,CHAROFF), - HTML_ATTR(TD,CLASS), - HTML_ATTR(TD,COLSPAN), - HTML_ATTR(TD,DIR), - HTML_ATTR(TD,ID), - HTML_ATTR(TD,HEADERS), - HTML_ATTR(TD,HEIGHT), - HTML_ATTR(TD,L_MARGIN), - HTML_ATTR(TD,LANG), - HTML_ATTR(TD,NOWRAP), - HTML_ATTR(TD,ROWSPAN), - HTML_ATTR(TD,SCOPE), - HTML_ATTR(TD,STYLE), - HTML_ATTR(TD,TITLE), - HTML_ATTR(TD,VALIGN), - HTML_ATTR(TD,WIDTH), - }; - - enum - { - HTML_ATTR(IMG,ALIGN) = 0, - HTML_ATTR(IMG,ALT), - HTML_ATTR(IMG,BORDER), - HTML_ATTR(IMG,CLASS), - HTML_ATTR(IMG,DIR), - HTML_ATTR(IMG,GLOBAL_COLOR), - HTML_ATTR(IMG,HEIGHT), - HTML_ATTR(IMG,HSPACE), - HTML_ATTR(IMG,ID), - HTML_ATTR(IMG,ISMAP), - HTML_ATTR(IMG,LANG), - HTML_ATTR(IMG,LONGDESC), - HTML_ATTR(IMG,SRC), - HTML_ATTR(IMG,STYLE), - HTML_ATTR(IMG,TITLE), - HTML_ATTR(IMG,USEMAP), - HTML_ATTR(IMG,VSPACE), - HTML_ATTR(IMG,WIDTH), - // not sorted to keep enum values - HTML_ATTR(IMG,DATA_OVER_SRC), - }; - - enum - { - HTML_ATTR(INPUT,ACCEPT) = 0, - HTML_ATTR(INPUT,ACCESSKEY), - HTML_ATTR(INPUT,ALIGN), - HTML_ATTR(INPUT,ALT), - HTML_ATTR(INPUT,CHECKED), - HTML_ATTR(INPUT,CLASS), - HTML_ATTR(INPUT,DIR), - HTML_ATTR(INPUT,DISABLED), - HTML_ATTR(INPUT,GLOBAL_COLOR), - HTML_ATTR(INPUT,ID), - HTML_ATTR(INPUT,LANG), - HTML_ATTR(INPUT,MAXLENGTH), - HTML_ATTR(INPUT,NAME), - HTML_ATTR(INPUT,READONLY), - HTML_ATTR(INPUT,SIZE), - HTML_ATTR(INPUT,SRC), - HTML_ATTR(INPUT,STYLE), - HTML_ATTR(INPUT,TABINDEX), - HTML_ATTR(INPUT,TITLE), - HTML_ATTR(INPUT,TYPE), - HTML_ATTR(INPUT,USEMAP), - HTML_ATTR(INPUT,VALUE), - HTML_ATTR(INPUT,Z_BTN_TMPL), - HTML_ATTR(INPUT,Z_INPUT_TMPL), - HTML_ATTR(INPUT,Z_INPUT_WIDTH), - }; - - enum - { - HTML_ATTR(TEXTAREA,CLASS) = 0, - HTML_ATTR(TEXTAREA,COLS), - HTML_ATTR(TEXTAREA,DIR), - HTML_ATTR(TEXTAREA,DISABLED), - HTML_ATTR(TEXTAREA,ID), - HTML_ATTR(TEXTAREA,LANG), - HTML_ATTR(TEXTAREA,MAXLENGTH), - HTML_ATTR(TEXTAREA,NAME), - HTML_ATTR(TEXTAREA,READONLY), - HTML_ATTR(TEXTAREA,ROWS), - HTML_ATTR(TEXTAREA,STYLE), - HTML_ATTR(TEXTAREA,TABINDEX), - HTML_ATTR(TEXTAREA,TITLE), - HTML_ATTR(TEXTAREA,Z_INPUT_TMPL), - }; - - enum - { - HTML_ATTR(P,QUICK_HELP_CONDITION) = 0, - HTML_ATTR(P,QUICK_HELP_EVENTS), - HTML_ATTR(P,QUICK_HELP_LINK), - HTML_ATTR(P,NAME), - HTML_ATTR(P,STYLE), - }; - - enum - { - HTML_ATTR(DIV,CLASS) = 0, - HTML_ATTR(DIV,ID), - HTML_ATTR(DIV,NAME), - HTML_ATTR(DIV,STYLE), - }; - - enum - { - HTML_ATTR(SPAN,CLASS) = 0, - HTML_ATTR(SPAN,ID), - HTML_ATTR(SPAN,STYLE), - }; - - enum - { - HTML_ATTR(H1,CLASS) = 0, - HTML_ATTR(H1,ID), - HTML_ATTR(H1,STYLE), - }; - - enum - { - HTML_ATTR(H2,CLASS) = 0, - HTML_ATTR(H2,ID), - HTML_ATTR(H2,STYLE), - }; - - enum - { - HTML_ATTR(H3,CLASS) = 0, - HTML_ATTR(H3,ID), - HTML_ATTR(H3,STYLE), - }; - - enum - { - HTML_ATTR(H4,CLASS) = 0, - HTML_ATTR(H4,ID), - HTML_ATTR(H4,STYLE), - }; - - enum - { - HTML_ATTR(H5,CLASS) = 0, - HTML_ATTR(H5,ID), - HTML_ATTR(H5,STYLE), - }; - - enum - { - HTML_ATTR(H6,CLASS) = 0, - HTML_ATTR(H6,ID), - HTML_ATTR(H6,STYLE), - }; - - #undef HTML_ATTR + // List of HTML elements. Does not need to be sorted + typedef enum _HTMLElement { + HTML_HTML, + HTML_BODY, + // meta + HTML_BASE, + HTML_HEAD, + HTML_LINK, + HTML_META, + HTML_STYLE, + HTML_TITLE, + // content sectioning + HTML_ADDRESS, + HTML_ARTICLE, + HTML_ASIDE, + HTML_FOOTER, + HTML_HEADER, + HTML_H1, + HTML_H2, + HTML_H3, + HTML_H4, + HTML_H5, + HTML_H6, + HTML_HGROUP, + HTML_MAIN, + HTML_NAV, + HTML_SECTION, + // text content + HTML_BLOCKQUOTE, + HTML_DD, + HTML_DIR, + HTML_DIV, + HTML_DL, + HTML_DT, + HTML_FIGCAPTION, + HTML_FIGURE, + HTML_HR, + HTML_LI, + HTML_OL, + HTML_P, + HTML_PRE, + HTML_UL, + // inline text + HTML_A, + HTML_ABBR, + HTML_B, + HTML_BDI, + HTML_BDO, + HTML_BR, + HTML_CITE, + HTML_CODE, + HTML_DATA, + HTML_DFN, + HTML_EM, + HTML_I, + HTML_KBD, + HTML_MARK, + HTML_Q, + HTML_RB, + HTML_RP, + HTML_RT, + HTML_RTC, + HTML_RUBY, + HTML_S, + HTML_SAMP, + HTML_SMALL, + HTML_SPAN, + HTML_STRONG, + HTML_SUB, + HTML_SUP, + HTML_TIME, + HTML_TT, + HTML_U, + HTML_VAR, + HTML_WBR, + // image, multimedia + HTML_AREA, + HTML_AUDIO, + HTML_IMG, + HTML_MAP, + HTML_TRACK, + HTML_VIDEO, + // embedded content + HTML_APPLET, + HTML_EMBED, + HTML_IFRAME, + HTML_NOEMBED, + HTML_OBJECT, + HTML_PARAM, + HTML_PICTURE, + HTML_SOURCE, + // scripting + HTML_CANVAS, + HTML_NOSCRIPT, + HTML_SCRIPT, + // demarcating edits + HTML_DEL, + HTML_INS, + // table + HTML_CAPTION, + HTML_COL, + HTML_COLGROUP, + HTML_TABLE, + HTML_TBODY, + HTML_TD, + HTML_TFOOT, + HTML_TH, + HTML_THEAD, + HTML_TR, + // forms + HTML_BUTTON, + HTML_DATALIST, + HTML_FIELDSET, + HTML_FORM, + HTML_INPUT, + HTML_LABEL, + HTML_LEGEND, + HTML_METER, + HTML_OPTGROUP, + HTML_OPTION, + HTML_OUTPUT, + HTML_PROGRESS, + HTML_SELECT, + HTML_TEXTAREA, + // interactive elements + HTML_DETAILS, + HTML_DIALOG, + HTML_MENU, + HTML_MENUITEM, + HTML_SUMMARY, + // -- tags for ryzom -- + HTML_FONT, + HTML_LUA, + // last entry for unknown elements + HTML_NB_ELEMENTS + } HTMLElement; + + // case insensitive lookup for HTMLElement enum by name + // return HTML_NB_ELEMENTS if no match + HTMLElement htmlElementLookup(const char *name); // *************************************************************************** // Read HTML color value from src and set dest diff --git a/code/nel/include/nel/gui/libwww_types.h b/code/nel/include/nel/gui/libwww_types.h deleted file mode 100644 index 01f6eb534..000000000 --- a/code/nel/include/nel/gui/libwww_types.h +++ /dev/null @@ -1,1075 +0,0 @@ -/** - libwww Copyright Notice - [This notice should be placed within redistributed or derivative software - code when appropriate. This particular formulation of W3C's notice for - inclusion in libwww code became active on August 14 1998.] - - LIBWWW COPYRIGHT NOTICE - - libwww: W3C's implementation of HTTP can be found at: - http://www.w3.org/Library/ - - Copyright ¨ 1995-2002 World Wide Web Consortium, - (Massachusetts Institute of Technology, Institut - National de Recherche en Informatique et en - Automatique, Keio University). All Rights Reserved. - This program is distributed under the W3C's - Intellectual Property License. This program 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 W3C License - http://www.w3.org/Consortium/Legal/ for more details. - - Copyright ¨ 1995 CERN. "This product includes computer - software created and made available by CERN. This - acknowledgment shall be mentioned in full in any - product which includes the CERN computer software - included herein or parts thereof." - - *****************************************************************************/ - -#ifndef CL_LIB_WWW_TYPES_H -#define CL_LIB_WWW_TYPES_H - -#include - -// -// LibWWW elements -// - order must be kept for backward compatibility, new tags can be added to the end -typedef enum _HTMLElement { - HTML_A = 0, - HTML_ABBR, - HTML_ACRONYM, - HTML_ADDRESS, - HTML_APPLET, - HTML_AREA, - HTML_B, - HTML_BASE, - HTML_BASEFONT, - HTML_BDO, - HTML_BIG, - HTML_BLOCKQUOTE, - HTML_BODY, - HTML_BR, - HTML_BUTTON, - HTML_CAPTION, - HTML_CENTER, - HTML_CITE, - HTML_CODE, - HTML_COL, - HTML_COLGROUP, - HTML_DD, - HTML_DEL, - HTML_DFN, - HTML_DIR, - HTML_DIV, - HTML_DL, - HTML_DT, - HTML_EM, - HTML_FIELDSET, - HTML_FONT, - HTML_FORM, - HTML_FRAME, - HTML_FRAMESET, - HTML_H1, - HTML_H2, - HTML_H3, - HTML_H4, - HTML_H5, - HTML_H6, - HTML_HEAD, - HTML_HR, - HTML_HTML, - HTML_I, - HTML_IFRAME, - HTML_IMG, - HTML_INPUT, - HTML_INS, - HTML_ISINDEX, - HTML_KBD, - HTML_LABEL, - HTML_LEGEND, - HTML_LI, - HTML_LINK, - HTML_MAP, - HTML_MENU, - HTML_META, - HTML_NEXTID, /* !!! */ - HTML_NOFRAMES, - HTML_NOSCRIPT, - HTML_OBJECT, - HTML_OL, - HTML_OPTGROUP, - HTML_OPTION, - HTML_P, - HTML_PARAM, - HTML_PRE, - HTML_Q, - HTML_S, - HTML_SAMP, - HTML_SCRIPT, - HTML_SELECT, - HTML_SMALL, - HTML_SPAN, - HTML_STRIKE, - HTML_STRONG, - HTML_STYLE, - HTML_SUB, - HTML_SUP, - HTML_TABLE, - HTML_TBODY, - HTML_TD, - HTML_TEXTAREA, - HTML_TFOOT, - HTML_TH, - HTML_THEAD, - HTML_TITLE, - HTML_TR, - HTML_TT, - HTML_U, - HTML_UL, - HTML_VAR, - // new tags - HTML_LUA, - // this must be the last entry - HTML_ELEMENTS -} HTMLElement; - - -#define HTML_ATTR(t,a) HTML_##t##_##a -#define HTML_ATTRIBUTES(t) HTML_##t##_ATTRIBUTES - -/* - ( - A - ) - */ - -enum _HTML_A_Attributes { - HTML_ATTR(A,ACCESSKEY) = 0, - HTML_ATTR(A,CHARSET), - HTML_ATTR(A,CLASS), - HTML_ATTR(A,COORDS), - HTML_ATTR(A,DIR), - HTML_ATTR(A,HREF), - HTML_ATTR(A,HREFLANG), - HTML_ATTR(A,ID), - HTML_ATTR(A,NAME), - HTML_ATTR(A,REL), - HTML_ATTR(A,REV), - HTML_ATTR(A,SHAPE), - HTML_ATTR(A,STYLE), - HTML_ATTR(A,TABINDEX), - HTML_ATTR(A,TARGET), - HTML_ATTR(A,TYPE), - HTML_ATTR(A,TITLE), - HTML_ATTR(A,Z_ACTION_CATEGORY), // NLGUI - HTML_ATTR(A,Z_ACTION_PARANS), // NLGUI - HTML_ATTR(A,Z_ACTION_SHORTCUT), // NLGUI - HTML_ATTRIBUTES(A) -}; - -/* - ( - APPLET - Deprecated - ) - */ - -enum _HTML_APPLET_Attributes { - HTML_ATTR(APPLET,ALIGN) = 0, - HTML_ATTR(APPLET,ALT), - HTML_ATTR(APPLET,ARCHIVE), - HTML_ATTR(APPLET,CLASS), - HTML_ATTR(APPLET,CODE), - HTML_ATTR(APPLET,CODEBASE), - HTML_ATTR(APPLET,HEIGHT), - HTML_ATTR(APPLET,HSPACE), - HTML_ATTR(APPLET,ID), - HTML_ATTR(APPLET,NAME), - HTML_ATTR(APPLET,OBJECT), - HTML_ATTR(APPLET,STYLE), - HTML_ATTR(APPLET,TITLE), - HTML_ATTR(APPLET,VSPACE), - HTML_ATTR(APPLET,WIDTH), - HTML_ATTRIBUTES(APPLET) -}; - -/* - ( - AREA - ) - */ - -enum _HTML_AREA_Attributes { - HTML_ATTR(AREA,ACCESSKEY) = 0, - HTML_ATTR(AREA,ALT), - HTML_ATTR(AREA,CLASS), - HTML_ATTR(AREA,COORDS), - HTML_ATTR(AREA,DIR), - HTML_ATTR(AREA,HREF), - HTML_ATTR(AREA,ID), - HTML_ATTR(AREA,NAME), - HTML_ATTR(AREA,NOHREF), - HTML_ATTR(AREA,LANG), - HTML_ATTR(AREA,SHAPE), - HTML_ATTR(AREA,STYLE), - HTML_ATTR(AREA,TABINDEX), - HTML_ATTR(AREA,TARGET), - HTML_ATTR(AREA,TITLE), - HTML_ATTRIBUTES(AREA) -}; - - -/* - ( - BASE - ) - */ - -enum _HTML_BASE_Attributes { - HTML_ATTR(BASE,HREF) = 0, - HTML_ATTR(BASE,TARGET), - HTML_ATTRIBUTES(BASE) -}; - -/* - ( - BDO - ) - */ - -enum _HTML_BDO_Attributes { - HTML_ATTR(BDO,CLASS) = 0, - HTML_ATTR(BDO,DIR), - HTML_ATTR(BDO,ID), - HTML_ATTR(BDO,LANG), - HTML_ATTR(BDO,STYLE), - HTML_ATTR(BDO,TITLE), - HTML_ATTRIBUTES(BDO) -}; - -/* - ( - BLOCKQUOTE - ) - */ - -enum _HTML_BQ_Attributes { - HTML_ATTR(BQ,CITE) = 0, - HTML_ATTR(BQ,CLASS), - HTML_ATTR(BQ,DIR), - HTML_ATTR(BQ,ID), - HTML_ATTR(BQ,LANG), - HTML_ATTR(BQ,STYLE), - HTML_ATTR(BQ,TITLE), - HTML_ATTRIBUTES(BQ) -}; - -/* - ( - BODY - ) - */ - -enum _HTML_BODY_Attributes { - HTML_ATTR(BODY,ALINK) = 0, - HTML_ATTR(BODY,BACKGROUND), - HTML_ATTR(BODY,BGCOLOR), - HTML_ATTR(BODY,CLASS), - HTML_ATTR(BODY,DIR), - HTML_ATTR(BODY,ID), - HTML_ATTR(BODY,LANG), - HTML_ATTR(BODY,LINK), - HTML_ATTR(BODY,STYLE), - HTML_ATTR(BODY,TEXT), - HTML_ATTR(BODY,TITLE), - HTML_ATTR(BODY,VLINK), - HTML_ATTRIBUTES(BODY) -}; - -/* - ( - BR - ) - */ - -enum _HTML_BR_Attributes { - HTML_ATTR(BR,CLASS) = 0, - HTML_ATTR(BR,CLEAR), - HTML_ATTR(BR,ID), - HTML_ATTR(BR,STYLE), - HTML_ATTR(BR,TITLE), - HTML_ATTRIBUTES(BR) -}; - -/* - ( - BUTTON - ) - */ - -enum _HTML_BUTTON_Attributes { - HTML_ATTR(BUTTON,ACCESSKEY) = 0, - HTML_ATTR(BUTTON,CLASS), - HTML_ATTR(BUTTON,DIR), - HTML_ATTR(BUTTON,DISABLED), - HTML_ATTR(BUTTON,ID), - HTML_ATTR(BUTTON,LANG), - HTML_ATTR(BUTTON,NAME), - HTML_ATTR(BUTTON,STYLE), - HTML_ATTR(BUTTON,TABINDEX), - HTML_ATTR(BUTTON,TITLE), - HTML_ATTR(BUTTON,TYPE), - HTML_ATTR(BUTTON,VALUE), - HTML_ATTRIBUTES(BUTTON) -}; - -/* - ( - COL - ) - */ - -enum _HTML_COL_Attributes { - HTML_ATTR(COL,CLASS) = 0, - HTML_ATTR(COL,DIR), - HTML_ATTR(COL,ID), - HTML_ATTR(COL,LANG), - HTML_ATTR(COL,SPAN), - HTML_ATTR(COL,STYLE), - HTML_ATTR(COL,TITLE), - HTML_ATTR(COL,WIDTH), - HTML_ATTRIBUTES(COL) -}; - -/* - ( - DEL, INS - ) - */ - -enum _HTML_CHANGES_Attributes { - HTML_ATTR(CHANGES,CITE) = 0, - HTML_ATTR(CHANGES,CLASS), - HTML_ATTR(CHANGES,DATETIME), - HTML_ATTR(CHANGES,DIR), - HTML_ATTR(CHANGES,ID), - HTML_ATTR(CHANGES,LANG), - HTML_ATTR(CHANGES,STYLE), - HTML_ATTR(CHANGES,TITLE), - HTML_ATTRIBUTES(CHANGES) -}; - -/* - ( - FONT - Deprecated - ) - */ - -enum _HTML_FONT_Attributes { - HTML_ATTR(FONT,CLASS) = 0, - HTML_ATTR(FONT,COLOR), - HTML_ATTR(FONT,DIR), - HTML_ATTR(FONT,FACE), - HTML_ATTR(FONT,ID), - HTML_ATTR(FONT,LANG), - HTML_ATTR(FONT,SIZE), - HTML_ATTR(FONT,STYLE), - HTML_ATTR(FONT,TITLE), - HTML_ATTRIBUTES(FONT) -}; - -/* - ( - FORM - ) - */ - -enum _HTML_FORM_Attributes { - HTML_ATTR(FORM,ACCEPT) = 0, - HTML_ATTR(FORM,ACCEPT_CHARSET), /* { "ACCEPT-CHARSET" } */ - HTML_ATTR(FORM,ACTION), - HTML_ATTR(FORM,CLASS), - HTML_ATTR(FORM,DIR), - HTML_ATTR(FORM,ENCTYPE), - HTML_ATTR(FORM,ID), - HTML_ATTR(FORM,LANG), - HTML_ATTR(FORM,METHOD), - HTML_ATTR(FORM,STYLE), - HTML_ATTR(FORM,TARGET), - HTML_ATTR(FORM,TITLE), - HTML_ATTRIBUTES(FORM) -}; - -/* - ( - FRAME - ) - */ - -enum _HTML_FRAME_Attributes { - HTML_ATTR(FRAME,CLASS) = 0, - HTML_ATTR(FRAME,FRAMEBORDER), - HTML_ATTR(FRAME,ID), - HTML_ATTR(FRAME,NAME), - HTML_ATTR(FRAME,MARGINHEIGHT), - HTML_ATTR(FRAME,MARGINWIDTH), - HTML_ATTR(FRAME,NORESIZE), - HTML_ATTR(FRAME,LONGDESC), - HTML_ATTR(FRAME,SCROLLING), - HTML_ATTR(FRAME,SRC), - HTML_ATTR(FRAME,STYLE), - HTML_ATTR(FRAME,TARGET), - HTML_ATTR(FRAME,TITLE), - HTML_ATTRIBUTES(FRAME) -}; - -/* - ( - FRAMESET - ) - */ - -enum _HTML_FRAMESET_Attributes { - HTML_ATTR(FRAMESET,CLASS) = 0, - HTML_ATTR(FRAMESET,COLS), - HTML_ATTR(FRAMESET,ID), - HTML_ATTR(FRAMESET,ROWS), - HTML_ATTR(FRAMESET,STYLE), - HTML_ATTR(FRAMESET,TITLE), - HTML_ATTRIBUTES(FRAMESET) -}; - -/* - ( - Generic attributes - ) - */ - -enum _HTML_GEN_Attributes { - HTML_ATTR(GEN,CLASS) = 0, - HTML_ATTR(GEN,DIR), - HTML_ATTR(GEN,ID), - HTML_ATTR(GEN,LANG), - HTML_ATTR(GEN,STYLE), - HTML_ATTR(GEN,TITLE), - HTML_ATTRIBUTES(GEN) -}; - -/* - ( - BLOCK - ) - */ - -enum _HTML_BLOCK_Attributes { - HTML_ATTR(BLOCK,ALIGN) = 0, - HTML_ATTR(BLOCK,CLASS), - HTML_ATTR(BLOCK,DIR), - HTML_ATTR(BLOCK,ID), - HTML_ATTR(BLOCK,LANG), - HTML_ATTR(BLOCK,STYLE), - HTML_ATTR(BLOCK,TITLE), - HTML_ATTRIBUTES(BLOCK) -}; - -/* - ( - HEAD - ) - */ - -enum _HTML_HEAD_Attributes { - HTML_ATTR(HEAD,DIR) = 0, - HTML_ATTR(HEAD,LANG), - HTML_ATTR(HEAD,PROFILE), - HTML_ATTRIBUTES(HEAD) -}; - -/* - ( - HR - ) - */ - -enum _HTML_HR_Attributes { - HTML_ATTR(HR,ALIGN) = 0, - HTML_ATTR(HR,CLASS), - HTML_ATTR(HR,DIR), - HTML_ATTR(HR,ID), - HTML_ATTR(HR,LANG), - HTML_ATTR(HR,NOSHADE), - HTML_ATTR(HR,SIZE), - HTML_ATTR(HR,STYLE), - HTML_ATTR(HR,TITLE), - HTML_ATTR(HR,WIDTH), - HTML_ATTRIBUTES(HR) -}; - -/* - ( - HTML - ) - */ - -enum _HTML_HTML_Attributes { - HTML_ATTR(HTML,DIR) = 0, - HTML_ATTR(HTML,LANG), - HTML_ATTR(HTML,VERSION), - HTML_ATTRIBUTES(HTML) -}; - -/* - ( - IFRAME - ) - */ - -enum _HTML_IFRAME_Attributes { - HTML_ATTR(IFRAME,ALIGN) = 0, - HTML_ATTR(IFRAME,CLASS), - HTML_ATTR(IFRAME,FRAMEBORDER), - HTML_ATTR(IFRAME,HEIGHT), - HTML_ATTR(IFRAME,ID), - HTML_ATTR(IFRAME,LONGDESC), - HTML_ATTR(IFRAME,MARGINHEIGHT), - HTML_ATTR(IFRAME,MARGINWIDTH), - HTML_ATTR(IFRAME,NAME), - HTML_ATTR(IFRAME,SCROLLING), - HTML_ATTR(IFRAME,SRC), - HTML_ATTR(IFRAME,STYLE), - HTML_ATTR(IFRAME,TARGET), - HTML_ATTR(IFRAME,TITLE), - HTML_ATTR(IFRAME,WIDTH), - HTML_ATTRIBUTES(IFRAME) -}; - -/* - ( - IMG - ) - */ - -enum _HTML_IMG_Attributes { - HTML_ATTR(IMG,ALIGN) = 0, - HTML_ATTR(IMG,ALT), - HTML_ATTR(IMG,BORDER), - HTML_ATTR(IMG,CLASS), - HTML_ATTR(IMG,DIR), - HTML_ATTR(IMG,HEIGHT), - HTML_ATTR(IMG,HSPACE), - HTML_ATTR(IMG,ID), - HTML_ATTR(IMG,ISMAP), - HTML_ATTR(IMG,LANG), - HTML_ATTR(IMG,LONGDESC), - HTML_ATTR(IMG,SRC), - HTML_ATTR(IMG,STYLE), - HTML_ATTR(IMG,TITLE), - HTML_ATTR(IMG,USEMAP), - HTML_ATTR(IMG,VSPACE), - HTML_ATTR(IMG,WIDTH), - HTML_ATTRIBUTES(IMG) -}; - -/* - ( - INPUT - ) - */ - -enum _HTML_INPUT_Attributes { - HTML_ATTR(INPUT,ACCEPT) = 0, - HTML_ATTR(INPUT,ACCESSKEY), - HTML_ATTR(INPUT,ALIGN), - HTML_ATTR(INPUT,ALT), - HTML_ATTR(INPUT,CHECKED), - HTML_ATTR(INPUT,CLASS), - HTML_ATTR(INPUT,DIR), - HTML_ATTR(INPUT,DISABLED), - HTML_ATTR(INPUT,ID), - HTML_ATTR(INPUT,LANG), - HTML_ATTR(INPUT,MAXLENGTH), - HTML_ATTR(INPUT,NAME), - HTML_ATTR(INPUT,READONLY), - HTML_ATTR(INPUT,SIZE), - HTML_ATTR(INPUT,SRC), - HTML_ATTR(INPUT,STYLE), - HTML_ATTR(INPUT,TABINDEX), - HTML_ATTR(INPUT,TITLE), - HTML_ATTR(INPUT,TYPE), - HTML_ATTR(INPUT,USEMAP), - HTML_ATTR(INPUT,VALUE), - HTML_ATTRIBUTES(INPUT) -}; - -/* - ( - ) - */ - -enum _HTML_ISINDEX_Attributes { - HTML_ATTR(ISINDEX,CLASS) = 0, - HTML_ATTR(ISINDEX,DIR), - HTML_ATTR(ISINDEX,ID), - HTML_ATTR(ISINDEX,LANG), - HTML_ATTR(ISINDEX,PROMPT), - HTML_ATTR(ISINDEX,STYLE), - HTML_ATTR(ISINDEX,TITLE), - HTML_ATTRIBUTES(ISINDEX) -}; - -/* - ( - ) - */ - -enum _HTML_LABEL_Attributes { - HTML_ATTR(LABEL,ACCESSKEY) = 0, - HTML_ATTR(LABEL,CLASS), - HTML_ATTR(LABEL,DIR), - HTML_ATTR(LABEL,FOR), - HTML_ATTR(LABEL,ID), - HTML_ATTR(LABEL,LANG), - HTML_ATTR(LABEL,STYLE), - HTML_ATTR(LABEL,TITLE), - HTML_ATTRIBUTES(LABEL) -}; - -/* - ( - ) - */ - -enum _HTML_LEGEND_Attributes { - HTML_ATTR(LEGEND,ACCESSKEY) = 0, - HTML_ATTR(LEGEND,ALIGN), - HTML_ATTR(LEGEND,CLASS), - HTML_ATTR(LEGEND,DIR), - HTML_ATTR(LEGEND,ID), - HTML_ATTR(LEGEND,LANG), - HTML_ATTR(LEGEND,STYLE), - HTML_ATTR(LEGEND,TITLE), - HTML_ATTRIBUTES(LEGEND) -}; - -/* - ( - LI - ) - */ - -enum _HTML_LI_Attributes { - HTML_ATTR(LI,CLASS) = 0, - HTML_ATTR(LI,COMPACT), - HTML_ATTR(LI,DIR), - HTML_ATTR(LI,ID), - HTML_ATTR(LI,LANG), - HTML_ATTR(LI,STYLE), - HTML_ATTR(LI,TITLE), - HTML_ATTR(LI,TYPE), - HTML_ATTR(LI,VALUE), - HTML_ATTRIBUTES(LI) -}; - -/* - ( - LINK - ) - */ - -enum _HTML_LINK_Attributes { - HTML_ATTR(LINK,CHARSET) = 0, - HTML_ATTR(LINK,CLASS), - HTML_ATTR(LINK,DIR), - HTML_ATTR(LINK,HREF), - HTML_ATTR(LINK,HREFLANG), - HTML_ATTR(LINK,ID), - HTML_ATTR(LINK,LANG), - HTML_ATTR(LINK,MEDIA), - HTML_ATTR(LINK,REL), - HTML_ATTR(LINK,REV), - HTML_ATTR(LINK,STYLE), - HTML_ATTR(LINK,TARGET), - HTML_ATTR(LINK,TITLE), - HTML_ATTR(LINK,TYPE), - HTML_ATTRIBUTES(LINK) -}; - -/* - ( - MAP - ) - */ - -enum _HTML_MAP_Attributes { - HTML_ATTR(MAP,CLASS) = 0, - HTML_ATTR(MAP,DIR), - HTML_ATTR(MAP,ID), - HTML_ATTR(MAP,LANG), - HTML_ATTR(MAP,NAME), - HTML_ATTR(MAP,STYLE), - HTML_ATTR(MAP,TITLE), - HTML_ATTRIBUTES(MAP) -}; - -/* - ( - META - ) - */ - -enum _HTML_META_Attributes { - HTML_ATTR(META,CONTENT) = 0, - HTML_ATTR(META,DIR), - HTML_ATTR(META,HTTP_EQUIV), /* { "HTTP-EQUIV" ) */ - HTML_ATTR(META,LANG), - HTML_ATTR(META,NAME), - HTML_ATTR(META,SCHEME), - HTML_ATTRIBUTES(META) -}; - -/* - ( - NEXTID - ) - */ - -#define HTML_NEXTID_ATTRIBUTES 1 -#define HTML_NEXTID_N 0 - -/* - ( - OBJECT - ) - */ - -enum _HTML_OBJECT_Attributes { - HTML_ATTR(OBJECT,ALIGN) = 0, - HTML_ATTR(OBJECT,ARCHIVE), - HTML_ATTR(OBJECT,BORDER), - HTML_ATTR(OBJECT,CLASS), - HTML_ATTR(OBJECT,CLASSID), - HTML_ATTR(OBJECT,CODEBASE), - HTML_ATTR(OBJECT,CODETYPE), - HTML_ATTR(OBJECT,DATA), - HTML_ATTR(OBJECT,DECLARE), - HTML_ATTR(OBJECT,DIR), - HTML_ATTR(OBJECT,HEIGHT), - HTML_ATTR(OBJECT,HSPACE), - HTML_ATTR(OBJECT,ID), - HTML_ATTR(OBJECT,LANG), - HTML_ATTR(OBJECT,NAME), - HTML_ATTR(OBJECT,STANDBY), - HTML_ATTR(OBJECT,STYLE), - HTML_ATTR(OBJECT,TABINDEX), - HTML_ATTR(OBJECT,TITLE), - HTML_ATTR(OBJECT,TYPE), - HTML_ATTR(OBJECT,USEMAP), - HTML_ATTR(OBJECT,VSPACE), - HTML_ATTR(OBJECT,WIDTH), - HTML_ATTRIBUTES(OBJECT) -}; - -/* - ( - OL - ) - */ - -enum _HTML_OL_Attributes { - HTML_ATTR(OL,CLASS) = 0, - HTML_ATTR(OL,COMPACT), - HTML_ATTR(OL,DIR), - HTML_ATTR(OL,ID), - HTML_ATTR(OL,LANG), - HTML_ATTR(OL,START), - HTML_ATTR(OL,STYLE), - HTML_ATTR(OL,TITLE), - HTML_ATTR(OL,TYPE), - HTML_ATTRIBUTES(OL) -}; - -/* - ( - OPTGROUP - ) - */ - -enum _HTML_OPTGROUP_Attributes { - HTML_ATTR(OPTGROUP,CLASS) = 0, - HTML_ATTR(OPTGROUP,DISABLED), - HTML_ATTR(OPTGROUP,DIR), - HTML_ATTR(OPTGROUP,ID), - HTML_ATTR(OPTGROUP,LABEL), - HTML_ATTR(OPTGROUP,LANG), - HTML_ATTR(OPTGROUP,STYLE), - HTML_ATTR(OPTGROUP,TITLE), - HTML_ATTRIBUTES(OPTGROUP) -}; - -/* - ( - OPTION - ) - */ - -enum _HTML_OPTION_Attributes { - HTML_ATTR(OPTION,CLASS) = 0, - HTML_ATTR(OPTION,DISABLED), - HTML_ATTR(OPTION,DIR), - HTML_ATTR(OPTION,ID), - HTML_ATTR(OPTION,LABEL), - HTML_ATTR(OPTION,LANG), - HTML_ATTR(OPTION,SELECTED), - HTML_ATTR(OPTION,STYLE), - HTML_ATTR(OPTION,TITLE), - HTML_ATTR(OPTION,VALUE), - HTML_ATTRIBUTES(OPTION) -}; - -/* - ( - PARAM - ) - */ - -enum _HTML_PARAM_Attributes { - HTML_ATTR(PARAM,ID) = 0, - HTML_ATTR(PARAM,NAME), - HTML_ATTR(PARAM,TYPE), - HTML_ATTR(PARAM,VALUE), - HTML_ATTR(PARAM,VALUETYPE), - HTML_ATTRIBUTES(PARAM) -}; - -/* - ( - PRE - ) - */ - -enum _HTML_PRE_Attributes { - HTML_ATTR(PRE,CLASS) = 0, - HTML_ATTR(PRE,DIR), - HTML_ATTR(PRE,ID), - HTML_ATTR(PRE,LANG), - HTML_ATTR(PRE,STYLE), - HTML_ATTR(PRE,TITLE), - HTML_ATTR(PRE,WIDTH), - HTML_ATTRIBUTES(PRE) -}; - -/* - ( - SCRIPT - ) - */ - -enum _HTML_SCRIPT_Attributes { - HTML_ATTR(SCRIPT,CHARSET) = 0, - HTML_ATTR(SCRIPT,DEFER), - HTML_ATTR(SCRIPT,LANGUAGE), - HTML_ATTR(SCRIPT,SRC), - HTML_ATTR(SCRIPT,TYPE), - HTML_ATTRIBUTES(SCRIPT) -}; - -/* - ( - SELECT - ) - */ - -enum _HTML_SELECT_Attributes { - HTML_ATTR(SELECT,CLASS) = 0, - HTML_ATTR(SELECT,DIR), - HTML_ATTR(SELECT,DISABLED), - HTML_ATTR(SELECT,ID), - HTML_ATTR(SELECT,LANG), - HTML_ATTR(SELECT,MULTIPLE), - HTML_ATTR(SELECT,NAME), - HTML_ATTR(SELECT,SIZE), - HTML_ATTR(SELECT,STYLE), - HTML_ATTR(SELECT,TABINDEX), - HTML_ATTR(SELECT,TITLE), - HTML_ATTRIBUTES(SELECT) -}; - -/* - ( - STYLE - ) - */ - -enum _HTML_STYLE_Attributes { - HTML_ATTR(STYLE,DIR) = 0, - HTML_ATTR(STYLE,LANG), - HTML_ATTR(STYLE,MEDIA), - HTML_ATTR(STYLE,TITLE), - HTML_ATTR(STYLE,TYPE), - HTML_ATTRIBUTES(STYLE) -}; - -/* - ( - TABLE - ) - */ - -enum _HTML_TABLE_Attributes { - HTML_ATTR(TABLE,ALIGN) = 0, - HTML_ATTR(TABLE,BGCOLOR), - HTML_ATTR(TABLE,BORDER), - HTML_ATTR(TABLE,CELLPADDING), - HTML_ATTR(TABLE,CELLSPACING), - HTML_ATTR(TABLE,CLASS), - HTML_ATTR(TABLE,DIR), - HTML_ATTR(TABLE,FRAME), - HTML_ATTR(TABLE,ID), - HTML_ATTR(TABLE,LANG), - HTML_ATTR(TABLE,RULES), - HTML_ATTR(TABLE,SUMMARY), - HTML_ATTR(TABLE,STYLE), - HTML_ATTR(TABLE,TITLE), - HTML_ATTR(TABLE,WIDTH), - HTML_ATTRIBUTES(TABLE) -}; - -/* - ( - TABLE Elements - ) - */ - -enum _HTML_TELE_Attributes { - HTML_ATTR(TELE,ALIGN) = 0, - HTML_ATTR(TELE,CHAR), - HTML_ATTR(TELE,CHAROFF), - HTML_ATTR(TELE,CLASS), - HTML_ATTR(TELE,DIR), - HTML_ATTR(TELE,ID), - HTML_ATTR(TELE,LANG), - HTML_ATTR(TELE,STYLE), - HTML_ATTR(TELE,TITLE), - HTML_ATTR(TELE,VALIGN), - HTML_ATTRIBUTES(TELE) -}; - -/* - ( - TD - ) - */ - -enum _HTML_TD_Attributes { - HTML_ATTR(TD,ABBR) = 0, - HTML_ATTR(TD,ALIGN), - HTML_ATTR(TD,AXIS), - HTML_ATTR(TD,BGCOLOR), - HTML_ATTR(TD,CHAR), - HTML_ATTR(TD,CHAROFF), - HTML_ATTR(TD,CLASS), - HTML_ATTR(TD,COLSPAN), - HTML_ATTR(TD,DIR), - HTML_ATTR(TD,ID), - HTML_ATTR(TD,HEADERS), - HTML_ATTR(TD,HEIGHT), - HTML_ATTR(TD,LANG), - HTML_ATTR(TD,NOWRAP), - HTML_ATTR(TD,ROWSPAN), - HTML_ATTR(TD,SCOPE), - HTML_ATTR(TD,STYLE), - HTML_ATTR(TD,TITLE), - HTML_ATTR(TD,VALIGN), - HTML_ATTR(TD,WIDTH), - HTML_ATTRIBUTES(TD) -}; - -/* - ( - TEXTAREA - ) - */ - -enum _HTML_TEXTAREA_Attributes { - HTML_ATTR(TEXTAREA,CLASS) = 0, - HTML_ATTR(TEXTAREA,COLS), - HTML_ATTR(TEXTAREA,DIR), - HTML_ATTR(TEXTAREA,DISABLED), - HTML_ATTR(TEXTAREA,ID), - HTML_ATTR(TEXTAREA,LANG), - HTML_ATTR(TEXTAREA,NAME), - HTML_ATTR(TEXTAREA,READONLY), - HTML_ATTR(TEXTAREA,ROWS), - HTML_ATTR(TEXTAREA,STYLE), - HTML_ATTR(TEXTAREA,TABINDEX), - HTML_ATTR(TEXTAREA,TITLE), - HTML_ATTRIBUTES(TEXTAREA) -}; - -/* - ( - TITLE - ) - */ - -enum _HTML_TITLE_Attributes { - HTML_ATTR(TITLE,DIR) = 0, - HTML_ATTR(TITLE,LANG), - HTML_ATTRIBUTES(TITLE) -}; - -/* - ( - UL - ) - */ - -enum _HTML_UL_Attributes { - HTML_ATTR(UL,CLASS) = 0, - HTML_ATTR(UL,COMPACT), - HTML_ATTR(UL,DIR), - HTML_ATTR(UL,ID), - HTML_ATTR(UL,LANG), - HTML_ATTR(UL,STYLE), - HTML_ATTR(UL,TITLE), - HTML_ATTR(UL,TYPE), - HTML_ATTRIBUTES(UL) -}; - - -/* -** ELEMENTS -** Must match definitions in HTMLPDTD.html! -** Must be in alphabetical order. -** -** Name, Attributes, content -*/ - -// -// SGML.h -// -#define MAX_ATTRIBUTES 32 - -typedef struct _HTAttr { - char * name; -} HTAttr; - -// striped struct -typedef struct _HTTag { - std::string name; - HTAttr * attributes; - int number_of_attributes; -} HTTag; - -// entities are removed -typedef struct { - HTTag * tags; - int number_of_tags; -} SGML_dtd; - -SGML_dtd * HTML_dtd (void); - -#endif - diff --git a/code/nel/src/gui/css_parser.cpp b/code/nel/src/gui/css_parser.cpp index 0a4288d12..d34dc8f7a 100644 --- a/code/nel/src/gui/css_parser.cpp +++ b/code/nel/src/gui/css_parser.cpp @@ -631,18 +631,9 @@ namespace NLGUI { result.clear(); } - else if (result.empty() || !current.empty()) + else if (!current.empty()) { - // pseudo element like ':before' can only be set on the last selector - if (!result.empty() && !pseudoElement.empty()) - { - // failed - result.clear(); - } - else - { - result.push_back(current); - } + result.push_back(current); } return result; diff --git a/code/nel/src/gui/css_selector.cpp b/code/nel/src/gui/css_selector.cpp index 0384f561a..46806a2db 100644 --- a/code/nel/src/gui/css_selector.cpp +++ b/code/nel/src/gui/css_selector.cpp @@ -310,5 +310,43 @@ namespace NLGUI } } + std::string CCssSelector::toString() const + { + std::string ret; + ret += Element; + ret += Id; + if (!Class.empty()) + { + for(uint i = 0; iProperties); } - else if (i->PseudoElement == ":before") - { - merge(elm.StyleBefore, i->Properties); - } - else if (i->PseudoElement == ":after") + else { - merge(elm.StyleAfter, i->Properties); + elm.setPseudo(i->PseudoElement, i->Properties); } } } @@ -227,7 +222,7 @@ namespace NLGUI // child of - immediate parent must match previous selector if (!child->parent) { - return false; + return false; } child = child->parent; mustMatchNext = true; @@ -332,10 +327,18 @@ namespace NLGUI return; } - // first pass: - // - get font-size for 'em' sizes - // - split shorthand to its parts - // - get TextColor value that could be used for 'currentcolor' + normalize(styleRules, style, current); + apply(style, current); + } + + // first pass + // - get font-size for 'em' sizes + // - split shorthand to its parts + // - get TextColor value that could be used for 'currentcolor' + // - normalize values + void CCssStyle::normalize(const TStyle &styleRules, CStyleParams &style, const CStyleParams ¤t) const + { + TStyle::const_iterator it; for (it=styleRules.begin(); it != styleRules.end(); ++it) { // update local copy of applied style @@ -407,6 +410,7 @@ namespace NLGUI } else { + float tmpf; std::string unit; if (getCssLength(tmpf, unit, it->second.c_str())) { @@ -428,10 +432,39 @@ namespace NLGUI { parseBackgroundShorthand(it->second, style); } + else + if (it->first == "background-repeat") + { + // old ryzom specific value + if (it->second == "1") + style.StyleRules[it->first] = "repeat"; + } + else + if (it->first == "background-scale") + { + // replace old ryzom specific rule with background-size + if (it->second != "1") + { + style.StyleRules["background-size"] = "auto"; + } + else + { + style.StyleRules["background-size"] = "100%"; + } + + TStyle::iterator pos = style.StyleRules.find(it->first); + if (pos != style.StyleRules.end()) + style.StyleRules.erase(pos); + } } + } - // second pass: rest of style - for (it=styleRules.begin(); it != styleRules.end(); ++it) + // apply style rules + void CCssStyle::apply(CStyleParams &style, const CStyleParams ¤t) const + { + float tmpf; + TStyle::const_iterator it; + for (it=style.StyleRules.begin(); it != style.StyleRules.end(); ++it) { if (it->first == "border" || it->first == "border-width") { @@ -456,8 +489,9 @@ namespace NLGUI { style.BorderWidth = 5; } - else + else { + float tmpf; std::string unit; if (getCssLength(tmpf, unit, it->second.c_str())) { @@ -763,10 +797,46 @@ namespace NLGUI else if (it->second == "transparent") style.BackgroundColorOver = CRGBA(0, 0, 0, 0); else if (it->second == "currentcolor") - style.BackgroundColorOver = style.TextColor; + style.BackgroundColorOver = style.TextColor; else scanHTMLColor(it->second.c_str(), style.BackgroundColorOver); } + else + if (it->first == "background-image") + { + // normalize + std::string image = trim(it->second); + if (toLower(image.substr(0, 4)) == "url(") + { + image = image.substr(4, image.size()-5); + } + style.StyleRules[it->first] = trimQuotes(image); + } + else + if (it->first == "background-repeat") + { + // normalize + std::string val = toLower(trim(it->second)); + std::vector parts; + NLMISC::splitString(val, " ", parts); + // check for "repeat repeat" + if (parts.size() == 2 && parts[0] == parts[1]) + val = parts[0]; + + style.StyleRules[it->first] = val; + } + else + if (it->first == "background-size") + { + // normalize + std::string val = toLower(trim(it->second)); + std::vector parts; + NLMISC::splitString(val, " ", parts); + if (parts.size() == 2 && parts[0] == parts[1]) + val = parts[0]; + + style.StyleRules[it->first] = val; + } } // if outer element has underline set, then inner element cannot remove it @@ -795,115 +865,278 @@ namespace NLGUI "background-attachment", "background-origin", "background-clip", "background-color"}; std::string values[nbProps]; bool found[nbProps] = {false}; - + bool bgClipFound = false; + std::string bgClipValue; + std::string bgPositionX; + std::string bgPositionY; uint partIndex = 0; std::vector parts; std::vector::iterator it; // FIXME: this will fail if url() contains ' ' chars + // FIXME: this will also fail on 'background: rgb(255, 0, 0)' NLMISC::splitString(value, " ", parts); bool failed = false; - for(uint index = 0; index < parts.size(); index++) + bool allowSize = false; + uint index = 0; + while(!failed && index < parts.size()) { - const std::string val = toLower(trim(parts[index])); - + std::string val = toLower(parts[index]); + bool matches = false; for(uint i = 0; i < nbProps; i++) { - if (found[i]) - { - continue; - } + if (found[i]) continue; if (props[i] == "background-image") { if (val.substr(0, 4) == "url(") { + matches = true; + found[i] = true; // use original value as 'val' is lowercase values[i] = parts[index]; - found[i] = true; } } else if (props[i] == "background-position") { - // TODO: + uint next = index; + bool loop = false; + do + { + float fval; + std::string unit; + + // first loop -> true + // second loop -> false && break + loop = !loop; + + val = toLower(parts[next]); + if (val == "center") + { + if (bgPositionX.empty()) bgPositionX = "center"; + if (bgPositionY.empty()) bgPositionY = "center"; + // consume 'center' + next++; + } + else if (val == "left" || val == "right") + { + bgPositionX = val; + // consume 'left|right' + next++; + if(next < parts.size() && getCssLength(fval, unit, parts[next])) + { + bgPositionX += " " + toString("%.0f%s", fval, unit.c_str()); + // consume css length + next++; + } + } + else if (val == "top" || val == "bottom") + { + bgPositionY = val; + // consume top|bottom + next++; + if (next < parts.size() && getCssLength(fval, unit, parts[next])) + { + bgPositionY += " " + toString("%.0f%s", fval, unit.c_str()); + // consume css length + next++; + } + } + } while (loop); + + // + if (!bgPositionX.empty() && !bgPositionY.empty()) + { + matches = true; + found[i] = true; + // consume position values if there were any + index = next-1; + + // look ahead to see if size is next + if (next < parts.size() && parts[next] == "/") + allowSize = true; + } } else if (props[i] == "background-size") { - // TODO: [ | auto ]{1,2} cover | contain + if (allowSize && val == "/") + { + uint next = index + 1; + if (next < parts.size()) + { + val = toLower(parts[next]); + if (val == "cover" || val == "contain") + { + matches = true; + found[i] = true; + values[i] = val; + index = next; + } + else + { + float fval; + std::string unit; + std::string h, v; + + if (val == "auto" || getCssLength(fval, unit, val)) + { + if (val == "auto") + h = v = "auto"; + else + h = v = toString("%.0f%s", fval, unit.c_str()); + + next++; + if (next < parts.size()) + { + val = toLower(parts[next]); + if (val == "auto") + v = "auto"; + else if (getCssLength(fval, unit, val)) + v = toString("%.0f%s", fval, unit.c_str()); + else + next--; // not size token + } + else + { + // not size token + next--; + } + } + + if (!h.empty() && !v.empty()) + { + matches = true; + found[i] = true; + values[i] = h + " " + v; + index = next; + } + } + } + else + { + // no size, just '/' + failed = true; + break; + } + } } else if (props[i] == "background-repeat") { if (val == "repeat-x" || val == "repeat-y" || val == "repeat" || val == "space" || val == "round" || val == "no-repeat") { + matches = true; + found[i] = true; + if (val == "repeat-x") { values[i] = "repeat no-repeat"; } else if (val == "repeat-y") { - values[i] = "no-repeat repeat"; + values[i] = "no-repeat repeat"; } else { std::string horiz = val; std::string vert = val; - if (index+1 < parts.size()) + uint next = index + 1; + if (next < parts.size()) { - std::string next = toLower(trim(parts[index+1])); - if (next == "repeat" || next == "space" || next == "round" || next == "no-repeat") + val = toLower(parts[next]); + if (val == "repeat" || val == "space" || val == "round" || val == "no-repeat") { - vert = next; - index++; + vert = val; + index = next; } } - - values[i] = horiz + " " + vert; + if (vert == horiz) + values[i] = vert; + else + values[i] = horiz + " " + vert; } - - found[i] = true; } } else if (props[i] == "background-attachment") { - // TODO: scroll | fixed | local + if (val == "scroll" || val == "fixed" || val == "local") + { + matches = true; + found[i] = true; + values[i] = val; + } } - else if (props[i] == "background-origin" || props[i] == "background-clip") + else if (props[i] == "background-origin") { - // same values for both if (val == "padding-box" || val == "border-box" || val == "content-box") { + matches = true; + found[i] = true; values[i] = val; + + // first time background-origin is set, also set background-clip + if (!bgClipFound) + bgClipValue = val; + } + } + else if (props[i] == "background-clip") + { + if (val == "text" || val == "padding-box" || val == "border-box" || val == "content-box") + { + matches = true; found[i] = true; + bgClipFound = true; + bgClipValue = val; } } else if (props[i] == "background-color") { CRGBA color; - if (!scanHTMLColor(val.c_str(), color)) + if (val == "transparent" || val == "currentcolor" || scanHTMLColor(val.c_str(), color)) { - failed = true; - break; + matches = true; + found[i] = true; + values[i] = val; } - values[i] = val; - // color should come as last item - break; } + + // prop was found and parsed + if (found[i]) + break; } + failed = !matches; + + index++; } // invalidate whole rule if (failed) { - return; + bgClipFound = false; + for(uint i = 0; i < nbProps; i++) + { + found[i] = false; + } } - // apply found styles + // apply found styles or use default for(uint i = 0; i < nbProps; i++) { if (found[i]) { - style.StyleRules[props[i]] = values[i]; + if (props[i] == "background-position") + { + style.StyleRules["background-position-x"] = bgPositionX; + style.StyleRules["background-position-y"] = bgPositionY; + } + else if (props[i] == "background-clip") + { + style.StyleRules["background-clip"] = bgClipValue; + } + else + { + style.StyleRules[props[i]] = values[i]; + } } else { @@ -914,27 +1147,32 @@ namespace NLGUI } else if (props[i] == "background-position") { - //style.StyleRules[props[i]] = "0% 0%"; + style.StyleRules[props[i]] = "0% 0%"; + style.StyleRules["background-position-x"] = "left 0%"; + style.StyleRules["background-position-y"] = "top 0%"; } else if (props[i] == "background-size") { - //style.StyleRules[props[i]] = "auto auto"; + style.StyleRules[props[i]] = "auto auto"; } else if (props[i] == "background-repeat") { - style.StyleRules[props[i]] = "repeat repeat"; + style.StyleRules[props[i]] = "repeat"; } else if(props[i] == "background-attachment") { - //style.StyleRules[props[i]] = "scroll"; + style.StyleRules[props[i]] = "scroll"; } else if(props[i] == "background-origin") { - //style.StyleRules[props[i]] = "padding-box"; + style.StyleRules[props[i]] = "padding-box"; } else if (props[i] == "background-clip") { - //style.StyleRules[props[i]] = "border-box"; + if (bgClipFound) + style.StyleRules[props[i]] = bgClipValue; + else + style.StyleRules[props[i]] = "border-box"; } else if (props[i] == "background-color") { diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 1635e1270..2e6616dbb 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -699,7 +699,20 @@ namespace NLGUI // Add a image download request in the multi_curl void CGroupHTML::addImageDownload(const string &url, CViewBase *img, const CStyleParams &style, TImageType type) { - string finalUrl = upgradeInsecureUrl(getAbsoluteUrl(url)); + std::string finalUrl; + img->setModulateGlobalColor(style.GlobalColor); + + // load the image from local files/bnp + std::string image = CFile::getPath(url) + CFile::getFilenameWithoutExtension(url) + ".tga"; + if (lookupLocalFile(finalUrl, image.c_str(), false)) + { + setImage(img, image, type); + setImageSize(img, style); + return; + } + + // TODO: if no image in cache, nothing is visible + finalUrl = upgradeInsecureUrl(getAbsoluteUrl(url)); // use requested url for local name (cache) string dest = localImageName(url); @@ -1065,6 +1078,7 @@ namespace NLGUI case HTML_BASE: htmlBASE(elm); break; case HTML_BODY: htmlBODY(elm); break; case HTML_BR: htmlBR(elm); break; + case HTML_BUTTON: htmlBUTTON(elm); break; case HTML_DD: htmlDD(elm); break; case HTML_DEL: renderPseudoElement(":before", elm); break; case HTML_DIV: htmlDIV(elm); break; @@ -1088,11 +1102,13 @@ namespace NLGUI case HTML_LI: htmlLI(elm); break; case HTML_LUA: htmlLUA(elm); break; case HTML_META: htmlMETA(elm); break; + case HTML_METER: htmlMETER(elm); break; case HTML_OBJECT: htmlOBJECT(elm); break; case HTML_OL: htmlOL(elm); break; case HTML_OPTION: htmlOPTION(elm); break; case HTML_P: htmlP(elm); break; case HTML_PRE: htmlPRE(elm); break; + case HTML_PROGRESS: htmlPROGRESS(elm); break; case HTML_SCRIPT: htmlSCRIPT(elm); break; case HTML_SELECT: htmlSELECT(elm); break; case HTML_SMALL: renderPseudoElement(":before", elm); break; @@ -1124,6 +1140,7 @@ namespace NLGUI case HTML_BASE: break; case HTML_BODY: renderPseudoElement(":after", elm); break; case HTML_BR: break; + case HTML_BUTTON: htmlBUTTONend(elm); break; case HTML_DD: htmlDDend(elm); break; case HTML_DEL: renderPseudoElement(":after", elm); break; case HTML_DIV: htmlDIVend(elm); break; @@ -1147,6 +1164,7 @@ namespace NLGUI case HTML_LI: htmlLIend(elm); break; case HTML_LUA: htmlLUAend(elm); break; case HTML_META: break; + case HTML_METER: break; case HTML_OBJECT: htmlOBJECTend(elm); break; case HTML_OL: htmlOLend(elm); break; case HTML_OPTION: htmlOPTIONend(elm); break; @@ -1178,26 +1196,20 @@ namespace NLGUI // *************************************************************************** void CGroupHTML::renderPseudoElement(const std::string &pseudo, const CHtmlElement &elm) { - if (pseudo == ":before" && !elm.StyleBefore.empty()) - { - _Style.pushStyle(); - _Style.applyStyle(elm.StyleBefore); - } - else if (pseudo == ":after" && !elm.StyleAfter.empty()) - { - _Style.pushStyle(); - _Style.applyStyle(elm.StyleAfter); - } - else - { - // unknown pseudo element + if (pseudo != ":before" && pseudo != ":after") + return; + + if (!elm.hasPseudo(pseudo)) return; - } + + _Style.pushStyle(); + _Style.applyStyle(elm.getPseudo(pseudo)); // TODO: 'content' should already be tokenized in css parser as it has all the functions for that std::string content = trim(_Style.getStyle("content")); if (toLower(content) == "none" || toLower(content) == "normal") { + _Style.popStyle(); return; } @@ -1207,7 +1219,7 @@ namespace NLGUI { std::string::size_type start; std::string token; - + // not supported // counter, open-quote, close-quote, no-open-quote, no-close-quote if (content[pos] == '"' || content[pos] == '\'') @@ -1328,12 +1340,16 @@ namespace NLGUI beginElement(elm); std::list::iterator it = elm.Children.begin(); - while(it != elm.Children.end()) + if (!_IgnoreChildElements) { - renderDOM(*it); + while(it != elm.Children.end()) + { + renderDOM(*it); - ++it; + ++it; + } } + _IgnoreChildElements = false; endElement(elm); } @@ -1364,6 +1380,7 @@ namespace NLGUI _ParsingLua = false; _LuaHrefHack = false; _IgnoreText = false; + _IgnoreChildElements = false; _BrowseNextTime = false; _PostNextTime = false; _Browsing = false; @@ -1444,7 +1461,6 @@ namespace NLGUI initImageDownload(); initBnpDownload(); - initLibWWW(); } // *************************************************************************** @@ -2747,6 +2763,9 @@ namespace NLGUI // Translate the tooltip ctrlButton->setDefaultContextHelp(ucstring::makeFromUtf8(getLinkTitle())); ctrlButton->setText(tmpStr); + // empty url / button disabled + bool disabled = string(getLink()).empty(); + ctrlButton->setFrozen(disabled); setTextButtonStyle(ctrlButton, style); } @@ -2804,8 +2823,6 @@ namespace NLGUI paragraphChange (); } - string finalUrl; - // No more text in this text view _CurrentViewLink = NULL; @@ -2813,51 +2830,8 @@ namespace NLGUI CViewBitmap *newImage = new CViewBitmap (TCtorParam()); newImage->setId(id); - // - // 1/ try to load the image with the old system (local files in bnp) - // - string image = CFile::getPath(img) + CFile::getFilenameWithoutExtension(img) + ".tga"; - if (lookupLocalFile (finalUrl, image.c_str(), false)) - { - newImage->setRenderLayer(getRenderLayer()+1); - image = finalUrl; - } - else - { - // - // 2/ if it doesn't work, try to load the image in cache - // - image = localImageName(img); - - if (reloadImg && CFile::fileExists(image)) - CFile::deleteFile(image); - - if (lookupLocalFile (finalUrl, image.c_str(), false)) - { - // don't display image that are not power of 2 - try - { - uint32 w, h; - CBitmap::loadSize (image, w, h); - if (w == 0 || h == 0 || ((!NLMISC::isPowerOf2(w) || !NLMISC::isPowerOf2(h)) && !NL3D::CTextureFile::supportNonPowerOfTwoTextures())) - image = "web_del.tga"; - } - catch(const NLMISC::Exception &e) - { - nlwarning(e.what()); - image = "web_del.tga"; - } - } - else - { - // no image in cache - image = "web_del.tga"; - } - - addImageDownload(img, newImage, style); - } - newImage->setTexture (image); - newImage->setModulateGlobalColor(style.GlobalColor); + addImageDownload(img, newImage, style, TImageType::NormalImage); + newImage->setRenderLayer(getRenderLayer()+1); getParagraph()->addChild(newImage); paragraphChange (); @@ -3032,7 +3006,7 @@ namespace NLGUI CCtrlButton *CGroupHTML::addButton(CCtrlButton::EType type, const std::string &name, const std::string &normalBitmap, const std::string &pushedBitmap, const std::string &overBitmap, const char *actionHandler, const char *actionHandlerParams, - const char *tooltip, const CStyleParams &style) + const std::string &tooltip, const CStyleParams &style) { // In a paragraph ? if (!_Paragraph) @@ -3061,26 +3035,6 @@ namespace NLGUI if(id == -1) { normal = localImageName(normalBitmap); - if(!CFile::fileExists(normal)) - { - normal = "web_del.tga"; - } - else - { - try - { - uint32 w, h; - CBitmap::loadSize(normal, w, h); - if (w == 0 || h == 0) - normal = "web_del.tga"; - } - catch(const NLMISC::Exception &e) - { - nlwarning(e.what()); - normal = "web_del.tga"; - } - } - addImageDownload(normalBitmap, ctrlButton, style); } } @@ -3122,7 +3076,7 @@ namespace NLGUI ctrlButton->setParamsOnLeftClick (actionHandlerParams); // Translate the tooltip or display raw text (tooltip from webig) - if (tooltip) + if (!tooltip.empty()) { if (CI18N::hasTranslation(tooltip)) { @@ -3173,6 +3127,7 @@ namespace NLGUI _Cells.clear(); _TR.clear(); _Forms.clear(); + _FormSubmit.clear(); _Groups.clear(); _Divs.clear(); _Anchors.clear(); @@ -3326,9 +3281,9 @@ namespace NLGUI setTitle(_TitleString); } - + std::string CGroupHTML::getTitle() const { - return _TitleString.toUtf8(); + return _TitleString.toUtf8(); }; // *************************************************************************** @@ -3383,19 +3338,30 @@ namespace NLGUI // *************************************************************************** - void CGroupHTML::submitForm (uint formId, const char *submitButtonType, const char *submitButtonName, const char *submitButtonValue, sint32 x, sint32 y) + void CGroupHTML::submitForm(uint button, sint32 x, sint32 y) { - // Form id valid ? - if (formId < _Forms.size()) + if (button >= _FormSubmit.size()) + return; + + for(uint formId = 0; formId < _Forms.size(); formId++) { - _PostNextTime = true; - _PostFormId = formId; - _PostFormSubmitType = submitButtonType; - _PostFormSubmitButton = submitButtonName; - _PostFormSubmitValue = submitButtonValue; - _PostFormSubmitX = x; - _PostFormSubmitY = y; + // case sensitive search (user id is lowecase, auto id is uppercase) + if (_Forms[formId].id == _FormSubmit[button].form) + { + _PostNextTime = true; + _PostFormId = formId; + _PostFormAction = _FormSubmit[button].formAction; + _PostFormSubmitType = _FormSubmit[button].type; + _PostFormSubmitButton = _FormSubmit[button].name; + _PostFormSubmitValue = _FormSubmit[button].value; + _PostFormSubmitX = x; + _PostFormSubmitY = y; + + return; + } } + + nlwarning("Unable to find form '%s' to submit (button '%s')", _FormSubmit[button].form.c_str(), _FormSubmit[button].name.c_str()); } // *************************************************************************** @@ -3434,6 +3400,13 @@ namespace NLGUI bitmap->setRenderLayer(-2); bitmap->setScale(scale); bitmap->setTile(tile); + + // clear size ref for non-scaled image or it does not show up + if (scale || tile) + bitmap->setSizeRef("wh"); + else + bitmap->setSizeRef(""); + addImageDownload(bgtex, view); } } @@ -3562,7 +3535,8 @@ namespace NLGUI // Ref the form CForm &form = _Forms[_PostFormId]; - _URL = form.Action; + // button can override form action url (and methor, but we only do POST) + _URL = _PostFormAction.empty() ? form.Action : _PostFormAction; CUrlParser uri(_URL); _TrustedDomain = isTrustedDomain(uri.host); @@ -3593,7 +3567,7 @@ namespace NLGUI // todo handle unicode POST here if (form.Entries[i].Checkbox->getPushed ()) { - entryData = form.Entries[i].Value; + entryData = form.Entries[i].Value; addEntry = true; } } @@ -4123,7 +4097,7 @@ namespace NLGUI { // clear the page beginBuild(); - + // clear previous page and state removeContent(); @@ -4248,6 +4222,7 @@ namespace NLGUI // Reset default background color setBackgroundColor (BgColor); + setBackground ("blank.tga", true, false); paragraphChange (); } @@ -4772,7 +4747,7 @@ namespace NLGUI nlwarning("BUG: unable to find current element iterator from parent"); return; } - + // where fragment should be moved std::list::iterator insertBefore; if (_CurrentHTMLNextSibling == NULL) @@ -4938,7 +4913,16 @@ namespace NLGUI // td { padding: 1px;} - overwrites cellpadding attribute // table { border-spacing: 2px;} - overwrites cellspacing attribute css += "table { border-collapse: separate;}"; - + // webkit pseudo elements + css += "meter::-webkit-meter-bar, meter::-webkit-optimum-value, meter::-webkit-suboptimum-value, meter::-webkit-even-less-good-value { background: none; }"; + css += "meter::-webkit-meter-bar { background-color: rgb(100, 100, 100); width: 5em; height: 1em;}"; + css += "meter::-webkit-meter-optimum-value { background-color: rgb(80, 220, 80); }"; + css += "meter::-webkit-meter-suboptimum-value { background-color: rgb(220, 220, 80); }"; + css += "meter::-webkit-meter-even-less-good-value { background-color: rgb(220, 80, 80); }"; + // webkit pseudo elements + css += "progress::-webkit-progress-bar, progress::-webkit-progress-value { background: none; }"; + css += "progress::-webkit-progress-bar { background-color: rgb(230, 230, 230); width: 10em; height: 1em; }"; + css += "progress::-webkit-progress-value { background-color: rgb(0, 100, 180);}"; _Style.parseStylesheet(css); } @@ -5043,6 +5027,177 @@ namespace NLGUI return ret; } + void CGroupHTML::HTMLMeterElement::readValues(const CHtmlElement &elm) + { + if (!elm.hasAttribute("value") || !fromString(elm.getAttribute("value"), value)) + value = 0.f; + if (!elm.hasAttribute("min") || !fromString(elm.getAttribute("min"), min)) + min = 0.f; + if (!elm.hasAttribute("max") || !fromString(elm.getAttribute("max"), max)) + max = 1.f; + + // ensure min < max + if (max < min) + std::swap(min, max); + + if (!elm.hasAttribute("low") || !fromString(elm.getAttribute("low"), low)) + low = min; + if (!elm.hasAttribute("high") || !fromString(elm.getAttribute("high"), high)) + high = max; + + if (!elm.hasAttribute("optimum") || !fromString(elm.getAttribute("optimum"), optimum)) + optimum = (max - min) / 2.f; + + // ensure low < high + if (high < low) + std::swap(low, high); + if (low < min) + low = min; + if (high > max) + max = max; + } + + float CGroupHTML::HTMLMeterElement::getValueRatio() const + { + if (max <= min) + return 0.f; + + return (value - min) / (max - min); + } + + CGroupHTML::HTMLMeterElement::EValueRegion CGroupHTML::HTMLMeterElement::getValueRegion() const + { + if (optimum <= low) + { + // low region is optimum + if (value <= low) + return VALUE_OPTIMUM; + else if (value <= high) + return VALUE_SUB_OPTIMAL; + + return VALUE_EVEN_LESS_GOOD; + } + else if (optimum >= high) + { + // high region is optimum + if (value >= high) + return VALUE_OPTIMUM; + else if (value >= low) + return VALUE_SUB_OPTIMAL; + + return VALUE_EVEN_LESS_GOOD; + } + + // middle region is optimum + if (value >= low && value <= high) + return VALUE_OPTIMUM; + + return VALUE_SUB_OPTIMAL; + } + + NLMISC::CRGBA CGroupHTML::HTMLMeterElement::getBarColor(const CHtmlElement &elm, CCssStyle &style) const + { + // color meter (inactive) bar segment + // firefox:: meter { background:none; background-color: #555; }, + // webkit:: meter::-webkit-meter-bar { background:none; background-color: #555; } + // webkit makes background color visible when padding is added + CRGBA color(150, 150, 150, 255); + + // use webkit pseudo elements as thats easier than firefox pseudo classes + // background-color is expected to be set from browser.css + style.pushStyle(); + style.applyStyle(elm.getPseudo(":-webkit-meter-bar")); + if(style.hasStyle("background-color")) + color = style.Current.BackgroundColor; + style.popStyle(); + + return color; + } + + NLMISC::CRGBA CGroupHTML::HTMLMeterElement::getValueColor(const CHtmlElement &elm, CCssStyle &style) const + { + // background-color is expected to be set from browser.css + CRGBA color; + style.pushStyle(); + switch(getValueRegion()) + { + case VALUE_OPTIMUM: + { + style.applyStyle(elm.getPseudo(":-webkit-meter-optimum-value")); + if (style.hasStyle("background-color")) + color = style.Current.BackgroundColor; + break; + } + case VALUE_SUB_OPTIMAL: + { + style.applyStyle(elm.getPseudo(":-webkit-meter-suboptimum-value")); + if (style.hasStyle("background-color")) + color = style.Current.BackgroundColor; + break; + } + case VALUE_EVEN_LESS_GOOD: // fall through + default: + { + style.applyStyle(elm.getPseudo(":-webkit-meter-even-less-good-value")); + if (style.hasStyle("background-color")) + color = style.Current.BackgroundColor; + break; + } + }//switch + style.popStyle(); + + return color; + } + + // **************************************************************************** + void CGroupHTML::HTMLProgressElement::readValues(const CHtmlElement &elm) + { + if (!elm.hasAttribute("value") || !fromString(elm.getAttribute("value"), value)) + value = 0.f; + if (!elm.hasAttribute("max") || !fromString(elm.getAttribute("max"), max)) + max = 1.f; + + if (value > max) + value = max; + } + + // **************************************************************************** + float CGroupHTML::HTMLProgressElement::getValueRatio() const + { + if (max > 0.f) + return value / max; + return 0.f; + } + + // **************************************************************************** + NLMISC::CRGBA CGroupHTML::HTMLProgressElement::getBarColor(const CHtmlElement &elm, CCssStyle &style) const + { + CRGBA color; + + style.pushStyle(); + style.applyStyle(elm.getPseudo(":-webkit-progress-bar")); + if (style.hasStyle("background-color")) + color = style.Current.BackgroundColor; + style.popStyle(); + + return color; + } + + // **************************************************************************** + NLMISC::CRGBA CGroupHTML::HTMLProgressElement::getValueColor(const CHtmlElement &elm, CCssStyle &style) const + { + CRGBA color; + + style.pushStyle(); + style.applyStyle(elm.getPseudo(":-webkit-progress-value")); + if (style.hasStyle("background-color")) + color = style.Current.BackgroundColor; + style.popStyle(); + + return color; + } + + // **************************************************************************** void CGroupHTML::getCellsParameters(const CHtmlElement &elm, bool inherit) { CGroupHTML::CCellParams cellParams; @@ -5084,7 +5239,7 @@ namespace NLGUI valign = _Style.Current.VerticalAlign; else if (elm.hasNonEmptyAttribute("valign")) valign = toLower(elm.getAttribute("valign")); - + if (valign == "top") cellParams.VAlign = CGroupCell::Top; else if (valign == "middle") @@ -5092,10 +5247,115 @@ namespace NLGUI else if (valign == "bottom") cellParams.VAlign = CGroupCell::Bottom; } - + _CellParams.push_back (cellParams); } + // *************************************************************************** + void CGroupHTML::applyBackground(const CHtmlElement &elm) + { + bool root = elm.Value == "html" || elm.Value == "body"; + + // non-empty image + if (_Style.hasStyle("background-image")) + { + bool repeat = _Style.checkStyle("background-repeat", "repeat"); + bool scale = _Style.checkStyle("background-size", "100%"); + std::string image = _Style.getStyle("background-image"); + if (!image.empty()) + { + if (root) + { + setBackground (image, scale, repeat); + } + // TODO: else + + // default background color is transparent, so image does not show + if (!_Style.hasStyle("background-color") || _Style.checkStyle("background-color", "transparent")) + { + _Style.applyStyle("background-color: #fff;"); + } + } + } + + if (_Style.hasStyle("background-color")) + { + CRGBA bgColor = _Style.Current.BackgroundColor; + scanHTMLColor(elm.getAttribute("bgcolor").c_str(), bgColor); + if (root) + { + setBackgroundColor(bgColor); + } + // TODO: else + } + + } + + // *************************************************************************** + void CGroupHTML::insertFormImageButton(const std::string &name, const std::string &tooltip, const std::string &src, const std::string &over, const std::string &formId, const std::string &action, uint32 minWidth, const std::string &templateName) + { + _FormSubmit.push_back(SFormSubmitButton(formId, name, "", "image")); + // Action handler parameters + std::string param = "name=" + getId() + "|button=" + toString(_FormSubmit.size()-1); + + // Add the ctrl button + addButton (CCtrlButton::PushButton, name, src, src, over, "html_submit_form", param.c_str(), tooltip.c_str(), _Style.Current); + } + + // *************************************************************************** + void CGroupHTML::insertFormTextButton(const std::string &name, const std::string &tooltip, const std::string &value, const std::string &formId, const std::string &formAction, uint32 minWidth, const std::string &templateName) + { + _FormSubmit.push_back(SFormSubmitButton(formId, name, value, "submit")); + // Action handler parameters + string param = "name=" + getId() + "|button=" + toString(_FormSubmit.size()-1); + + // Add the ctrl button + if (!_Paragraph) + { + newParagraph (0); + paragraphChange (); + } + + string buttonTemplate(!templateName.empty() ? templateName : DefaultButtonGroup); + typedef pair TTmplParam; + vector tmplParams; + tmplParams.push_back(TTmplParam("id", name)); + tmplParams.push_back(TTmplParam("onclick", "html_submit_form")); + tmplParams.push_back(TTmplParam("onclick_param", param)); + tmplParams.push_back(TTmplParam("active", "true")); + if (minWidth > 0) tmplParams.push_back(TTmplParam("wmin", toString(minWidth))); + CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(buttonTemplate, _Paragraph->getId(), tmplParams); + if (buttonGroup) + { + // Add the ctrl button + CCtrlTextButton *ctrlButton = dynamic_cast(buttonGroup->getCtrl("button")); + if (!ctrlButton) ctrlButton = dynamic_cast(buttonGroup->getCtrl("b")); + if (ctrlButton) + { + ctrlButton->setModulateGlobalColorAll (_Style.Current.GlobalColor); + + // Translate the tooltip + if (!tooltip.empty()) + { + if (CI18N::hasTranslation(tooltip)) + { + ctrlButton->setDefaultContextHelp(CI18N::get(tooltip)); + } + else + { + ctrlButton->setDefaultContextHelp(ucstring(tooltip)); + } + } + + ctrlButton->setText(ucstring::makeFromUtf8(value)); + + setTextButtonStyle(ctrlButton, _Style.Current); + } + getParagraph()->addChild (buttonGroup); + paragraphChange (); + } + } + // *************************************************************************** void CGroupHTML::htmlA(const CHtmlElement &elm) { @@ -5165,39 +5425,7 @@ namespace NLGUI _Style.applyStyle("background-color: " + elm.getAttribute("bgcolor")); } - if (_Style.hasStyle("background-color")) - { - CRGBA bgColor = _Style.Current.BackgroundColor; - scanHTMLColor(elm.getAttribute("bgcolor").c_str(), bgColor); - setBackgroundColor(bgColor); - } - - if (elm.hasNonEmptyAttribute("style")) - { - string style = elm.getAttribute("style"); - - TStyle styles = parseStyle(style); - TStyle::iterator it; - - it = styles.find("background-repeat"); - bool repeat = (it != styles.end() && it->second == "1"); - - // Webig only - it = styles.find("background-scale"); - bool scale = (it != styles.end() && it->second == "1"); - - it = styles.find("background-image"); - if (it != styles.end()) - { - string image = it->second; - string::size_type texExt = toLower(image).find("url("); - // Url image - if (texExt != string::npos) - // Remove url() - image = image.substr(4, image.size()-5); - setBackground (image, scale, repeat); - } - } + applyBackground(elm); renderPseudoElement(":before", elm); } @@ -5213,6 +5441,55 @@ namespace NLGUI addString(tmp); } + // *************************************************************************** + void CGroupHTML::htmlBUTTON(const CHtmlElement &elm) + { + std::string name = elm.getAttribute("name"); + std::string value = elm.getAttribute("value"); + std::string formId = elm.getAttribute("form"); + std::string formAction = elm.getAttribute("formaction"); + std::string tooltip = elm.getAttribute("tooltip"); + bool disabled = elm.hasAttribute("disabled"); + + if (!formAction.empty()) + { + formAction = getAbsoluteUrl(formAction); + } + + _FormSubmit.push_back(SFormSubmitButton(formId, name, value, "text", formAction)); + // Action handler parameters + std::string param; + if (!disabled) + { + if (elm.getAttribute("type") == "submit") + { + param = "ah:html_submit_form&name=" + getId() + "&button=" + toString(_FormSubmit.size()-1); + } + else + { + param = "ah:"; + } + } + + _A.push_back(true); + _Link.push_back(param); + _LinkTitle.push_back(tooltip); + _LinkClass.push_back("ryzom-ui-button"); + + // TODO: this creates separate button element + //renderPseudoElement(":before", elm); + } + void CGroupHTML::htmlBUTTONend(const CHtmlElement &elm) + { + // TODO: this creates separate button element + //renderPseudoElement(":after", elm); + + popIfNotEmpty(_A); + popIfNotEmpty(_Link); + popIfNotEmpty(_LinkTitle); + popIfNotEmpty(_LinkClass); + } + // *************************************************************************** void CGroupHTML::htmlDD(const CHtmlElement &elm) { @@ -5429,7 +5706,7 @@ namespace NLGUI { newParagraph(LIBeginSpace); } - + renderPseudoElement(":before", elm); } @@ -5466,6 +5743,12 @@ namespace NLGUI { // Build the form CGroupHTML::CForm form; + // id check is case sensitive and auto id's are uppercase + form.id = toLower(trim(elm.getAttribute("id"))); + if (form.id.empty()) + { + form.id = toString("FORM%d", _Forms.size()); + } // Get the action name if (elm.hasNonEmptyAttribute("action")) @@ -5549,7 +5832,7 @@ namespace NLGUI _Style.applyRootStyle(elm.getAttribute("style")); _Style.Current = _Style.Root; } - setBackgroundColor(_Style.Current.BackgroundColor); + applyBackground(elm); } // *************************************************************************** @@ -5589,26 +5872,23 @@ namespace NLGUI // Tooltip // keep "alt" attribute for backward compatibility - std::string strtooltip = elm.getAttribute("alt"); + std::string tooltip = elm.getAttribute("alt"); // tooltip if (elm.hasNonEmptyAttribute("title")) - strtooltip = elm.getAttribute("title"); - - const char *tooltip = NULL; - // note: uses pointer to string data - if (!strtooltip.empty()) - tooltip = strtooltip.c_str(); + tooltip = elm.getAttribute("title"); // Mouse over image string overSrc = elm.getAttribute("data-over-src"); - if (getA() && getParent () && getParent ()->getParent()) + // inside a/button with valid url (ie, button is not disabled) + string url = getLink(); + if (getA() && !url.empty() && getParent() && getParent()->getParent()) { - string params = "name=" + getId() + "|url=" + getLink (); + string params = "name=" + getId() + "|url=" + url; addButton(CCtrlButton::PushButton, id, src, src, overSrc, "browse", params.c_str(), tooltip, _Style.Current); } else - if (tooltip || !overSrc.empty()) + if (!tooltip.empty() || !overSrc.empty()) { addButton(CCtrlButton::PushButton, id, src, src, overSrc, "", "", tooltip, _Style.Current); } @@ -5648,7 +5928,8 @@ namespace NLGUI templateName = elm.getAttribute("z_input_tmpl"); // Widget minimal width - string minWidth = elm.getAttribute("z_input_width"); + uint32 minWidth = 0; + fromString(elm.getAttribute("z_input_width"), minWidth); // std::string type = trim(elm.getAttribute("type")); @@ -5657,102 +5938,29 @@ namespace NLGUI // no 'type' attribute, or empty return; } - + // Global color flag if (elm.hasAttribute("global_color")) _Style.Current.GlobalColor = true; // Tooltip - std::string strtooltip = elm.getAttribute("alt"); - const char *tooltip = NULL; - // note: uses pointer to strtooltip data - if (!strtooltip.empty()) - tooltip = strtooltip.c_str(); + std::string tooltip = elm.getAttribute("alt"); if (type == "image") { - // The submit button string name = elm.getAttribute("name"); - string normal = elm.getAttribute("src"); - string pushed; - string over; + string src = elm.getAttribute("src"); + string over = elm.getAttribute("data-over-src"); - // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" - string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name + "|submit_button_type=image"; - - // Add the ctrl button - addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over, - "html_submit_form", param.c_str(), tooltip, _Style.Current); + insertFormImageButton(name, tooltip, src, over, _Forms.back().id, "", minWidth, templateName); } else if (type == "button" || type == "submit") { // The submit button string name = elm.getAttribute("name"); - string normal = elm.getAttribute("src"); - string text = elm.getAttribute("value"); - string pushed; - string over; - - string buttonTemplate(!templateName.empty() ? templateName : DefaultButtonGroup ); - - // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" - string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name + "|submit_button_type=submit"; - if (!text.empty()) - { - // escape AH param separator - string tmp = text; - while(NLMISC::strFindReplace(tmp, "|", "|")) - ; - param = param + "|submit_button_value=" + tmp; - } - - // Add the ctrl button - if (!_Paragraph) - { - newParagraph (0); - paragraphChange (); - } - - typedef pair TTmplParam; - vector tmplParams; - tmplParams.push_back(TTmplParam("id", name)); - tmplParams.push_back(TTmplParam("onclick", "html_submit_form")); - tmplParams.push_back(TTmplParam("onclick_param", param)); - //tmplParams.push_back(TTmplParam("text", text)); - tmplParams.push_back(TTmplParam("active", "true")); - if (!minWidth.empty()) - tmplParams.push_back(TTmplParam("wmin", minWidth)); - CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(buttonTemplate, _Paragraph->getId(), tmplParams); - if (buttonGroup) - { - - // Add the ctrl button - CCtrlTextButton *ctrlButton = dynamic_cast(buttonGroup->getCtrl("button")); - if (!ctrlButton) ctrlButton = dynamic_cast(buttonGroup->getCtrl("b")); - if (ctrlButton) - { - ctrlButton->setModulateGlobalColorAll (_Style.Current.GlobalColor); + string value = elm.getAttribute("value"); - // Translate the tooltip - if (tooltip) - { - if (CI18N::hasTranslation(tooltip)) - { - ctrlButton->setDefaultContextHelp(CI18N::get(tooltip)); - } - else - { - ctrlButton->setDefaultContextHelp(ucstring(tooltip)); - } - } - - ctrlButton->setText(ucstring::makeFromUtf8(text)); - - setTextButtonStyle(ctrlButton, _Style.Current); - } - getParagraph()->addChild (buttonGroup); - paragraphChange (); - } + insertFormTextButton(name, tooltip, value, _Forms.back().id, "", minWidth, templateName); } else if (type == "text") { @@ -5922,7 +6130,7 @@ namespace NLGUI _ParsingLua = _TrustedDomain; // Only parse lua if TrustedDomain _LuaScript.clear(); } - + void CGroupHTML::htmlLUAend(const CHtmlElement &elm) { if (_ParsingLua && _TrustedDomain) @@ -5972,6 +6180,50 @@ namespace NLGUI } } + // *************************************************************************** + void CGroupHTML::htmlMETER(const CHtmlElement &elm) + { + HTMLMeterElement meter; + meter.readValues(elm); + + std::string id = "meter"; + if (elm.hasAttribute("id")) + id = elm.getAttribute("id"); + + // width: 5em, height: 1em + uint32 width = _Style.Current.Width > -1 ? _Style.Current.Width : _Style.Current.FontSize * 5; + uint32 height = _Style.Current.Height > -1 ? _Style.Current.Height : _Style.Current.FontSize; + uint32 border = _Style.Current.BorderWidth > -1 ? _Style.Current.BorderWidth : 0; + + uint barw = (uint) (width * meter.getValueRatio()); + CRGBA bgColor = meter.getBarColor(elm, _Style); + CRGBA valueColor = meter.getValueColor(elm, _Style); + + typedef pair TTmplParam; + vector tmplParams; + tmplParams.push_back(TTmplParam("id", id)); + tmplParams.push_back(TTmplParam("active", "true")); + tmplParams.push_back(TTmplParam("w", toString(width))); + tmplParams.push_back(TTmplParam("h", toString(height))); + tmplParams.push_back(TTmplParam("border_x2", toString(border*2))); + tmplParams.push_back(TTmplParam("bgtexture", "blank.tga")); + tmplParams.push_back(TTmplParam("bgcolor", bgColor.toString())); + tmplParams.push_back(TTmplParam("value_w", toString(barw))); + tmplParams.push_back(TTmplParam("value_texture", "blank.tga")); + tmplParams.push_back(TTmplParam("value_color", valueColor.toString())); + + CInterfaceGroup *gr = CWidgetManager::getInstance()->getParser()->createGroupInstance("html_meter", getParagraph()->getId(), &tmplParams[0], (uint)tmplParams.size()); + if (gr) + { + renderPseudoElement(":before", elm); + getParagraph()->addChild(gr); + renderPseudoElement(":after", elm); + + // ignore any inner elements + _IgnoreChildElements = true; + } + } + // *************************************************************************** void CGroupHTML::htmlOBJECT(const CHtmlElement &elm) { @@ -6146,6 +6398,50 @@ namespace NLGUI popIfNotEmpty(_PRE); } + // *************************************************************************** + void CGroupHTML::htmlPROGRESS(const CHtmlElement &elm) + { + HTMLProgressElement progress; + progress.readValues(elm); + + std::string id = "progress"; + if (elm.hasAttribute("id")) + id = elm.getAttribute("id"); + + // width: 10em, height: 1em + uint32 width = _Style.Current.Width > -1 ? _Style.Current.Width : _Style.Current.FontSize * 10; + uint32 height = _Style.Current.Height > -1 ? _Style.Current.Height : _Style.Current.FontSize; + uint32 border = _Style.Current.BorderWidth > -1 ? _Style.Current.BorderWidth : 0; + + uint barw = (uint) (width * progress.getValueRatio()); + CRGBA bgColor = progress.getBarColor(elm, _Style); + CRGBA valueColor = progress.getValueColor(elm, _Style); + + typedef pair TTmplParam; + vector tmplParams; + tmplParams.push_back(TTmplParam("id", id)); + tmplParams.push_back(TTmplParam("active", "true")); + tmplParams.push_back(TTmplParam("w", toString(width))); + tmplParams.push_back(TTmplParam("h", toString(height))); + tmplParams.push_back(TTmplParam("border_x2", toString(border*2))); + tmplParams.push_back(TTmplParam("bgtexture", "blank.tga")); + tmplParams.push_back(TTmplParam("bgcolor", bgColor.toString())); + tmplParams.push_back(TTmplParam("value_w", toString(barw))); + tmplParams.push_back(TTmplParam("value_texture", "blank.tga")); + tmplParams.push_back(TTmplParam("value_color", valueColor.toString())); + + CInterfaceGroup *gr = CWidgetManager::getInstance()->getParser()->createGroupInstance("html_progress", getParagraph()->getId(), &tmplParams[0], (uint)tmplParams.size()); + if (gr) + { + renderPseudoElement(":before", elm); + getParagraph()->addChild(gr); + renderPseudoElement(":after", elm); + + // ignore any inner elements + _IgnoreChildElements = true; + } + } + // *************************************************************************** void CGroupHTML::htmlSCRIPT(const CHtmlElement &elm) { @@ -6249,7 +6545,7 @@ namespace NLGUI { if (elm.hasNonEmptyAttribute("cellspacing")) fromString(elm.getAttribute("cellspacing"), table->CellSpacing); - + // TODO: cssLength, horiz/vert values if (_Style.hasStyle("border-spacing")) fromString(_Style.getStyle("border-spacing"), table->CellSpacing); @@ -6356,29 +6652,16 @@ namespace NLGUI _Cells.back() = new CGroupCell(CViewBase::TCtorParam()); - if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat")) + if (_Style.checkStyle("background-repeat", "repeat")) _Cells.back()->setTextureTile(true); - if (_Style.checkStyle("background-scale", "1") || _Style.checkStyle("background-size", "cover")) + if (_Style.checkStyle("background-size", "100%")) _Cells.back()->setTextureScale(true); if (_Style.hasStyle("background-image")) { string image = _Style.getStyle("background-image"); - - string::size_type texExt = toLower(image).find("url("); - // Url image - if (texExt != string::npos) - { - // Remove url() - image = image.substr(4, image.size()-5); - addImageDownload(image, _Cells.back()); - // Image in BNP - } - else - { - _Cells.back()->setTexture(image); - } + addImageDownload(image, _Cells.back()); } if (elm.hasNonEmptyAttribute("colspan")) @@ -6399,7 +6682,7 @@ namespace NLGUI getPercentage (_Cells.back()->WidthWanted, _Cells.back()->TableRatio, _Style.getStyle("width").c_str()); else if (elm.hasNonEmptyAttribute("width")) getPercentage (_Cells.back()->WidthWanted, _Cells.back()->TableRatio, elm.getAttribute("width").c_str()); - + if (_Style.hasStyle("height")) getPercentage (_Cells.back()->Height, temp, _Style.getStyle("height").c_str()); else if (elm.hasNonEmptyAttribute("height")) diff --git a/code/nel/src/gui/html_element.cpp b/code/nel/src/gui/html_element.cpp index 215c1c9f5..141fa87af 100644 --- a/code/nel/src/gui/html_element.cpp +++ b/code/nel/src/gui/html_element.cpp @@ -82,6 +82,46 @@ namespace NLGUI } } + // *************************************************************************** + void CHtmlElement::clearPseudo() + { + _Pseudo.clear(); + } + + // *************************************************************************** + bool CHtmlElement::hasPseudo(const std::string &key) const + { + return _Pseudo.find(key) != _Pseudo.end(); + } + + // *************************************************************************** + TStyle CHtmlElement::getPseudo(const std::string &key) const + { + std::map::const_iterator it = _Pseudo.find(key); + if (it != _Pseudo.end()) + return it->second; + + return TStyle(); + } + + // *************************************************************************** + void CHtmlElement::setPseudo(const std::string &key, const TStyle &style) + { + std::map::iterator it = _Pseudo.find(key); + if (it != _Pseudo.end()) + { + // insert into previous, override previous values if they exist + for(TStyle::const_iterator itStyle = style.begin(); itStyle != style.end(); ++itStyle) + { + it->second[itStyle->first] = itStyle->second; + } + } + else + { + _Pseudo[key] = style; + } + } + // *************************************************************************** std::string CHtmlElement::toString(bool tree, uint depth) const { diff --git a/code/nel/src/gui/html_parser.cpp b/code/nel/src/gui/html_parser.cpp index d411b856e..1c5914bb5 100644 --- a/code/nel/src/gui/html_parser.cpp +++ b/code/nel/src/gui/html_parser.cpp @@ -59,8 +59,6 @@ namespace NLGUI // recursive function to walk html document void CHtmlParser::parseNode(xmlNode *a_node, CHtmlElement &parent, std::string &styleString, std::vector &links) const { - SGML_dtd *HTML_DTD = HTML_dtd (); - uint childIndex = 0; uint element_number; xmlNode *node = a_node; @@ -73,12 +71,8 @@ namespace NLGUI else if (node->type == XML_ELEMENT_NODE) { - // find libwww tag - for(element_number = 0; element_numbername, (const xmlChar *)HTML_DTD->tags[element_number].name.c_str(), xmlStrlen(node->name)) == 0) - break; - } + // find html element + element_number = htmlElementLookup((const char*)node->name); // get pointer to previous sibling CHtmlElement *prevSibling = NULL; diff --git a/code/nel/src/gui/libwww.cpp b/code/nel/src/gui/libwww.cpp index 0ee6c01f2..56e7f0c71 100644 --- a/code/nel/src/gui/libwww.cpp +++ b/code/nel/src/gui/libwww.cpp @@ -29,268 +29,177 @@ using namespace NLMISC; namespace NLGUI { - - // *************************************************************************** - - /// the cookie value for session identification (nel cookie) - std::string CurrentCookie; - - /// store all cookies we receive and resent them depending of the domain - static std::map > HTTPCookies; - - // *************************************************************************** - - // Some DTD table - - // Here, modify the DTD table to change the HTML parser (add new tags for examples) - - #undef HTML_ATTR - #define HTML_ATTR(a,b) { (char*) #b } - - HTAttr html_attr[] = - { - HTML_ATTR(HTML,DIR), - HTML_ATTR(HTML,LANG), - HTML_ATTR(HTML,VERSION), - HTML_ATTR(HTML,STYLE), - { 0 } - }; - - HTAttr a_attr[] = - { - HTML_ATTR(A,ACCESSKEY), - HTML_ATTR(A,CHARSET), - HTML_ATTR(A,CLASS), - HTML_ATTR(A,COORDS), - HTML_ATTR(A,DIR), - HTML_ATTR(A,HREF), - HTML_ATTR(A,HREFLANG), - HTML_ATTR(A,ID), - HTML_ATTR(A,NAME), - HTML_ATTR(A,REL), - HTML_ATTR(A,REV), - HTML_ATTR(A,SHAPE), - HTML_ATTR(A,STYLE), - HTML_ATTR(A,TABINDEX), - HTML_ATTR(A,TARGET), - HTML_ATTR(A,TYPE), - HTML_ATTR(A,TITLE), - HTML_ATTR(A,Z_ACTION_CATEGORY), - HTML_ATTR(A,Z_ACTION_PARAMS), - HTML_ATTR(A,Z_ACTION_SHORTCUT), - { 0 } - }; - - HTAttr table_attr[] = - { - HTML_ATTR(TABLE,ALIGN), - HTML_ATTR(TABLE,BGCOLOR), - HTML_ATTR(TABLE,BORDER), - HTML_ATTR(TABLE,BORDERCOLOR), - HTML_ATTR(TABLE,CELLPADDING), - HTML_ATTR(TABLE,CELLSPACING), - HTML_ATTR(TABLE,CLASS), - HTML_ATTR(TABLE,DIR), - HTML_ATTR(TABLE,FRAME), - HTML_ATTR(TABLE,ID), - HTML_ATTR(TABLE,L_MARGIN), - HTML_ATTR(TABLE,LANG), - HTML_ATTR(TABLE,NOWRAP), - HTML_ATTR(TABLE,RULES), - HTML_ATTR(TABLE,SUMMARY), - HTML_ATTR(TABLE,STYLE), - HTML_ATTR(TABLE,TITLE), - HTML_ATTR(TABLE,VALIGN), - HTML_ATTR(TABLE,WIDTH), - { 0 } - }; - - HTAttr tr_attr[] = - { - HTML_ATTR(TR,ALIGN), - HTML_ATTR(TR,BGCOLOR), - HTML_ATTR(TR,L_MARGIN), - HTML_ATTR(TR,NOWRAP), - HTML_ATTR(TR,VALIGN), - HTML_ATTR(TR,STYLE), - { 0 } - }; - - HTAttr td_attr[] = - { - HTML_ATTR(TD,ABBR), - HTML_ATTR(TD,ALIGN), - HTML_ATTR(TD,AXIS), - HTML_ATTR(TD,BGCOLOR), - HTML_ATTR(TD,CHAR), - HTML_ATTR(TD,CHAROFF), - HTML_ATTR(TD,CLASS), - HTML_ATTR(TD,COLSPAN), - HTML_ATTR(TD,DIR), - HTML_ATTR(TD,ID), - HTML_ATTR(TD,HEADERS), - HTML_ATTR(TD,HEIGHT), - HTML_ATTR(TD,L_MARGIN), - HTML_ATTR(TD,LANG), - HTML_ATTR(TD,NOWRAP), - HTML_ATTR(TD,ROWSPAN), - HTML_ATTR(TD,SCOPE), - HTML_ATTR(TD,STYLE), - HTML_ATTR(TD,TITLE), - HTML_ATTR(TD,VALIGN), - HTML_ATTR(TD,WIDTH), - { 0 } - }; - - HTAttr img_attr[] = - { - HTML_ATTR(IMG,ALIGN), - HTML_ATTR(IMG,ALT), - HTML_ATTR(IMG,BORDER), - HTML_ATTR(IMG,CLASS), - HTML_ATTR(IMG,DIR), - HTML_ATTR(IMG,GLOBAL_COLOR), - HTML_ATTR(IMG,HEIGHT), - HTML_ATTR(IMG,HSPACE), - HTML_ATTR(IMG,ID), - HTML_ATTR(IMG,ISMAP), - HTML_ATTR(IMG,LANG), - HTML_ATTR(IMG,LONGDESC), - HTML_ATTR(IMG,SRC), - HTML_ATTR(IMG,STYLE), - HTML_ATTR(IMG,TITLE), - HTML_ATTR(IMG,USEMAP), - HTML_ATTR(IMG,VSPACE), - HTML_ATTR(IMG,WIDTH), - // not sorted to keep enum values - HTML_ATTR(IMG,DATA-OVER-SRC), - { 0 } - }; - - HTAttr input_attr[] = - { - HTML_ATTR(INPUT,ACCEPT), - HTML_ATTR(INPUT,ACCESSKEY), - HTML_ATTR(INPUT,ALIGN), - HTML_ATTR(INPUT,ALT), - HTML_ATTR(INPUT,CHECKED), - HTML_ATTR(INPUT,CLASS), - HTML_ATTR(INPUT,DIR), - HTML_ATTR(INPUT,DISABLED), - HTML_ATTR(INPUT,GLOBAL_COLOR), - HTML_ATTR(INPUT,ID), - HTML_ATTR(INPUT,LANG), - HTML_ATTR(INPUT,MAXLENGTH), - HTML_ATTR(INPUT,NAME), - HTML_ATTR(INPUT,READONLY), - HTML_ATTR(INPUT,SIZE), - HTML_ATTR(INPUT,SRC), - HTML_ATTR(INPUT,STYLE), - HTML_ATTR(INPUT,TABINDEX), - HTML_ATTR(INPUT,TITLE), - HTML_ATTR(INPUT,TYPE), - HTML_ATTR(INPUT,USEMAP), - HTML_ATTR(INPUT,VALUE), - HTML_ATTR(INPUT,Z_BTN_TMPL), - HTML_ATTR(INPUT,Z_INPUT_TMPL), - HTML_ATTR(INPUT,Z_INPUT_WIDTH), - { 0 } - }; - - HTAttr textarea_attr[] = - { - HTML_ATTR(TEXTAREA,CLASS), - HTML_ATTR(TEXTAREA,COLS), - HTML_ATTR(TEXTAREA,DIR), - HTML_ATTR(TEXTAREA,DISABLED), - HTML_ATTR(TEXTAREA,ID), - HTML_ATTR(TEXTAREA,LANG), - HTML_ATTR(TEXTAREA,MAXLENGTH), - HTML_ATTR(TEXTAREA,NAME), - HTML_ATTR(TEXTAREA,READONLY), - HTML_ATTR(TEXTAREA,ROWS), - HTML_ATTR(TEXTAREA,STYLE), - HTML_ATTR(TEXTAREA,TABINDEX), - HTML_ATTR(TEXTAREA,TITLE), - HTML_ATTR(TEXTAREA,Z_INPUT_TMPL), - { 0 } - }; - - HTAttr p_attr[] = + struct CNameToHtmlElement { - HTML_ATTR(P,QUICK_HELP_CONDITION), - HTML_ATTR(P,QUICK_HELP_EVENTS), - HTML_ATTR(P,QUICK_HELP_LINK), - HTML_ATTR(P,NAME), - HTML_ATTR(P,STYLE), - { 0 } + HTMLElement ID; + const char* Name; + CNameToHtmlElement(HTMLElement id, const char*name) + : ID(id), Name(name) {} }; - - HTAttr div_attr[] = - { - HTML_ATTR(DIV,CLASS), - HTML_ATTR(DIV,ID), - HTML_ATTR(DIV,NAME), - HTML_ATTR(DIV,STYLE), - { 0 } - }; - - HTAttr span_attr[] = - { - HTML_ATTR(SPAN,CLASS), - HTML_ATTR(SPAN,ID), - HTML_ATTR(SPAN,STYLE), - { 0 } + // sorted list of HTML_ELEMENT enum to TAG name + static CNameToHtmlElement htmlElementToName[] = + { + CNameToHtmlElement(HTML_A, "a"), + CNameToHtmlElement(HTML_ABBR, "abbr"), + CNameToHtmlElement(HTML_ADDRESS, "address"), + CNameToHtmlElement(HTML_APPLET, "applet"), + CNameToHtmlElement(HTML_AREA, "area"), + CNameToHtmlElement(HTML_ARTICLE, "article"), + CNameToHtmlElement(HTML_ASIDE, "aside"), + CNameToHtmlElement(HTML_AUDIO, "audio"), + CNameToHtmlElement(HTML_B, "b"), + CNameToHtmlElement(HTML_BASE, "base"), + CNameToHtmlElement(HTML_BDI, "bdi"), + CNameToHtmlElement(HTML_BDO, "bdo"), + CNameToHtmlElement(HTML_BLOCKQUOTE, "blockquote"), + CNameToHtmlElement(HTML_BODY, "body"), + CNameToHtmlElement(HTML_BR, "br"), + CNameToHtmlElement(HTML_BUTTON, "button"), + CNameToHtmlElement(HTML_CANVAS, "canvas"), + CNameToHtmlElement(HTML_CAPTION, "caption"), + CNameToHtmlElement(HTML_CITE, "cite"), + CNameToHtmlElement(HTML_CODE, "code"), + CNameToHtmlElement(HTML_COL, "col"), + CNameToHtmlElement(HTML_COLGROUP, "colgroup"), + CNameToHtmlElement(HTML_DATA, "data"), + CNameToHtmlElement(HTML_DATALIST, "datalist"), + CNameToHtmlElement(HTML_DD, "dd"), + CNameToHtmlElement(HTML_DEL, "del"), + CNameToHtmlElement(HTML_DETAILS, "details"), + CNameToHtmlElement(HTML_DFN, "dfn"), + CNameToHtmlElement(HTML_DIALOG, "dialog"), + CNameToHtmlElement(HTML_DIR, "dir"), + CNameToHtmlElement(HTML_DIV, "div"), + CNameToHtmlElement(HTML_DL, "dl"), + CNameToHtmlElement(HTML_DT, "dt"), + CNameToHtmlElement(HTML_EM, "em"), + CNameToHtmlElement(HTML_EMBED, "embed"), + CNameToHtmlElement(HTML_FIELDSET, "fieldset"), + CNameToHtmlElement(HTML_FIGCAPTION, "figcaption"), + CNameToHtmlElement(HTML_FIGURE, "figure"), + CNameToHtmlElement(HTML_FONT, "font"), + CNameToHtmlElement(HTML_FOOTER, "footer"), + CNameToHtmlElement(HTML_FORM, "form"), + CNameToHtmlElement(HTML_H1, "h1"), + CNameToHtmlElement(HTML_H2, "h2"), + CNameToHtmlElement(HTML_H3, "h3"), + CNameToHtmlElement(HTML_H4, "h4"), + CNameToHtmlElement(HTML_H5, "h5"), + CNameToHtmlElement(HTML_H6, "h6"), + CNameToHtmlElement(HTML_HEAD, "head"), + CNameToHtmlElement(HTML_HEADER, "header"), + CNameToHtmlElement(HTML_HGROUP, "hgroup"), + CNameToHtmlElement(HTML_HR, "hr"), + CNameToHtmlElement(HTML_HTML, "html"), + CNameToHtmlElement(HTML_I, "i"), + CNameToHtmlElement(HTML_IFRAME, "iframe"), + CNameToHtmlElement(HTML_IMG, "img"), + CNameToHtmlElement(HTML_INPUT, "input"), + CNameToHtmlElement(HTML_INS, "ins"), + CNameToHtmlElement(HTML_KBD, "kbd"), + CNameToHtmlElement(HTML_LABEL, "label"), + CNameToHtmlElement(HTML_LEGEND, "legend"), + CNameToHtmlElement(HTML_LI, "li"), + CNameToHtmlElement(HTML_LINK, "link"), + CNameToHtmlElement(HTML_LUA, "lua"), + CNameToHtmlElement(HTML_MAIN, "main"), + CNameToHtmlElement(HTML_MAP, "map"), + CNameToHtmlElement(HTML_MARK, "mark"), + CNameToHtmlElement(HTML_MENU, "menu"), + CNameToHtmlElement(HTML_MENUITEM, "menuitem"), + CNameToHtmlElement(HTML_META, "meta"), + CNameToHtmlElement(HTML_METER, "meter"), + CNameToHtmlElement(HTML_NAV, "nav"), + CNameToHtmlElement(HTML_NOEMBED, "noembed"), + CNameToHtmlElement(HTML_NOSCRIPT, "noscript"), + CNameToHtmlElement(HTML_OBJECT, "object"), + CNameToHtmlElement(HTML_OL, "ol"), + CNameToHtmlElement(HTML_OPTGROUP, "optgroup"), + CNameToHtmlElement(HTML_OPTION, "option"), + CNameToHtmlElement(HTML_OUTPUT, "output"), + CNameToHtmlElement(HTML_P, "p"), + CNameToHtmlElement(HTML_PARAM, "param"), + CNameToHtmlElement(HTML_PICTURE, "picture"), + CNameToHtmlElement(HTML_PRE, "pre"), + CNameToHtmlElement(HTML_PROGRESS, "progress"), + CNameToHtmlElement(HTML_Q, "q"), + CNameToHtmlElement(HTML_RB, "rb"), + CNameToHtmlElement(HTML_RP, "rp"), + CNameToHtmlElement(HTML_RT, "rt"), + CNameToHtmlElement(HTML_RTC, "rtc"), + CNameToHtmlElement(HTML_RUBY, "ruby"), + CNameToHtmlElement(HTML_S, "s"), + CNameToHtmlElement(HTML_SAMP, "samp"), + CNameToHtmlElement(HTML_SCRIPT, "script"), + CNameToHtmlElement(HTML_SECTION, "section"), + CNameToHtmlElement(HTML_SELECT, "select"), + CNameToHtmlElement(HTML_SMALL, "small"), + CNameToHtmlElement(HTML_SOURCE, "source"), + CNameToHtmlElement(HTML_SPAN, "span"), + CNameToHtmlElement(HTML_STRONG, "strong"), + CNameToHtmlElement(HTML_STYLE, "style"), + CNameToHtmlElement(HTML_SUB, "sub"), + CNameToHtmlElement(HTML_SUMMARY, "summary"), + CNameToHtmlElement(HTML_SUP, "sup"), + CNameToHtmlElement(HTML_TABLE, "table"), + CNameToHtmlElement(HTML_TBODY, "tbody"), + CNameToHtmlElement(HTML_TD, "td"), + CNameToHtmlElement(HTML_TEXTAREA, "textarea"), + CNameToHtmlElement(HTML_TFOOT, "tfoot"), + CNameToHtmlElement(HTML_TH, "th"), + CNameToHtmlElement(HTML_THEAD, "thead"), + CNameToHtmlElement(HTML_TIME, "time"), + CNameToHtmlElement(HTML_TITLE, "title"), + CNameToHtmlElement(HTML_TR, "tr"), + CNameToHtmlElement(HTML_TRACK, "track"), + CNameToHtmlElement(HTML_TT, "tt"), + CNameToHtmlElement(HTML_U, "u"), + CNameToHtmlElement(HTML_UL, "ul"), + CNameToHtmlElement(HTML_VAR, "var"), + CNameToHtmlElement(HTML_VIDEO, "video"), + CNameToHtmlElement(HTML_WBR, "wbr") }; - HTAttr h1_attr[] = + HTMLElement htmlElementLookup(const char* name) { - HTML_ATTR(H1,CLASS), - HTML_ATTR(H1,ID), - HTML_ATTR(H1,STYLE), - { 0 } - }; + uint end = sizeofarray(htmlElementToName); + uint mid = end >> 1; + sint ret; + while(mid < end) + { + sint ret = nlstricmp(name, htmlElementToName[mid].Name); + if (ret == 0) + { + return htmlElementToName[mid].ID; + } + else if (ret < 0) + { + // lower half + end = mid; + mid = end >> 1; + } + else + { + // upper half + mid++; + mid += (end - mid) >> 1; + } + } - HTAttr h2_attr[] = - { - HTML_ATTR(H2,CLASS), - HTML_ATTR(H2,ID), - HTML_ATTR(H2,STYLE), - { 0 } - }; + // not found + return HTML_NB_ELEMENTS; + } - HTAttr h3_attr[] = - { - HTML_ATTR(H3,CLASS), - HTML_ATTR(H3,ID), - HTML_ATTR(H3,STYLE), - { 0 } - }; + // *************************************************************************** - HTAttr h4_attr[] = - { - HTML_ATTR(H4,CLASS), - HTML_ATTR(H4,ID), - HTML_ATTR(H4,STYLE), - { 0 } - }; + /// the cookie value for session identification (nel cookie) + std::string CurrentCookie; - HTAttr h5_attr[] = - { - HTML_ATTR(H5,CLASS), - HTML_ATTR(H5,ID), - HTML_ATTR(H5,STYLE), - { 0 } - }; + /// store all cookies we receive and resent them depending of the domain + static std::map > HTTPCookies; - HTAttr h6_attr[] = - { - HTML_ATTR(H6,CLASS), - HTML_ATTR(H6,ID), - HTML_ATTR(H6,STYLE), - { 0 } - }; + // *************************************************************************** // *************************************************************************** bool getCssLength (float &value, std::string &unit, const std::string &str) @@ -873,58 +782,6 @@ namespace NLGUI } } - void initLibWWW() - { - static bool initialized = false; - if (!initialized) - { - - // Change the HTML DTD - SGML_dtd *HTML_DTD = HTML_dtd (); - HTML_DTD->tags[HTML_HTML].attributes = html_attr; - HTML_DTD->tags[HTML_HTML].number_of_attributes = sizeof(html_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_TABLE].attributes = table_attr; - HTML_DTD->tags[HTML_TABLE].number_of_attributes = sizeof(table_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_TR].attributes = tr_attr; - HTML_DTD->tags[HTML_TR].number_of_attributes = sizeof(tr_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_TD].attributes = td_attr; - HTML_DTD->tags[HTML_TD].number_of_attributes = sizeof(td_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_TH].attributes = td_attr; - HTML_DTD->tags[HTML_TH].number_of_attributes = sizeof(td_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_IMG].attributes = img_attr; - HTML_DTD->tags[HTML_IMG].number_of_attributes = sizeof(img_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_INPUT].attributes = input_attr; - HTML_DTD->tags[HTML_INPUT].number_of_attributes = sizeof(input_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_TEXTAREA].attributes = textarea_attr; - HTML_DTD->tags[HTML_TEXTAREA].number_of_attributes = sizeof(textarea_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_P].attributes = p_attr; - HTML_DTD->tags[HTML_P].number_of_attributes = sizeof(p_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_A].attributes = a_attr; - HTML_DTD->tags[HTML_A].number_of_attributes = sizeof(a_attr) / sizeof(HTAttr) - 1; - //HTML_DTD->tags[HTML_I].attributes = a_attr; - HTML_DTD->tags[HTML_I].number_of_attributes = 0; - HTML_DTD->tags[HTML_DIV].attributes = div_attr; - HTML_DTD->tags[HTML_DIV].number_of_attributes = sizeof(div_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_SPAN].attributes = span_attr; - HTML_DTD->tags[HTML_SPAN].number_of_attributes = sizeof(span_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_H1].attributes = h1_attr; - HTML_DTD->tags[HTML_H1].number_of_attributes = sizeof(h1_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_H2].attributes = h2_attr; - HTML_DTD->tags[HTML_H2].number_of_attributes = sizeof(h2_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_H3].attributes = h3_attr; - HTML_DTD->tags[HTML_H3].number_of_attributes = sizeof(h3_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_H4].attributes = h4_attr; - HTML_DTD->tags[HTML_H4].number_of_attributes = sizeof(h4_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_H5].attributes = h5_attr; - HTML_DTD->tags[HTML_H5].number_of_attributes = sizeof(h5_attr) / sizeof(HTAttr) - 1; - HTML_DTD->tags[HTML_H6].attributes = h6_attr; - HTML_DTD->tags[HTML_H6].number_of_attributes = sizeof(h6_attr) / sizeof(HTAttr) - 1; - - // Initialized - initialized = true; - } - } - // *************************************************************************** } diff --git a/code/nel/src/gui/libwww_types.cpp b/code/nel/src/gui/libwww_types.cpp deleted file mode 100644 index 12a16e5d6..000000000 --- a/code/nel/src/gui/libwww_types.cpp +++ /dev/null @@ -1,804 +0,0 @@ -/** - libwww Copyright Notice - [This notice should be placed within redistributed or derivative software - code when appropriate. This particular formulation of W3C's notice for - inclusion in libwww code became active on August 14 1998.] - - LIBWWW COPYRIGHT NOTICE - - libwww: W3C's implementation of HTTP can be found at: - http://www.w3.org/Library/ - - Copyright ¨ 1995-2002 World Wide Web Consortium, - (Massachusetts Institute of Technology, Institut - National de Recherche en Informatique et en - Automatique, Keio University). All Rights Reserved. - This program is distributed under the W3C's - Intellectual Property License. This program 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 W3C License - http://www.w3.org/Consortium/Legal/ for more details. - - Copyright ¨ 1995 CERN. "This product includes computer - software created and made available by CERN. This - acknowledgment shall be mentioned in full in any - product which includes the CERN computer software - included herein or parts thereof." - - ****************************************************************************/ - -#include "stdpch.h" -#include "nel/gui/libwww_types.h" - -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif - -namespace NLGUI -{ - -/* - ** ATTRIBUTE DEFINITION MACROS (see HTMLPDTD.h) - */ - -/* - * redefine the macros, so that the "stringized" attribute name - * is generated - */ - -#undef HTML_ATTR -#define HTML_ATTR(t,a) { (char *) #a } -#undef HTML_ATTRIBUTES -#define HTML_ATTRIBUTES(t) { 0 } - -/* - ** ATTRIBUTE LISTS - */ - -static HTAttr no_attr[1] = { - { 0 } -}; - -static HTAttr body_attr[HTML_BODY_ATTRIBUTES+1] = { /* to catch images */ - HTML_ATTR(BODY,ALINK), - HTML_ATTR(BODY,BACKGROUND), - HTML_ATTR(BODY,BGCOLOR), - HTML_ATTR(BODY,CLASS), - HTML_ATTR(BODY,DIR), - HTML_ATTR(BODY,ID), - HTML_ATTR(BODY,LANG), - HTML_ATTR(BODY,LINK), - HTML_ATTR(BODY,STYLE), - HTML_ATTR(BODY,TEXT), - HTML_ATTR(BODY,TITLE), - HTML_ATTR(BODY,VLINK), - HTML_ATTRIBUTES(BODY) -}; - -static HTAttr frame_attr[HTML_FRAME_ATTRIBUTES+1] = { /* frame attributes */ - HTML_ATTR(FRAME,CLASS), - HTML_ATTR(FRAME,FRAMEBORDER), - HTML_ATTR(FRAME,ID), - HTML_ATTR(FRAME,NAME), - HTML_ATTR(FRAME,MARGINHEIGHT), - HTML_ATTR(FRAME,MARGINWIDTH), - HTML_ATTR(FRAME,NORESIZE), - HTML_ATTR(FRAME,LONGDESC), - HTML_ATTR(FRAME,SCROLLING), - HTML_ATTR(FRAME,SRC), - HTML_ATTR(FRAME,STYLE), - HTML_ATTR(FRAME,TARGET), - HTML_ATTR(FRAME,TITLE), - HTML_ATTRIBUTES(FRAME) -}; - -static HTAttr frameset_attr[HTML_FRAMESET_ATTRIBUTES+1] = { /* frameset attributes */ - HTML_ATTR(FRAMESET,CLASS), - HTML_ATTR(FRAMESET,COLS), - HTML_ATTR(FRAMESET,ID), - HTML_ATTR(FRAMESET,ROWS), - HTML_ATTR(FRAMESET,STYLE), - HTML_ATTR(FRAMESET,TITLE), - HTML_ATTRIBUTES(FRAMESET) -}; - -static HTAttr a_attr[HTML_A_ATTRIBUTES+1] = { /* Anchor attributes */ - HTML_ATTR(A,ACCESSKEY), - HTML_ATTR(A,CHARSET), - HTML_ATTR(A,CLASS), - HTML_ATTR(A,COORDS), - HTML_ATTR(A,DIR), - HTML_ATTR(A,HREF), - HTML_ATTR(A,HREFLANG), - HTML_ATTR(A,ID), - HTML_ATTR(A,NAME), - HTML_ATTR(A,REL), - HTML_ATTR(A,REV), - HTML_ATTR(A,SHAPE), - HTML_ATTR(A,STYLE), - HTML_ATTR(A,TABINDEX), - HTML_ATTR(A,TARGET), - HTML_ATTR(A,TYPE), - HTML_ATTR(A,TITLE), - HTML_ATTRIBUTES(A) -}; - -static HTAttr applet_attr[HTML_APPLET_ATTRIBUTES+1] = { - HTML_ATTR(APPLET,ALIGN), - HTML_ATTR(APPLET,ALT), - HTML_ATTR(APPLET,ARCHIVE), - HTML_ATTR(APPLET,CLASS), - HTML_ATTR(APPLET,CODE), - HTML_ATTR(APPLET,CODEBASE), - HTML_ATTR(APPLET,HEIGHT), - HTML_ATTR(APPLET,HSPACE), - HTML_ATTR(APPLET,ID), - HTML_ATTR(APPLET,NAME), - HTML_ATTR(APPLET,OBJECT), - HTML_ATTR(APPLET,STYLE), - HTML_ATTR(APPLET,TITLE), - HTML_ATTR(APPLET,VSPACE), - HTML_ATTR(APPLET,WIDTH), - HTML_ATTRIBUTES(APPLET) -}; - -static HTAttr area_attr[HTML_AREA_ATTRIBUTES+1] = { /* Area attributes */ - HTML_ATTR(AREA,ACCESSKEY), - HTML_ATTR(AREA,ALT), - HTML_ATTR(AREA,CLASS), - HTML_ATTR(AREA,COORDS), - HTML_ATTR(AREA,DIR), - HTML_ATTR(AREA,HREF), - HTML_ATTR(AREA,ID), - HTML_ATTR(AREA,NAME), - HTML_ATTR(AREA,NOHREF), - HTML_ATTR(AREA,LANG), - HTML_ATTR(AREA,SHAPE), - HTML_ATTR(AREA,STYLE), - HTML_ATTR(AREA,TABINDEX), - HTML_ATTR(AREA,TARGET), - HTML_ATTR(AREA,TITLE), - HTML_ATTRIBUTES(AREA) -}; - -static HTAttr base_attr[HTML_BASE_ATTRIBUTES+1] = { /* BASE attributes */ - HTML_ATTR(BASE,HREF), - HTML_ATTR(BASE,TARGET), - HTML_ATTRIBUTES(BASE) -}; - -static HTAttr bdo_attr[HTML_BDO_ATTRIBUTES+1] = { - HTML_ATTR(BDO,CLASS), - HTML_ATTR(BDO,DIR), - HTML_ATTR(BDO,ID), - HTML_ATTR(BDO,LANG), - HTML_ATTR(BDO,STYLE), - HTML_ATTR(BDO,TITLE), - HTML_ATTRIBUTES(BDO) -}; - -static HTAttr bq_attr[HTML_BQ_ATTRIBUTES+1] = { - HTML_ATTR(BQ,CITE), - HTML_ATTR(BQ,CLASS), - HTML_ATTR(BQ,DIR), - HTML_ATTR(BQ,ID), - HTML_ATTR(BQ,LANG), - HTML_ATTR(BQ,STYLE), - HTML_ATTR(BQ,TITLE), - HTML_ATTRIBUTES(BQ) -}; - -static HTAttr br_attr[HTML_BR_ATTRIBUTES+1] = { - HTML_ATTR(BR,CLASS), - HTML_ATTR(BR,CLEAR), - HTML_ATTR(BR,ID), - HTML_ATTR(BR,STYLE), - HTML_ATTR(BR,TITLE), - HTML_ATTRIBUTES(BR) -}; - -static HTAttr button_attr[HTML_BUTTON_ATTRIBUTES+1] = { - HTML_ATTR(BUTTON,ACCESSKEY), - HTML_ATTR(BUTTON,CLASS), - HTML_ATTR(BUTTON,DIR), - HTML_ATTR(BUTTON,DISABLED), - HTML_ATTR(BUTTON,ID), - HTML_ATTR(BUTTON,LANG), - HTML_ATTR(BUTTON,NAME), - HTML_ATTR(BUTTON,STYLE), - HTML_ATTR(BUTTON,TABINDEX), - HTML_ATTR(BUTTON,TITLE), - HTML_ATTR(BUTTON,TYPE), - HTML_ATTR(BUTTON,VALUE), - HTML_ATTRIBUTES(BUTTON), -}; - -static HTAttr col_attr[HTML_COL_ATTRIBUTES+1] = { - HTML_ATTR(COL,CLASS), - HTML_ATTR(COL,DIR), - HTML_ATTR(COL,ID), - HTML_ATTR(COL,LANG), - HTML_ATTR(COL,SPAN), - HTML_ATTR(COL,STYLE), - HTML_ATTR(COL,TITLE), - HTML_ATTR(COL,WIDTH), - HTML_ATTRIBUTES(COL) -}; - -static HTAttr changes_attr[HTML_CHANGES_ATTRIBUTES+1] = { - HTML_ATTR(CHANGES,CITE), - HTML_ATTR(CHANGES,CLASS), - HTML_ATTR(CHANGES,DATETIME), - HTML_ATTR(CHANGES,DIR), - HTML_ATTR(CHANGES,ID), - HTML_ATTR(CHANGES,LANG), - HTML_ATTR(CHANGES,STYLE), - HTML_ATTR(CHANGES,TITLE), - HTML_ATTRIBUTES(CHANGES) -}; - -static HTAttr font_attr[HTML_FONT_ATTRIBUTES+1] = { - HTML_ATTR(FONT,CLASS), - HTML_ATTR(FONT,COLOR), - HTML_ATTR(FONT,DIR), - HTML_ATTR(FONT,FACE), - HTML_ATTR(FONT,ID), - HTML_ATTR(FONT,LANG), - HTML_ATTR(FONT,SIZE), - HTML_ATTR(FONT,STYLE), - HTML_ATTR(FONT,TITLE), - HTML_ATTRIBUTES(FONT) -}; - -static HTAttr form_attr[HTML_FORM_ATTRIBUTES+1] = { - HTML_ATTR(FORM,ACCEPT), - { (char *) "ACCEPT-CHARSET" }, /* HTML_ATTR(FORM,ACCEPT_CHARSET) */ - HTML_ATTR(FORM,ACTION), - HTML_ATTR(FORM,CLASS), - HTML_ATTR(FORM,DIR), - HTML_ATTR(FORM,ENCTYPE), - HTML_ATTR(FORM,ID), - HTML_ATTR(FORM,LANG), - HTML_ATTR(FORM,METHOD), - HTML_ATTR(FORM,STYLE), - HTML_ATTR(FORM,TARGET), - HTML_ATTR(FORM,TITLE), - HTML_ATTRIBUTES(FORM) -}; - -static HTAttr gen_attr[HTML_GEN_ATTRIBUTES+1] = { /* General, for many things */ - HTML_ATTR(GEN,CLASS), - HTML_ATTR(GEN,DIR), - HTML_ATTR(GEN,ID), - HTML_ATTR(GEN,LANG), - HTML_ATTR(GEN,STYLE), - HTML_ATTR(GEN,TITLE), - HTML_ATTRIBUTES(GEN) -}; - -static HTAttr block_attr[HTML_BLOCK_ATTRIBUTES+1] = { /* DIV, SPAN, H1-H6 */ - HTML_ATTR(BLOCK,ALIGN), - HTML_ATTR(BLOCK,CLASS), - HTML_ATTR(BLOCK,DIR), - HTML_ATTR(BLOCK,ID), - HTML_ATTR(BLOCK,LANG), - HTML_ATTR(BLOCK,STYLE), - HTML_ATTR(BLOCK,TITLE), - HTML_ATTRIBUTES(BLOCK) -}; - -static HTAttr head_attr[HTML_HEAD_ATTRIBUTES+1] = { - HTML_ATTR(HEAD,DIR), - HTML_ATTR(HEAD,LANG), - HTML_ATTR(HEAD,PROFILE), - HTML_ATTRIBUTES(HEAD) -}; - -static HTAttr hr_attr[HTML_HR_ATTRIBUTES+1] = { - HTML_ATTR(HR,ALIGN), - HTML_ATTR(HR,CLASS), - HTML_ATTR(HR,DIR), - HTML_ATTR(HR,ID), - HTML_ATTR(HR,LANG), - HTML_ATTR(HR,NOSHADE), - HTML_ATTR(HR,SIZE), - HTML_ATTR(HR,STYLE), - HTML_ATTR(HR,TITLE), - HTML_ATTR(HR,WIDTH), - HTML_ATTRIBUTES(HR) -}; - -static HTAttr html_attr[HTML_HTML_ATTRIBUTES+1] = { - HTML_ATTR(HTML,DIR), - HTML_ATTR(HTML,LANG), - HTML_ATTR(HTML,VERSION), - HTML_ATTRIBUTES(HTML) -}; - -static HTAttr iframe_attr[HTML_IFRAME_ATTRIBUTES+1] = { - HTML_ATTR(IFRAME,ALIGN), - HTML_ATTR(IFRAME,CLASS), - HTML_ATTR(IFRAME,FRAMEBORDER), - HTML_ATTR(IFRAME,HEIGHT), - HTML_ATTR(IFRAME,ID), - HTML_ATTR(IFRAME,LONGDESC), - HTML_ATTR(IFRAME,MARGINHEIGHT), - HTML_ATTR(IFRAME,MARGINWIDTH), - HTML_ATTR(IFRAME,NAME), - HTML_ATTR(IFRAME,SCROLLING), - HTML_ATTR(IFRAME,SRC), - HTML_ATTR(IFRAME,STYLE), - HTML_ATTR(IFRAME,TARGET), - HTML_ATTR(IFRAME,TITLE), - HTML_ATTR(IFRAME,WIDTH), - HTML_ATTRIBUTES(IFRAME) -}; - -static HTAttr img_attr[HTML_IMG_ATTRIBUTES+1] = { /* IMG attributes */ - HTML_ATTR(IMG,ALIGN), - HTML_ATTR(IMG,ALT), - HTML_ATTR(IMG,BORDER), - HTML_ATTR(IMG,CLASS), - HTML_ATTR(IMG,DIR), - HTML_ATTR(IMG,HEIGHT), - HTML_ATTR(IMG,HSPACE), - HTML_ATTR(IMG,ID), - HTML_ATTR(IMG,ISMAP), - HTML_ATTR(IMG,LANG), - HTML_ATTR(IMG,LONGDESC), - HTML_ATTR(IMG,SRC), - HTML_ATTR(IMG,STYLE), - HTML_ATTR(IMG,TITLE), - HTML_ATTR(IMG,USEMAP), - HTML_ATTR(IMG,VSPACE), - HTML_ATTR(IMG,WIDTH), - HTML_ATTRIBUTES(IMG) -}; - -static HTAttr input_attr[HTML_INPUT_ATTRIBUTES+1] = { - HTML_ATTR(INPUT,ACCEPT), - HTML_ATTR(INPUT,ACCESSKEY), - HTML_ATTR(INPUT,ALIGN), - HTML_ATTR(INPUT,ALT), - HTML_ATTR(INPUT,CHECKED), - HTML_ATTR(INPUT,CLASS), - HTML_ATTR(INPUT,DIR), - HTML_ATTR(INPUT,DISABLED), - HTML_ATTR(INPUT,ID), - HTML_ATTR(INPUT,LANG), - HTML_ATTR(INPUT,MAXLENGTH), - HTML_ATTR(INPUT,NAME), - HTML_ATTR(INPUT,READONLY), - HTML_ATTR(INPUT,SIZE), - HTML_ATTR(INPUT,SRC), - HTML_ATTR(INPUT,STYLE), - HTML_ATTR(INPUT,TABINDEX), - HTML_ATTR(INPUT,TITLE), - HTML_ATTR(INPUT,TYPE), - HTML_ATTR(INPUT,USEMAP), - HTML_ATTR(INPUT,VALUE), - HTML_ATTRIBUTES(INPUT) -}; - -static HTAttr isindex_attr[HTML_ISINDEX_ATTRIBUTES+1] = { - HTML_ATTR(ISINDEX,CLASS), - HTML_ATTR(ISINDEX,DIR), - HTML_ATTR(ISINDEX,ID), - HTML_ATTR(ISINDEX,LANG), - HTML_ATTR(ISINDEX,PROMPT), - HTML_ATTR(ISINDEX,STYLE), - HTML_ATTR(ISINDEX,TITLE), - HTML_ATTRIBUTES(ISINDEX) -}; - -static HTAttr label_attr[HTML_LABEL_ATTRIBUTES+1] = { - HTML_ATTR(LABEL,ACCESSKEY), - HTML_ATTR(LABEL,CLASS), - HTML_ATTR(LABEL,DIR), - HTML_ATTR(LABEL,FOR), - HTML_ATTR(LABEL,ID), - HTML_ATTR(LABEL,LANG), - HTML_ATTR(LABEL,STYLE), - HTML_ATTR(LABEL,TITLE), - HTML_ATTRIBUTES(LABEL) -}; - -static HTAttr legend_attr[HTML_LEGEND_ATTRIBUTES+1] = { - HTML_ATTR(LEGEND,ACCESSKEY), - HTML_ATTR(LEGEND,ALIGN), - HTML_ATTR(LEGEND,CLASS), - HTML_ATTR(LEGEND,DIR), - HTML_ATTR(LEGEND,ID), - HTML_ATTR(LEGEND,LANG), - HTML_ATTR(LEGEND,STYLE), - HTML_ATTR(LEGEND,TITLE), - HTML_ATTRIBUTES(LEGEND) -}; - -static HTAttr li_attr[HTML_LI_ATTRIBUTES+1] = { - HTML_ATTR(LI,CLASS), - HTML_ATTR(LI,COMPACT), - HTML_ATTR(LI,DIR), - HTML_ATTR(LI,ID), - HTML_ATTR(LI,LANG), - HTML_ATTR(LI,STYLE), - HTML_ATTR(LI,TITLE), - HTML_ATTR(LI,TYPE), - HTML_ATTR(LI,VALUE), - HTML_ATTRIBUTES(LI) -}; - -static HTAttr link_attr[HTML_LINK_ATTRIBUTES+1] = { /* link attributes */ - HTML_ATTR(LINK,CHARSET), - HTML_ATTR(LINK,CLASS), - HTML_ATTR(LINK,DIR), - HTML_ATTR(LINK,HREF), - HTML_ATTR(LINK,HREFLANG), - HTML_ATTR(LINK,ID), - HTML_ATTR(LINK,LANG), - HTML_ATTR(LINK,MEDIA), - HTML_ATTR(LINK,REL), - HTML_ATTR(LINK,REV), - HTML_ATTR(LINK,STYLE), - HTML_ATTR(LINK,TARGET), - HTML_ATTR(LINK,TITLE), - HTML_ATTR(LINK,TYPE), - HTML_ATTRIBUTES(LINK) -}; - -static HTAttr map_attr[HTML_MAP_ATTRIBUTES+1] = { - HTML_ATTR(MAP,CLASS), - HTML_ATTR(MAP,DIR), - HTML_ATTR(MAP,ID), - HTML_ATTR(MAP,LANG), - HTML_ATTR(MAP,NAME), - HTML_ATTR(MAP,STYLE), - HTML_ATTR(MAP,TITLE), - HTML_ATTRIBUTES(MAP) -}; - -static HTAttr meta_attr[HTML_META_ATTRIBUTES+1] = { - HTML_ATTR(META,CONTENT), - HTML_ATTR(META,DIR), - { (char *)"HTTP-EQUIV" }, /* HTML_ATTR(META,HTTP_EQUIV) */ - HTML_ATTR(META,LANG), - HTML_ATTR(META,NAME), - HTML_ATTR(META,SCHEME), - HTML_ATTRIBUTES(META) -}; - -static HTAttr nextid_attr[HTML_NEXTID_ATTRIBUTES+1] = { - { (char *)"N" }, - { 0 } /* Terminate list */ -}; - -static HTAttr object_attr[HTML_OBJECT_ATTRIBUTES+1] = { /* object attributes */ - HTML_ATTR(OBJECT,ALIGN), - HTML_ATTR(OBJECT,ARCHIVE), - HTML_ATTR(OBJECT,BORDER), - HTML_ATTR(OBJECT,CLASS), - HTML_ATTR(OBJECT,CLASSID), - HTML_ATTR(OBJECT,CODEBASE), - HTML_ATTR(OBJECT,CODETYPE), - HTML_ATTR(OBJECT,DATA), - HTML_ATTR(OBJECT,DECLARE), - HTML_ATTR(OBJECT,DIR), - HTML_ATTR(OBJECT,HEIGHT), - HTML_ATTR(OBJECT,HSPACE), - HTML_ATTR(OBJECT,ID), - HTML_ATTR(OBJECT,LANG), - HTML_ATTR(OBJECT,NAME), - HTML_ATTR(OBJECT,STANDBY), - HTML_ATTR(OBJECT,STYLE), - HTML_ATTR(OBJECT,TABINDEX), - HTML_ATTR(OBJECT,TITLE), - HTML_ATTR(OBJECT,TYPE), - HTML_ATTR(OBJECT,USEMAP), - HTML_ATTR(OBJECT,VSPACE), - HTML_ATTR(OBJECT,WIDTH), - HTML_ATTRIBUTES(OBJECT) -}; - -static HTAttr ol_attr[HTML_OL_ATTRIBUTES+1] = { - HTML_ATTR(OL,CLASS), - HTML_ATTR(OL,COMPACT), - HTML_ATTR(OL,DIR), - HTML_ATTR(OL,ID), - HTML_ATTR(OL,LANG), - HTML_ATTR(OL,START), - HTML_ATTR(OL,STYLE), - HTML_ATTR(OL,TITLE), - HTML_ATTR(OL,TYPE), - HTML_ATTRIBUTES(OL) -}; - -static HTAttr optgroup_attr[HTML_OPTGROUP_ATTRIBUTES+1] = { - HTML_ATTR(OPTGROUP,CLASS), - HTML_ATTR(OPTGROUP,DISABLED), - HTML_ATTR(OPTGROUP,DIR), - HTML_ATTR(OPTGROUP,ID), - HTML_ATTR(OPTGROUP,LABEL), - HTML_ATTR(OPTGROUP,LANG), - HTML_ATTR(OPTGROUP,STYLE), - HTML_ATTR(OPTGROUP,TITLE), - HTML_ATTRIBUTES(OPTGROUP) -}; - -static HTAttr option_attr[HTML_OPTION_ATTRIBUTES+1] = { - HTML_ATTR(OPTION,CLASS), - HTML_ATTR(OPTION,DISABLED), - HTML_ATTR(OPTION,DIR), - HTML_ATTR(OPTION,ID), - HTML_ATTR(OPTION,LABEL), - HTML_ATTR(OPTION,LANG), - HTML_ATTR(OPTION,SELECTED), - HTML_ATTR(OPTION,STYLE), - HTML_ATTR(OPTION,TITLE), - HTML_ATTR(OPTION,VALUE), - HTML_ATTRIBUTES(OPTION) -}; - -static HTAttr param_attr[HTML_PARAM_ATTRIBUTES+1] = { - HTML_ATTR(PARAM,ID), - HTML_ATTR(PARAM,NAME), - HTML_ATTR(PARAM,TYPE), - HTML_ATTR(PARAM,VALUE), - HTML_ATTR(PARAM,VALUETYPE), - HTML_ATTRIBUTES(PARAM) -}; - -static HTAttr pre_attr[HTML_PRE_ATTRIBUTES+1] = { - HTML_ATTR(PRE,CLASS), - HTML_ATTR(PRE,DIR), - HTML_ATTR(PRE,ID), - HTML_ATTR(PRE,LANG), - HTML_ATTR(PRE,STYLE), - HTML_ATTR(PRE,TITLE), - HTML_ATTR(PRE,WIDTH), - HTML_ATTRIBUTES(PRE) -}; - -static HTAttr script_attr[HTML_SCRIPT_ATTRIBUTES+1] = { - HTML_ATTR(SCRIPT,CHARSET), - HTML_ATTR(SCRIPT,DEFER), - HTML_ATTR(SCRIPT,LANGUAGE), - HTML_ATTR(SCRIPT,SRC), - HTML_ATTR(SCRIPT,TYPE), - HTML_ATTRIBUTES(SCRIPT) -}; - -static HTAttr select_attr[HTML_SELECT_ATTRIBUTES+1] = { - HTML_ATTR(SELECT,CLASS), - HTML_ATTR(SELECT,DIR), - HTML_ATTR(SELECT,DISABLED), - HTML_ATTR(SELECT,ID), - HTML_ATTR(SELECT,LANG), - HTML_ATTR(SELECT,MULTIPLE), - HTML_ATTR(SELECT,NAME), - HTML_ATTR(SELECT,SIZE), - HTML_ATTR(SELECT,STYLE), - HTML_ATTR(SELECT,TABINDEX), - HTML_ATTR(SELECT,TITLE), - HTML_ATTRIBUTES(SELECT) -}; - -static HTAttr style_attr[HTML_STYLE_ATTRIBUTES+1] = { - HTML_ATTR(STYLE,DIR), - HTML_ATTR(STYLE,LANG), - HTML_ATTR(STYLE,MEDIA), - HTML_ATTR(STYLE,TITLE), - HTML_ATTR(STYLE,TYPE), - HTML_ATTRIBUTES(STYLE) -}; - -static HTAttr table_attr[HTML_TABLE_ATTRIBUTES+1] = { - HTML_ATTR(TABLE,ALIGN), - HTML_ATTR(TABLE,BGCOLOR), - HTML_ATTR(TABLE,BORDER), - HTML_ATTR(TABLE,CELLPADDING), - HTML_ATTR(TABLE,CELLSPACING), - HTML_ATTR(TABLE,CLASS), - HTML_ATTR(TABLE,DIR), - HTML_ATTR(TABLE,FRAME), - HTML_ATTR(TABLE,ID), - HTML_ATTR(TABLE,LANG), - HTML_ATTR(TABLE,RULES), - HTML_ATTR(TABLE,SUMMARY), - HTML_ATTR(TABLE,STYLE), - HTML_ATTR(TABLE,TITLE), - HTML_ATTR(TABLE,WIDTH), - HTML_ATTRIBUTES(TABLE) -}; - -static HTAttr tele_attr[HTML_TELE_ATTRIBUTES+1] = { - HTML_ATTR(TELE,ALIGN), - HTML_ATTR(TELE,CHAR), - HTML_ATTR(TELE,CHAROFF), - HTML_ATTR(TELE,CLASS), - HTML_ATTR(TELE,DIR), - HTML_ATTR(TELE,ID), - HTML_ATTR(TELE,LANG), - HTML_ATTR(TELE,STYLE), - HTML_ATTR(TELE,TITLE), - HTML_ATTR(TELE,VALIGN), - HTML_ATTRIBUTES(TELE) -}; - -static HTAttr td_attr[HTML_TD_ATTRIBUTES+1] = { - HTML_ATTR(TD,ABBR), - HTML_ATTR(TD,ALIGN), - HTML_ATTR(TD,AXIS), - HTML_ATTR(TD,BGCOLOR), - HTML_ATTR(TD,CHAR), - HTML_ATTR(TD,CHAROFF), - HTML_ATTR(TD,CLASS), - HTML_ATTR(TD,COLSPAN), - HTML_ATTR(TD,DIR), - HTML_ATTR(TD,ID), - HTML_ATTR(TD,HEADERS), - HTML_ATTR(TD,HEIGHT), - HTML_ATTR(TD,LANG), - HTML_ATTR(TD,NOWRAP), - HTML_ATTR(TD,ROWSPAN), - HTML_ATTR(TD,SCOPE), - HTML_ATTR(TD,STYLE), - HTML_ATTR(TD,TITLE), - HTML_ATTR(TD,VALIGN), - HTML_ATTR(TD,WIDTH), - HTML_ATTRIBUTES(TD) -}; - -static HTAttr textarea_attr[HTML_TEXTAREA_ATTRIBUTES+1] = { - HTML_ATTR(TEXTAREA,CLASS), - HTML_ATTR(TEXTAREA,COLS), - HTML_ATTR(TEXTAREA,DIR), - HTML_ATTR(TEXTAREA,DISABLED), - HTML_ATTR(TEXTAREA,ID), - HTML_ATTR(TEXTAREA,LANG), - HTML_ATTR(TEXTAREA,NAME), - HTML_ATTR(TEXTAREA,READONLY), - HTML_ATTR(TEXTAREA,ROWS), - HTML_ATTR(TEXTAREA,STYLE), - HTML_ATTR(TEXTAREA,TABINDEX), - HTML_ATTR(TEXTAREA,TITLE), - HTML_ATTRIBUTES(TEXTAREA) -}; - -static HTAttr title_attr[HTML_TITLE_ATTRIBUTES+1] = { - HTML_ATTR(TITLE,DIR), - HTML_ATTR(TITLE,LANG), - HTML_ATTRIBUTES(TITLE) -}; - -static HTAttr ul_attr[HTML_UL_ATTRIBUTES+1] = { - HTML_ATTR(UL,CLASS), - HTML_ATTR(UL,COMPACT), - HTML_ATTR(UL,DIR), - HTML_ATTR(UL,ID), - HTML_ATTR(UL,LANG), - HTML_ATTR(UL,STYLE), - HTML_ATTR(UL,TITLE), - HTML_ATTR(UL,TYPE), - HTML_ATTRIBUTES(UL) -}; - -/* - ** ELEMENTS - ** Must match definitions in HTMLPDTD.html! - ** Must be in alphabetical order. - ** - ** Name, Attributes, content - */ -static HTTag tags[HTML_ELEMENTS] = { - { "A" , a_attr, HTML_A_ATTRIBUTES }, - { "ABBR" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "ADDRESS" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "APPLET" , applet_attr, HTML_APPLET_ATTRIBUTES }, - { "AREA" , area_attr, HTML_AREA_ATTRIBUTES }, - { "B" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "BASE" , base_attr, HTML_BASE_ATTRIBUTES }, - { "BASEFONT", font_attr, HTML_FONT_ATTRIBUTES }, - { "BDO" , bdo_attr, HTML_BDO_ATTRIBUTES }, - { "BIG" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "BLOCKQUOTE", bq_attr, HTML_BQ_ATTRIBUTES }, - { "BODY" , body_attr, HTML_BODY_ATTRIBUTES }, - { "BR" , br_attr, HTML_BR_ATTRIBUTES }, - { "BUTTON" , button_attr, HTML_BUTTON_ATTRIBUTES }, - { "CAPTION" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "CENTER" , no_attr, 0 }, - { "CITE" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "CODE" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "COL" , col_attr, HTML_COL_ATTRIBUTES }, - { "COLGROUP", col_attr, HTML_COL_ATTRIBUTES }, - { "DD" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "DEL" , changes_attr, HTML_CHANGES_ATTRIBUTES }, - { "DFN" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "DIR" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "DIV" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "DL" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "DT" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "EM" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "FIELDSET", gen_attr, HTML_GEN_ATTRIBUTES }, - { "FONT" , font_attr, HTML_FONT_ATTRIBUTES }, - { "FORM" , form_attr, HTML_FORM_ATTRIBUTES }, - { "FRAME" , frame_attr, HTML_FRAME_ATTRIBUTES }, - { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES }, - { "H1" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "H2" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "H3" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "H4" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "H5" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "H6" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "HEAD" , head_attr, HTML_HEAD_ATTRIBUTES }, - { "HR" , hr_attr, HTML_HR_ATTRIBUTES }, - { "HTML" , html_attr, HTML_HTML_ATTRIBUTES }, - { "I" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "IFRAME" , iframe_attr, HTML_IFRAME_ATTRIBUTES }, - { "IMG" , img_attr, HTML_IMG_ATTRIBUTES }, - { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES }, - { "INS" , changes_attr, HTML_CHANGES_ATTRIBUTES }, - { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES }, - { "KBD" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "LABEL" , label_attr, HTML_LABEL_ATTRIBUTES }, - { "LEGEND" , legend_attr, HTML_LEGEND_ATTRIBUTES }, - { "LI" , li_attr, HTML_LI_ATTRIBUTES }, - { "LINK" , link_attr, HTML_LINK_ATTRIBUTES }, - { "MAP" , map_attr, HTML_MAP_ATTRIBUTES }, - { "MENU" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "META" , meta_attr, HTML_META_ATTRIBUTES }, - { "NEXTID" , nextid_attr, 1 }, - { "NOFRAMES", gen_attr, HTML_GEN_ATTRIBUTES }, - { "NOSCRIPT", gen_attr, HTML_GEN_ATTRIBUTES }, - { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES }, - { "OL" , ol_attr, HTML_OL_ATTRIBUTES }, - { "OPTGROUP", optgroup_attr,HTML_OPTGROUP_ATTRIBUTES }, - { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES }, - { "P" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "PARAM" , param_attr, HTML_PARAM_ATTRIBUTES }, - { "PRE" , pre_attr, HTML_PRE_ATTRIBUTES }, - { "Q" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "S" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "SAMP" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES }, - { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES }, - { "SMALL" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "SPAN" , block_attr, HTML_BLOCK_ATTRIBUTES }, - { "STRIKE" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "STRONG" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "STYLE" , style_attr, HTML_STYLE_ATTRIBUTES }, - { "SUB" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "SUP" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "TABLE" , table_attr, HTML_TABLE_ATTRIBUTES }, - { "TBODY" , tele_attr, HTML_TELE_ATTRIBUTES }, - { "TD" , td_attr, HTML_TD_ATTRIBUTES }, - { "TEXTAREA", textarea_attr,HTML_TEXTAREA_ATTRIBUTES }, - { "TFOOT" , tele_attr, HTML_TELE_ATTRIBUTES }, - { "TH" , td_attr, HTML_TD_ATTRIBUTES }, - { "THEAD" , tele_attr, HTML_TELE_ATTRIBUTES }, - { "TITLE" , title_attr, HTML_TITLE_ATTRIBUTES }, - { "TR" , tele_attr, HTML_TELE_ATTRIBUTES }, - { "TT" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "U" , gen_attr, HTML_GEN_ATTRIBUTES }, - { "UL" , ul_attr, HTML_UL_ATTRIBUTES }, - { "VAR" , gen_attr, HTML_GEN_ATTRIBUTES }, - // - { "LUA" , gen_attr, HTML_GEN_ATTRIBUTES }, -}; - -static SGML_dtd HTMLP_dtd = { - tags, - HTML_ELEMENTS -}; - -static SGML_dtd * DTD = &HTMLP_dtd; - -SGML_dtd * HTML_dtd (void) -{ - return DTD; -} - -}// namespace - diff --git a/code/nel/src/misc/string_common.cpp b/code/nel/src/misc/string_common.cpp index ba911c1bc..ee89fa981 100644 --- a/code/nel/src/misc/string_common.cpp +++ b/code/nel/src/misc/string_common.cpp @@ -144,7 +144,7 @@ std::string winCpToCp(const char *str, size_t len, UINT srcCp, UINT dstCp) wchar_t *tmp = (wchar_t *)_malloca((len + 1) * 4); if (!tmp) return std::string(); - int tmpLen = MultiByteToWideChar(srcCp, MB_PRECOMPOSED, + int tmpLen = MultiByteToWideChar(srcCp, 0, str, (int)(len + 1), /* include null-termination */ tmp, (int)((len + 1) * 4)); if (tmpLen <= 1) @@ -170,7 +170,7 @@ std::wstring winCpToWide(const char *str, size_t len, UINT cp) wchar_t *tmp = (wchar_t *)_malloca((len + 1) * 4); if (!tmp) return std::wstring(); - int tmpLen = MultiByteToWideChar(cp, MB_PRECOMPOSED, + int tmpLen = MultiByteToWideChar(cp, 0, str, (int)(len + 1), /* include null-termination */ tmp, (int)((len + 1) * 4)); if (tmpLen <= 1) diff --git a/code/ryzom/client/src/interface_v3/action_handler_help.cpp b/code/ryzom/client/src/interface_v3/action_handler_help.cpp index be11191e0..43797b960 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -1103,20 +1103,18 @@ REGISTER_ACTION_HANDLER( CHandlerBrowseRefresh, "browse_refresh"); // *************************************************************************** -/** Build the help window for a pact/item/brick and open it. - */ class CHandlerHTMLSubmitForm : public IActionHandler { void execute (CCtrlBase *pCaller, const std::string &sParams) { string container = getParam (sParams, "name"); - uint form; - fromString(getParam (sParams, "form"), form); - - string submit_button = getParam (sParams, "submit_button"); - string type = getParam (sParams, "submit_button_type"); - string value = getParam (sParams, "submit_button_value"); + uint button; + if (!fromString(getParam(sParams, "button"), button)) + { + nlwarning("Invalid button index: '%s', expected integer", getParam(sParams, "button").c_str()); + return; + } sint32 x = pCaller->getEventX(); sint32 y = pCaller->getEventY(); @@ -1127,8 +1125,7 @@ class CHandlerHTMLSubmitForm : public IActionHandler CGroupHTML *groupHtml = dynamic_cast(element); if (groupHtml) { - // Submit the form the url - groupHtml->submitForm (form, type.c_str(), submit_button.c_str(), value.c_str(), x, y); + groupHtml->submitForm(button, x, y); } } } @@ -2339,11 +2336,11 @@ void setupCosmetic(CSheetHelpSetup &setup, CItemSheet *pIS) void setupItemPreview(CSheetHelpSetup &setup, CItemSheet *pIS) { nlassert(pIS); - + CInterfaceManager *pIM = CInterfaceManager::getInstance(); CCDBNodeBranch *dbBranch = NLGUI::CDBManager::getInstance()->getDbBranch( setup.SrcSheet->getSheet() ); - - + + CInterfaceElement *elt = setup.HelpWindow->getElement(setup.HelpWindow->getId()+setup.PrefixForExtra+INFO_ITEM_PREVIEW); if (elt == NULL) return; @@ -2357,12 +2354,12 @@ void setupItemPreview(CSheetHelpSetup &setup, CItemSheet *pIS) static sint32 helpWidth = setup.HelpWindow->getW(); bool scene_inactive = ! NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_3D_ITEM_PREVIEW")->getValueBool(); - if (scene_inactive || - (pIS->Family != ITEMFAMILY::ARMOR && - pIS->Family != ITEMFAMILY::MELEE_WEAPON && - pIS->Family != ITEMFAMILY::RANGE_WEAPON && + if (scene_inactive || + (pIS->Family != ITEMFAMILY::ARMOR && + pIS->Family != ITEMFAMILY::MELEE_WEAPON && + pIS->Family != ITEMFAMILY::RANGE_WEAPON && pIS->Family != ITEMFAMILY::SHIELD)) - { + { setup.HelpWindow->setW(helpWidth); ig->setActive(false); return; @@ -2372,7 +2369,7 @@ void setupItemPreview(CSheetHelpSetup &setup, CItemSheet *pIS) setup.HelpWindow->setW(helpWidth + ITEM_PREVIEW_WIDTH); ig->setActive(true); } - + CInterface3DScene *sceneI = dynamic_cast(ig->getGroup("scene_item_preview")); if (!sceneI) { @@ -2458,7 +2455,7 @@ void setupItemPreview(CSheetHelpSetup &setup, CItemSheet *pIS) cs.VisualPropA.PropertySubData.HatColor = color->getValue32(); SCharacter3DSetup::setupDBFromCharacterSummary("UI:TEMP:CHAR3D", cs); camHeight = -0.35f; - } + } } else if (pIS->Family == ITEMFAMILY::SHIELD) { diff --git a/code/ryzom/client/src/interface_v3/group_html_webig.cpp b/code/ryzom/client/src/interface_v3/group_html_webig.cpp index ea885f17b..c7ee1a6c3 100644 --- a/code/ryzom/client/src/interface_v3/group_html_webig.cpp +++ b/code/ryzom/client/src/interface_v3/group_html_webig.cpp @@ -71,6 +71,9 @@ static string getWebAuthKey() void addWebIGParams (string &url, bool trustedDomain) { + // no extras parameters added to url if not in trusted domains list + if (!trustedDomain) return; + if(!UserEntity || !NetMngr.getLoginCookie().isValid()) return; uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot; @@ -354,6 +357,9 @@ void CGroupHTMLAuth::addHTTPGetParams (string &url, bool trustedDomain) void CGroupHTMLAuth::addHTTPPostParams (SFormFields &formfields, bool trustedDomain) { + // no extras parameters added to url if not in trusted domains list + if (!trustedDomain) return; + if(!UserEntity || !NetMngr.getLoginCookie().isValid()) return; uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot;