From 51e01daa994d04653c9d81f814ead1b15eadacf5 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 29 Apr 2019 15:36:27 +0300 Subject: [PATCH] Changed: Remove old luaBeginElement, luaEndElement --HG-- branch : develop --- code/nel/include/nel/gui/group_html.h | 7 - code/nel/src/gui/group_html.cpp | 1643 ------------------------- 2 files changed, 1650 deletions(-) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 6a8760533..cf06a49d0 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -238,8 +238,6 @@ namespace NLGUI int luaInsertText(CLuaState &ls); int luaAddString(CLuaState &ls); int luaAddImage(CLuaState &ls); - int luaBeginElement(CLuaState &ls); - int luaEndElement(CLuaState &ls); int luaShowDiv(CLuaState &ls); int luaParseHtml(CLuaState &ls); int luaRenderHtml(CLuaState &ls); @@ -253,8 +251,6 @@ namespace NLGUI REFLECT_LUA_METHOD("insertText", luaInsertText) REFLECT_LUA_METHOD("addString", luaAddString) REFLECT_LUA_METHOD("addImage", luaAddImage) - REFLECT_LUA_METHOD("beginElement", luaBeginElement) - REFLECT_LUA_METHOD("endElement", luaEndElement) REFLECT_LUA_METHOD("showDiv", luaShowDiv) REFLECT_LUA_METHOD("parseHtml", luaParseHtml) REFLECT_LUA_METHOD("renderHtml", luaRenderHtml) @@ -736,9 +732,6 @@ namespace NLGUI private: friend class CHtmlParser; - // TODO: beginElement is overwritten in client quick help class, merge it here? - void beginElementDeprecated(uint element_number, const std::vector &present, const std::vector &value); - void endElementDeprecated(uint element_number); // move src->Children into CurrentHtmlElement.parent.children element void spliceFragment(std::list::iterator src); diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index c40617f50..1f9eb5fd2 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -1503,1578 +1503,6 @@ namespace NLGUI } } - // *************************************************************************** - void CGroupHTML::beginElementDeprecated(uint element_number, const std::vector &present, const std::vector &value) - { - if (_Browsing) - { - // Paragraph ? - switch(element_number) - { - case HTML_HTML: - if (present[MY_HTML_HTML_STYLE] && value[MY_HTML_HTML_STYLE]) - _Style.applyRootStyle(value[MY_HTML_HTML_STYLE]); - - _Style.Current = _Style.Root; - setBackgroundColor(_Style.Current.BackgroundColor); - break; - case HTML_HEAD: - _ReadingHeadTag = !_IgnoreHeadTag; - _IgnoreHeadTag = true; - break; - case HTML_BASE: - if (_ReadingHeadTag && !_IgnoreBaseUrlTag) - { - if (present[HTML_BASE_HREF] && value[HTML_BASE_HREF]) - { - CUrlParser uri(value[HTML_BASE_HREF]); - if (uri.isAbsolute()) - { - _URL = uri.toString(); - _IgnoreBaseUrlTag = true; - } - } - } - break; - case HTML_META: - if (_ReadingHeadTag) - { - bool httpEquiv = present[HTML_META_HTTP_EQUIV] && value[HTML_META_HTTP_EQUIV]; - bool httpContent = present[HTML_META_CONTENT] && value[HTML_META_CONTENT]; - if (httpEquiv && httpContent) - { - // only first http-equiv="refresh" should be handled - if (_RefreshUrl.empty() && toLower(value[HTML_META_HTTP_EQUIV]) == "refresh") - { - const CWidgetManager::SInterfaceTimes × = CWidgetManager::getInstance()->getInterfaceTimes(); - double timeSec = times.thisFrameMs / 1000.0f; - string content(value[HTML_META_CONTENT]); - - string::size_type pos = content.find_first_of(";"); - if (pos == string::npos) - { - fromString(content, _NextRefreshTime); - _RefreshUrl = _URL; - } - else - { - fromString(content.substr(0, pos), _NextRefreshTime); - - pos = toLower(content).find("url="); - if (pos != string::npos) - _RefreshUrl = getAbsoluteUrl(content.substr(pos + 4)); - } - - _NextRefreshTime += timeSec; - } - } - } - break; - case HTML_A: - { - registerAnchorName(MY_HTML_A); - - _Style.pushStyle(); - _Style.Current.TextColor = LinkColor; - _Style.Current.Underlined = true; - _Style.Current.GlobalColor = LinkColorGlobalColor; - _Style.Current.Width = -1; - _Style.Current.Height = -1; - - if (present[HTML_A_STYLE] && value[HTML_A_STYLE]) - _Style.applyStyle(value[HTML_A_STYLE]); - - _A.push_back(true); - _Link.push_back (""); - _LinkTitle.push_back(""); - _LinkClass.push_back(""); - - // #fragment works with both ID and NAME so register both - if (present[MY_HTML_A_NAME] && value[MY_HTML_A_NAME]) - _AnchorName.push_back(value[MY_HTML_A_NAME]); - if (present[MY_HTML_A_TITLE] && value[MY_HTML_A_TITLE]) - _LinkTitle.back() = value[MY_HTML_A_TITLE]; - if (present[MY_HTML_A_CLASS] && value[MY_HTML_A_CLASS]) - _LinkClass.back() = value[MY_HTML_A_CLASS]; - if (present[MY_HTML_A_HREF] && value[MY_HTML_A_HREF]) - { - string suri = value[MY_HTML_A_HREF]; - if(suri.find("ah:") == 0) - { - if (_TrustedDomain) - _Link.back() = suri; - } - else if (_TrustedDomain && suri[0] == '#' && _LuaHrefHack) - { - // Direct url (hack for lua beginElement) - _Link.back() = suri.substr(1); - } - else - { - // convert href from "?key=val" into "http://domain.com/?key=val" - _Link.back() = getAbsoluteUrl(suri); - } - } - } - break; - case HTML_DIV: - { - _BlockLevelElement.push_back(true); - registerAnchorName(MY_HTML_DIV); - _Style.pushStyle(); - - if (present[MY_HTML_DIV_NAME] && value[MY_HTML_DIV_NAME]) - _DivName = value[MY_HTML_DIV_NAME]; - - string instClass; - if (present[MY_HTML_DIV_CLASS] && value[MY_HTML_DIV_CLASS]) - instClass = value[MY_HTML_DIV_CLASS]; - - string style; - if (present[MY_HTML_DIV_STYLE] && value[MY_HTML_DIV_STYLE]) - style = value[MY_HTML_DIV_STYLE]; - - if (!style.empty()) - _Style.applyStyle(style); - - // use generic template system - if (_TrustedDomain && !instClass.empty() && instClass == "ryzom-ui-grouptemplate") - { - string id; - if (present[MY_HTML_DIV_ID] && value[MY_HTML_DIV_ID]) - id = value[MY_HTML_DIV_ID]; - - typedef pair TTmplParam; - vector tmplParams; - - string templateName; - if (!style.empty()) - { - TStyle styles = parseStyle(style); - TStyle::iterator it; - for (it=styles.begin(); it != styles.end(); it++) - { - if ((*it).first == "template") - templateName = (*it).second; - else if ((*it).first == "display" && (*it).second == "inline-block") - _BlockLevelElement.back() = false; - else - tmplParams.push_back(TTmplParam((*it).first, (*it).second)); - } - } - - if (!templateName.empty()) - { - string parentId; - bool haveParentDiv = getDiv() != NULL; - if (haveParentDiv) - parentId = getDiv()->getId(); - else - { - if (!_Paragraph) - newParagraph (0); - - parentId = _Paragraph->getId(); - } - - CInterfaceGroup *inst = CWidgetManager::getInstance()->getParser()->createGroupInstance(templateName, parentId+":"+id, tmplParams); - if (inst) - { - inst->setId(parentId+":"+id); - inst->updateCoords(); - if (haveParentDiv) - { - inst->setParent(getDiv()); - inst->setParentSize(getDiv()); - inst->setParentPos(getDiv()); - inst->setPosRef(Hotspot_TL); - inst->setParentPosRef(Hotspot_TL); - getDiv()->addGroup(inst); - - _BlockLevelElement.back() = false; - } - else - { - getParagraph()->addChild(inst); - paragraphChange(); - } - _Divs.push_back(inst); - } - } - } - - if (isBlockLevelElement()) - { - newParagraph(0); - } - } - break; - case HTML_FONT: - { - _Style.pushStyle(); - if (present[HTML_FONT_COLOR] && value[HTML_FONT_COLOR]) - { - CRGBA color; - if (scanHTMLColor(value[HTML_FONT_COLOR], color)) - _Style.Current.TextColor = color; - } - - if (present[HTML_FONT_SIZE] && value[HTML_FONT_SIZE]) - { - uint fontsize; - fromString(value[HTML_FONT_SIZE], fontsize); - _Style.Current.FontSize = fontsize; - } - } - break; - case HTML_BR: - { - endParagraph(); - - // insert zero-width-space (0x200B) to prevent removal of empty lines - ucstring tmp; - tmp.fromUtf8("\xe2\x80\x8b"); - addString(tmp); - } - break; - case HTML_BODY: - { - _Style.pushStyle(); - - string style; - if (present[HTML_BODY_STYLE] && value[HTML_BODY_STYLE]) - style = value[HTML_BODY_STYLE]; - - if (!style.empty()) - _Style.applyStyle(style); - - CRGBA bgColor = _Style.Current.BackgroundColor; - if (present[HTML_BODY_BGCOLOR] && value[HTML_BODY_BGCOLOR]) - scanHTMLColor(value[HTML_BODY_BGCOLOR], bgColor); - - if (bgColor != _Style.Current.BackgroundColor) - setBackgroundColor(bgColor); - - if (!style.empty()) - { - 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); - } - } - } - break; - case HTML_FORM: - { - // Build the form - CGroupHTML::CForm form; - - // Get the action name - if (present[HTML_FORM_ACTION] && value[HTML_FORM_ACTION]) - { - form.Action = getAbsoluteUrl(string(value[HTML_FORM_ACTION])); - } - else - { - form.Action = _URL; - } - _Forms.push_back(form); - } - break; - case HTML_H1: - { - registerAnchorName(MY_HTML_H1); - newParagraph(PBeginSpace); - _Style.pushStyle(); - _Style.Current.FontSize = H1FontSize; - _Style.Current.TextColor = H1Color; - _Style.Current.GlobalColor = H1ColorGlobalColor; - if (present[MY_HTML_H1_STYLE] && value[MY_HTML_H1_STYLE]) - _Style.applyStyle(value[MY_HTML_H1_STYLE]); - } - break; - case HTML_H2: - { - registerAnchorName(MY_HTML_H2); - newParagraph(PBeginSpace); - _Style.pushStyle(); - _Style.Current.FontSize = H2FontSize; - _Style.Current.TextColor = H2Color; - _Style.Current.GlobalColor = H2ColorGlobalColor; - if (present[MY_HTML_H2_STYLE] && value[MY_HTML_H2_STYLE]) - _Style.applyStyle(value[MY_HTML_H2_STYLE]); - } - break; - case HTML_H3: - { - registerAnchorName(MY_HTML_H3); - newParagraph(PBeginSpace); - _Style.pushStyle(); - _Style.Current.FontSize = H3FontSize; - _Style.Current.TextColor = H3Color; - _Style.Current.GlobalColor = H3ColorGlobalColor; - if (present[MY_HTML_H3_STYLE] && value[MY_HTML_H3_STYLE]) - _Style.applyStyle(value[MY_HTML_H3_STYLE]); - } - break; - case HTML_H4: - { - registerAnchorName(MY_HTML_H4); - newParagraph(PBeginSpace); - _Style.pushStyle(); - _Style.Current.FontSize = H4FontSize; - _Style.Current.TextColor = H4Color; - _Style.Current.GlobalColor = H4ColorGlobalColor; - if (present[MY_HTML_H4_STYLE] && value[MY_HTML_H4_STYLE]) - _Style.applyStyle(value[MY_HTML_H4_STYLE]); - } - break; - case HTML_H5: - { - registerAnchorName(MY_HTML_H5); - newParagraph(PBeginSpace); - _Style.pushStyle(); - _Style.Current.FontSize = H5FontSize; - _Style.Current.TextColor = H5Color; - _Style.Current.GlobalColor = H5ColorGlobalColor; - if (present[MY_HTML_H5_STYLE] && value[MY_HTML_H5_STYLE]) - _Style.applyStyle(value[MY_HTML_H5_STYLE]); - } - break; - case HTML_H6: - { - registerAnchorName(MY_HTML_H6); - newParagraph(PBeginSpace); - _Style.pushStyle(); - _Style.Current.FontSize = H6FontSize; - _Style.Current.TextColor = H6Color; - _Style.Current.GlobalColor = H6ColorGlobalColor; - if (present[MY_HTML_H6_STYLE] && value[MY_HTML_H6_STYLE]) - _Style.applyStyle(value[MY_HTML_H6_STYLE]); - } - break; - case HTML_IMG: - { - // Get the string name - if (present[MY_HTML_IMG_SRC] && value[MY_HTML_IMG_SRC]) - { - float tmpf; - std::string id; - - _Style.pushStyle(); - - if (present[MY_HTML_IMG_ID] && value[MY_HTML_IMG_ID]) - id = value[MY_HTML_IMG_ID]; - - if (present[MY_HTML_IMG_WIDTH] && value[MY_HTML_IMG_WIDTH]) - getPercentage(_Style.Current.Width, tmpf, value[MY_HTML_IMG_WIDTH]); - if (present[MY_HTML_IMG_HEIGHT] && value[MY_HTML_IMG_HEIGHT]) - getPercentage(_Style.Current.Height, tmpf, value[MY_HTML_IMG_HEIGHT]); - - // Get the global color name - if (present[MY_HTML_IMG_GLOBAL_COLOR]) - _Style.Current.GlobalColor = true; - - // width, height from inline css - if (present[MY_HTML_IMG_STYLE] && value[MY_HTML_IMG_STYLE]) - _Style.applyStyle(value[MY_HTML_IMG_STYLE]); - - // Tooltip - const char *tooltip = NULL; - // keep "alt" attribute for backward compatibility - if (present[MY_HTML_IMG_ALT] && value[MY_HTML_IMG_ALT]) - tooltip = value[MY_HTML_IMG_ALT]; - // tooltip - if (present[MY_HTML_IMG_TITLE] && value[MY_HTML_IMG_TITLE]) - tooltip = value[MY_HTML_IMG_TITLE]; - - // Mouse over image - string overSrc; - if (present[MY_HTML_IMG_DATA_OVER_SRC] && value[MY_HTML_IMG_DATA_OVER_SRC]) - { - overSrc = value[MY_HTML_IMG_DATA_OVER_SRC]; - } - - - if (getA() && getParent () && getParent ()->getParent()) - { - string params = "name=" + getId() + "|url=" + getLink (); - addButton(CCtrlButton::PushButton, id, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], - overSrc, "browse", params.c_str(), tooltip, _Style.Current); - } - else - if (tooltip || !overSrc.empty()) - { - addButton(CCtrlButton::PushButton, id, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], - overSrc, "", "", tooltip, _Style.Current); - } - else - { - // Get the option to reload (class==reload) - bool reloadImg = false; - - string styleString; - if (present[MY_HTML_IMG_STYLE] && value[MY_HTML_IMG_STYLE]) - styleString = value[MY_HTML_IMG_STYLE]; - - if (!styleString.empty()) - { - TStyle styles = parseStyle(styleString); - TStyle::iterator it; - - it = styles.find("reload"); - if (it != styles.end() && (*it).second == "1") - reloadImg = true; - } - - addImage(id, value[MY_HTML_IMG_SRC], reloadImg, _Style.Current); - } - - _Style.popStyle(); - } - } - break; - case HTML_INPUT: - // Got one form ? - if (!(_Forms.empty())) - { - // read general property - string templateName; - string minWidth; - string id; - - if (present[MY_HTML_INPUT_ID] && value[MY_HTML_INPUT_ID]) - id = value[MY_HTML_INPUT_ID]; - - // Widget template name - if (present[MY_HTML_INPUT_Z_BTN_TMPL] && value[MY_HTML_INPUT_Z_BTN_TMPL]) - templateName = value[MY_HTML_INPUT_Z_BTN_TMPL]; - // Input name is the new - if (present[MY_HTML_INPUT_Z_INPUT_TMPL] && value[MY_HTML_INPUT_Z_INPUT_TMPL]) - templateName = value[MY_HTML_INPUT_Z_INPUT_TMPL]; - // Widget minimal width - if (present[MY_HTML_INPUT_Z_INPUT_WIDTH] && value[MY_HTML_INPUT_Z_INPUT_WIDTH]) - minWidth = value[MY_HTML_INPUT_Z_INPUT_WIDTH]; - - // Get the type - if (present[MY_HTML_INPUT_TYPE] && value[MY_HTML_INPUT_TYPE]) - { - // by default not inherited, font family defaults to system font - _Style.pushStyle(); - _Style.Current.TextColor = TextColor; - _Style.Current.FontSize = TextFontSize; - _Style.Current.FontWeight = FONT_WEIGHT_NORMAL; - _Style.Current.FontOblique = false; - _Style.Current.TextShadow = CStyleParams::STextShadow(true); - _Style.Current.Width = -1; - _Style.Current.Height = -1; - - // Global color flag - if (present[MY_HTML_INPUT_GLOBAL_COLOR]) - _Style.Current.GlobalColor = true; - - // Tooltip - const char *tooltip = NULL; - if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT]) - tooltip = value[MY_HTML_INPUT_ALT]; - - if (present[MY_HTML_INPUT_STYLE] && value[MY_HTML_INPUT_STYLE]) - _Style.applyStyle(value[MY_HTML_INPUT_STYLE]); - - string type = toLower(value[MY_HTML_INPUT_TYPE]); - if (type == "image") - { - // The submit button - string name; - string normal; - string pushed; - string over; - if (present[MY_HTML_INPUT_NAME] && value[MY_HTML_INPUT_NAME]) - name = value[MY_HTML_INPUT_NAME]; - if (present[MY_HTML_INPUT_SRC] && value[MY_HTML_INPUT_SRC]) - normal = value[MY_HTML_INPUT_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); - } - if (type == "button" || type == "submit") - { - // The submit button - string name; - string text; - string normal; - string pushed; - string over; - - string buttonTemplate(!templateName.empty() ? templateName : DefaultButtonGroup ); - if (present[MY_HTML_INPUT_NAME] && value[MY_HTML_INPUT_NAME]) - name = value[MY_HTML_INPUT_NAME]; - if (present[MY_HTML_INPUT_SRC] && value[MY_HTML_INPUT_SRC]) - normal = value[MY_HTML_INPUT_SRC]; - if (present[MY_HTML_INPUT_VALUE] && value[MY_HTML_INPUT_VALUE]) - text = value[MY_HTML_INPUT_VALUE]; - - // 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); - - // 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 (); - } - } - else if (type == "text") - { - // Get the string name - string name; - ucstring ucValue; - uint size = 120; - uint maxlength = 1024; - if (present[MY_HTML_INPUT_NAME] && value[MY_HTML_INPUT_NAME]) - name = value[MY_HTML_INPUT_NAME]; - if (present[MY_HTML_INPUT_SIZE] && value[MY_HTML_INPUT_SIZE]) - fromString(value[MY_HTML_INPUT_SIZE], size); - if (present[MY_HTML_INPUT_VALUE] && value[MY_HTML_INPUT_VALUE]) - ucValue.fromUtf8(value[MY_HTML_INPUT_VALUE]); - if (present[MY_HTML_INPUT_MAXLENGTH] && value[MY_HTML_INPUT_MAXLENGTH]) - fromString(value[MY_HTML_INPUT_MAXLENGTH], maxlength); - - string textTemplate(!templateName.empty() ? templateName : DefaultFormTextGroup); - // Add the editbox - CInterfaceGroup *textArea = addTextArea (textTemplate, name.c_str (), 1, size/12, false, ucValue, maxlength); - if (textArea) - { - // Add the text area to the form - CGroupHTML::CForm::CEntry entry; - entry.Name = name; - entry.TextArea = textArea; - _Forms.back().Entries.push_back (entry); - } - } - else if (type == "checkbox" || type == "radio") - { - CCtrlButton::EType btnType; - string name; - string normal; - string pushed; - string over; - ucstring ucValue = ucstring("on"); - bool checked = false; - - if (type == "radio") - { - btnType = CCtrlButton::RadioButton; - normal = DefaultRadioButtonBitmapNormal; - pushed = DefaultRadioButtonBitmapPushed; - over = DefaultRadioButtonBitmapOver; - } - else - { - btnType = CCtrlButton::ToggleButton; - normal = DefaultCheckBoxBitmapNormal; - pushed = DefaultCheckBoxBitmapPushed; - over = DefaultCheckBoxBitmapOver; - } - - if (present[MY_HTML_INPUT_NAME] && value[MY_HTML_INPUT_NAME]) - name = value[MY_HTML_INPUT_NAME]; - if (present[MY_HTML_INPUT_SRC] && value[MY_HTML_INPUT_SRC]) - normal = value[MY_HTML_INPUT_SRC]; - if (present[MY_HTML_INPUT_VALUE] && value[MY_HTML_INPUT_VALUE]) - ucValue.fromUtf8(value[MY_HTML_INPUT_VALUE]); - checked = (present[MY_HTML_INPUT_CHECKED] && value[MY_HTML_INPUT_CHECKED]); - - // Add the ctrl button - CCtrlButton *checkbox = addButton (btnType, name, normal, pushed, over, "", "", tooltip, _Style.Current); - if (checkbox) - { - if (btnType == CCtrlButton::RadioButton) - { - // override with 'id' because radio buttons share same name - if (!id.empty()) - checkbox->setId(id); - - // group together buttons with same name - CForm &form = _Forms.back(); - bool notfound = true; - for (uint i=0; igetType() == CCtrlButton::RadioButton) - { - checkbox->initRBRefFromRadioButton(form.Entries[i].Checkbox); - notfound = false; - break; - } - } - if (notfound) - { - // this will start a new group (initRBRef() would take first button in group container otherwise) - checkbox->initRBRefFromRadioButton(checkbox); - } - } - - checkbox->setPushed (checked); - - // Add the button to the form - CGroupHTML::CForm::CEntry entry; - entry.Name = name; - entry.Value = decodeHTMLEntities(ucValue); - entry.Checkbox = checkbox; - _Forms.back().Entries.push_back (entry); - } - } - else if (type == "hidden") - { - if (present[MY_HTML_INPUT_NAME] && value[MY_HTML_INPUT_NAME]) - { - // Get the name - string name = value[MY_HTML_INPUT_NAME]; - - // Get the value - ucstring ucValue; - if (present[MY_HTML_INPUT_VALUE] && value[MY_HTML_INPUT_VALUE]) - ucValue.fromUtf8(value[MY_HTML_INPUT_VALUE]); - - // Add an entry - CGroupHTML::CForm::CEntry entry; - entry.Name = name; - entry.Value = decodeHTMLEntities(ucValue); - _Forms.back().Entries.push_back (entry); - } - } - - _Style.popStyle(); - } - } - break; - case HTML_SELECT: - if (!(_Forms.empty())) - { - _Style.pushStyle(); - _Style.Current.Width = -1; - _Style.Current.Height = -1; - - // A select box - string name; - bool multiple = false; - sint32 size = 0; - - if (present[HTML_SELECT_NAME] && value[HTML_SELECT_NAME]) - name = value[HTML_SELECT_NAME]; - if (present[HTML_SELECT_SIZE] && value[HTML_SELECT_SIZE]) - fromString(value[HTML_SELECT_SIZE], size); - if (present[HTML_SELECT_MULTIPLE] && value[HTML_SELECT_MULTIPLE]) - multiple = true; - if (present[HTML_SELECT_STYLE] && value[HTML_SELECT_STYLE]) - _Style.applyStyle(value[HTML_SELECT_STYLE]); - - CGroupHTML::CForm::CEntry entry; - entry.Name = name; - entry.sbMultiple = multiple; - if (size > 1 || multiple) - { - entry.InitialSelection = -1; - CGroupMenu *sb = addSelectBox(DefaultFormSelectBoxMenuGroup, name.c_str()); - if (sb) - { - if (size < 1) - size = 4; - - if (_Style.Current.Width > -1) - sb->setMinW(_Style.Current.Width); - - if (_Style.Current.Height > -1) - sb->setMinH(_Style.Current.Height); - - sb->setMaxVisibleLine(size); - sb->setFontSize(_Style.Current.FontSize); - } - - entry.SelectBox = sb; - } - else - { - CDBGroupComboBox *cb = addComboBox(DefaultFormSelectGroup, name.c_str()); - entry.ComboBox = cb; - - if (cb) - { - // create view text - cb->updateCoords(); - if (cb->getViewText()) - setTextStyle(cb->getViewText(), _Style.Current); - } - } - _Forms.back().Entries.push_back (entry); - - _Style.popStyle(); - } - break; - case HTML_OPTION: - // Got one form ? - if (!(_Forms.empty())) - { - if (!_Forms.back().Entries.empty()) - { - // clear the option string - _SelectOptionStr.clear(); - - std::string optionValue; - if (present[HTML_OPTION_VALUE] && value[HTML_OPTION_VALUE]) - optionValue = value[HTML_OPTION_VALUE]; - _Forms.back().Entries.back().SelectValues.push_back(optionValue); - - if (present[HTML_OPTION_SELECTED]) - _Forms.back().Entries.back().InitialSelection = (sint)_Forms.back().Entries.back().SelectValues.size() - 1; - if (present[HTML_OPTION_DISABLED]) - _Forms.back().Entries.back().sbOptionDisabled = (sint)_Forms.back().Entries.back().SelectValues.size() - 1; - } - } - _SelectOption = true; - break; - case HTML_LI: - if (!_UL.empty()) - { - // UL, OL top margin if this is the first LI - if (!_LI) - { - _LI = true; - newParagraph(ULBeginSpace); - } - else - { - newParagraph(LIBeginSpace); - } - - // OL list index can be overridden by
  • attribute - if (present[HTML_LI_VALUE] && value[HTML_LI_VALUE]) - fromString(value[HTML_LI_VALUE], _UL.back().Value); - - _Style.pushStyle(); - if (present[HTML_LI_STYLE] && value[HTML_LI_STYLE]) - _Style.applyStyle(value[HTML_LI_STYLE]); - - ucstring str; - str.fromUtf8(_UL.back().getListMarkerText()); - addString (str); - - sint32 indent = LIIndent; - // list-style-type: outside - if (_CurrentViewLink) - { - getParagraph()->setFirstViewIndent(-_CurrentViewLink->getMaxUsedW()); - } - - flushString (); - - _UL.back().Value++; - } - break; - case HTML_P: - { - newParagraph(PBeginSpace); - _Style.pushStyle(); - if (present[MY_HTML_P_STYLE] && value[MY_HTML_P_STYLE]) - _Style.applyStyle(value[MY_HTML_P_STYLE]); - } - break; - case HTML_PRE: - { - _Style.pushStyle(); - _Style.Current.FontFamily = "monospace"; - - if (present[HTML_PRE_STYLE] && value[HTML_PRE_STYLE]) - _Style.applyStyle(value[HTML_PRE_STYLE]); - - - _PRE.push_back(true); - } - break; - case HTML_TABLE: - { - _Style.pushStyle(); - registerAnchorName(MY_HTML_TABLE); - - // Get cells parameters - getCellsParameters_DEP (MY_HTML_TABLE, false); - - CGroupTable *table = new CGroupTable(TCtorParam()); - table->BgColor = _CellParams.back().BgColor; - - if (present[MY_HTML_TABLE_WIDTH] && value[MY_HTML_TABLE_WIDTH]) - getPercentage (table->ForceWidthMin, table->TableRatio, value[MY_HTML_TABLE_WIDTH]); - if (present[MY_HTML_TABLE_BORDER] && value[MY_HTML_TABLE_BORDER]) - fromString(value[MY_HTML_TABLE_BORDER], table->Border); - if (present[MY_HTML_TABLE_BORDERCOLOR] && value[MY_HTML_TABLE_BORDERCOLOR]) - scanHTMLColor(value[MY_HTML_TABLE_BORDERCOLOR], table->BorderColor); - if (present[MY_HTML_TABLE_CELLSPACING] && value[MY_HTML_TABLE_CELLSPACING]) - fromString(value[MY_HTML_TABLE_CELLSPACING], table->CellSpacing); - if (present[MY_HTML_TABLE_CELLPADDING] && value[MY_HTML_TABLE_CELLPADDING]) - fromString(value[MY_HTML_TABLE_CELLPADDING], table->CellPadding); - if (present[MY_HTML_TABLE_STYLE] && value[MY_HTML_TABLE_STYLE]) - _Style.applyStyle(value[MY_HTML_TABLE_STYLE]); - - table->setMarginLeft(getIndent()); - addHtmlGroup (table, 0); - - _Tables.push_back(table); - - // Add a cell pointer - _Cells.push_back(NULL); - _TR.push_back(false); - _Indent.push_back(0); - } - break; - case HTML_TH: - // TH is similar to TD, just different font style - case HTML_TD: - { - // Get cells parameters - getCellsParameters_DEP (MY_HTML_TD, true); - - _Style.pushStyle(); - if (element_number == HTML_TH) - { - _Style.Current.FontWeight = FONT_WEIGHT_BOLD; - // center if not specified otherwise. TD/TH present/value arrays have same indices - if (!(present[MY_HTML_TD_ALIGN] && value[MY_HTML_TD_ALIGN])) - _CellParams.back().Align = CGroupCell::Center; - } - - if (present[MY_HTML_TD_STYLE] && value[MY_HTML_TD_STYLE]) - _Style.applyStyle(value[MY_HTML_TD_STYLE]); - - CGroupTable *table = getTable(); - if (table) - { - if (!_Cells.empty()) - { - _Cells.back() = new CGroupCell(CViewBase::TCtorParam()); - string style; - if (present[MY_HTML_TD_STYLE] && value[MY_HTML_TD_STYLE]) - style = value[MY_HTML_TD_STYLE]; - - // Set the cell parameters - if (!style.empty()) - { - TStyle styles = parseStyle(style); - TStyle::iterator it; - - it = styles.find("background-repeat"); - _Cells.back()->setTextureTile(it != styles.end()); - - // Webig only - it = styles.find("background-scale"); - _Cells.back()->setTextureScale(it != styles.end()); - - 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); - addImageDownload(image, _Cells.back()); - // Image in BNP - } - else - { - _Cells.back()->setTexture(image); - } - } - } - - if (present[MY_HTML_TD_COLSPAN] && value[MY_HTML_TD_COLSPAN]) - fromString(value[MY_HTML_TD_COLSPAN], _Cells.back()->ColSpan); - if (present[MY_HTML_TD_ROWSPAN] && value[MY_HTML_TD_ROWSPAN]) - fromString(value[MY_HTML_TD_ROWSPAN], _Cells.back()->RowSpan); - - _Cells.back()->BgColor = _CellParams.back().BgColor; - _Cells.back()->Align = _CellParams.back().Align; - _Cells.back()->VAlign = _CellParams.back().VAlign; - _Cells.back()->LeftMargin = _CellParams.back().LeftMargin; - _Cells.back()->NoWrap = _CellParams.back().NoWrap; - _Cells.back()->ColSpan = std::max(1, _Cells.back()->ColSpan); - _Cells.back()->RowSpan = std::max(1, _Cells.back()->RowSpan); - - float temp; - if (present[MY_HTML_TD_WIDTH] && value[MY_HTML_TD_WIDTH]) - getPercentage (_Cells.back()->WidthWanted, _Cells.back()->TableRatio, value[MY_HTML_TD_WIDTH]); - if (present[MY_HTML_TD_HEIGHT] && value[MY_HTML_TD_HEIGHT]) - getPercentage (_Cells.back()->Height, temp, value[MY_HTML_TD_HEIGHT]); - - _Cells.back()->NewLine = getTR(); - table->addChild (_Cells.back()); - - // reusing indent pushed by table - _Indent.back() = 0; - - newParagraph(TDBeginSpace); - // indent is already 0, getParagraph()->setMarginLeft(0); // maybe setIndent(0) if LI is using one - - // Reset TR flag - if (!_TR.empty()) - _TR.back() = false; - } - } - } - break; - case HTML_TEXTAREA: - _Style.pushStyle(); - _PRE.push_back(true); - - // not inherited by default, font family defaults to system font - _Style.Current.TextColor = TextColor; - _Style.Current.FontWeight = FONT_WEIGHT_NORMAL; - _Style.Current.FontOblique = false; - _Style.Current.FontSize = TextFontSize; - _Style.Current.TextShadow = CStyleParams::STextShadow(true); - _Style.Current.Width = -1; - _Style.Current.Height = -1; - - if (present[MY_HTML_TEXTAREA_STYLE] && value[MY_HTML_TEXTAREA_STYLE]) - _Style.applyStyle(value[MY_HTML_TEXTAREA_STYLE]); - - // Got one form ? - if (!(_Forms.empty())) - { - // read general property - string templateName; - - // Widget template name - if (present[MY_HTML_TEXTAREA_Z_INPUT_TMPL] && value[MY_HTML_TEXTAREA_Z_INPUT_TMPL]) - templateName = value[MY_HTML_TEXTAREA_Z_INPUT_TMPL]; - - // Get the string name - _TextAreaName.clear(); - _TextAreaRow = 1; - _TextAreaCols = 10; - _TextAreaContent.clear(); - _TextAreaMaxLength = 1024; - if (present[MY_HTML_TEXTAREA_NAME] && value[MY_HTML_TEXTAREA_NAME]) - _TextAreaName = value[MY_HTML_TEXTAREA_NAME]; - if (present[MY_HTML_TEXTAREA_ROWS] && value[MY_HTML_TEXTAREA_ROWS]) - fromString(value[MY_HTML_TEXTAREA_ROWS], _TextAreaRow); - if (present[MY_HTML_TEXTAREA_COLS] && value[MY_HTML_TEXTAREA_COLS]) - fromString(value[MY_HTML_TEXTAREA_COLS], _TextAreaCols); - if (present[MY_HTML_TEXTAREA_MAXLENGTH] && value[MY_HTML_TEXTAREA_MAXLENGTH]) - fromString(value[MY_HTML_TEXTAREA_MAXLENGTH], _TextAreaMaxLength); - - _TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup; - _TextArea = true; - } - break; - case HTML_TITLE: - { - if(!_TitlePrefix.empty()) - _TitleString = _TitlePrefix + " - "; - else - _TitleString.clear(); - _Title = true; - } - break; - case HTML_I: - { - _Localize = true; - } - break; - case HTML_TR: - { - // Get cells parameters - getCellsParameters_DEP (MY_HTML_TR, true); - - // Set TR flag - if (!_TR.empty()) - _TR.back() = true; - - _Style.pushStyle(); - if (present[MY_HTML_TR_STYLE] && value[MY_HTML_TR_STYLE]) - _Style.applyStyle(value[MY_HTML_TR_STYLE]); - } - break; - case HTML_UL: - if (_UL.empty()) - _UL.push_back(HTMLOListElement(1, "disc")); - else if (_UL.size() == 1) - _UL.push_back(HTMLOListElement(1, "circle")); - else - _UL.push_back(HTMLOListElement(1, "square")); - // if LI is already present - _LI = _UL.size() > 1 || _DL.size() > 1; - _Indent.push_back(getIndent() + ULIndent); - endParagraph(); - - _Style.pushStyle(); - if (present[HTML_UL_STYLE] && value[HTML_UL_STYLE]) - _Style.applyStyle(value[HTML_UL_STYLE]); - break; - case HTML_OBJECT: - _ObjectType.clear(); - _ObjectData.clear(); - _ObjectMD5Sum.clear(); - _ObjectAction.clear(); - if (present[HTML_OBJECT_TYPE] && value[HTML_OBJECT_TYPE]) - _ObjectType = value[HTML_OBJECT_TYPE]; - if (present[HTML_OBJECT_DATA] && value[HTML_OBJECT_DATA]) - _ObjectData = value[HTML_OBJECT_DATA]; - if (present[HTML_OBJECT_ID] && value[HTML_OBJECT_ID]) - _ObjectMD5Sum = value[HTML_OBJECT_ID]; - if (present[HTML_OBJECT_STANDBY] && value[HTML_OBJECT_STANDBY]) - _ObjectAction = value[HTML_OBJECT_STANDBY]; - _Object = true; - - break; - case HTML_SPAN: - { - _Style.pushStyle(); - - if (present[MY_HTML_SPAN_STYLE] && value[MY_HTML_SPAN_STYLE]) - _Style.applyStyle(value[MY_HTML_SPAN_STYLE]); - } - break; - case HTML_DEL: - { - _Style.pushStyle(); - _Style.Current.StrikeThrough = true; - } - break; - case HTML_U: - { - _Style.pushStyle(); - _Style.Current.Underlined = true; - } - break; - case HTML_EM: - { - _Style.pushStyle(); - _Style.Current.FontOblique = true; - } - break; - case HTML_STRONG: - { - _Style.pushStyle(); - _Style.Current.FontWeight = FONT_WEIGHT_BOLD; - } - break; - case HTML_SMALL: - { - _Style.pushStyle(); - _Style.Current.FontSize = _Style.getFontSizeSmaller(); - } - break; - case HTML_STYLE: - case HTML_SCRIPT: - _IgnoreText = true; - break; - case HTML_DL: - { - _DL.push_back(HTMLDListElement()); - _LI = _DL.size() > 1 || !_UL.empty(); - endParagraph(); - _Style.pushStyle(); - if (present[HTML_GEN_STYLE] && value[HTML_GEN_STYLE]) - _Style.applyStyle(value[HTML_GEN_STYLE]); - } - break; - case HTML_DT: - if (!_DL.empty()) - { - // close if still open - if (_DL.back().DD) - { - _DL.back().DD = false; - popIfNotEmpty(_Indent); - _Style.popStyle(); - } - - // close if still open - if (_DL.back().DT) - _Style.popStyle(); - - _DL.back().DT = true; - - _Style.pushStyle(); - _Style.Current.FontWeight = FONT_WEIGHT_BOLD; - if (present[HTML_GEN_STYLE] && value[HTML_GEN_STYLE]) - _Style.applyStyle(value[HTML_GEN_STYLE]); - - if (!_LI) - { - _LI = true; - newParagraph(ULBeginSpace); - } - else - { - newParagraph(LIBeginSpace); - } - } - break; - case HTML_DD: - if (!_DL.empty()) - { - // if there was no closing tag for
    , then remove
    style - if (_DL.back().DT) - { - _DL.back().DT = false; - _Style.popStyle(); - } - - if (_DL.back().DD) - { - _DL.back().DD = false; - _Style.popStyle(); - popIfNotEmpty(_Indent); - } - - _DL.back().DD = true; - _Indent.push_back(getIndent() + ULIndent); - - _Style.pushStyle(); - if (present[HTML_GEN_STYLE] && value[HTML_GEN_STYLE]) - _Style.applyStyle(value[HTML_GEN_STYLE]); - - if (!_LI) - { - _LI = true; - newParagraph(ULBeginSpace); - } - else - { - newParagraph(LIBeginSpace); - } - } - break; - case HTML_OL: - { - _Style.pushStyle(); - sint32 start = 1; - std::string type("1"); - - if (present[HTML_OL_START] && value[HTML_OL_START]) - fromString(value[HTML_OL_START], start); - if (present[HTML_OL_TYPE] && value[HTML_OL_TYPE]) - type = value[HTML_OL_TYPE]; - if (present[HTML_OL_STYLE] && value[HTML_OL_STYLE]) - _Style.applyStyle(value[HTML_OL_STYLE]); - - _UL.push_back(HTMLOListElement(start, type)); - // if LI is already present - _LI = _UL.size() > 1 || _DL.size() > 1; - _Indent.push_back(getIndent() + ULIndent); - endParagraph(); - } - break; - case HTML_HR: - { - newParagraph(0); - - CInterfaceGroup *sep = CWidgetManager::getInstance()->getParser()->createGroupInstance("html_hr", "", NULL, 0); - if (sep) - { - _Style.pushStyle(); - _Style.Current.TextColor = CRGBA(120, 120, 120, 255); - _Style.Current.Height = -1; - _Style.Current.Width = -1; - - if (present[HTML_HR_STYLE] && value[HTML_HR_STYLE]) - _Style.applyStyle(value[HTML_HR_STYLE]); - - CViewBitmap *bitmap = dynamic_cast(sep->getView("hr")); - if (bitmap) - { - bitmap->setColor(_Style.Current.TextColor); - if (_Style.Current.Width > 0) - { - clamp(_Style.Current.Width, 1, 32000); - bitmap->setW(_Style.Current.Width); - bitmap->setSizeRef(CInterfaceElement::none); - } - if (_Style.Current.Height > 0) - { - clamp(_Style.Current.Height, 1, 1000); - bitmap->setH(_Style.Current.Height); - } - } - - getParagraph()->addChild(sep); - endParagraph(); - - _Style.popStyle(); - } - } - break; - } - } - } - - // *************************************************************************** - - void CGroupHTML::endElementDeprecated(uint element_number) - { - if (_Browsing) - { - // Paragraph ? - switch(element_number) - { - case HTML_HEAD: - _ReadingHeadTag = false; - break; - case HTML_BODY: - _Style.popStyle(); - break; - case HTML_FONT: - _Style.popStyle(); - break; - case HTML_A: - _Style.popStyle(); - popIfNotEmpty (_A); - popIfNotEmpty (_Link); - popIfNotEmpty (_LinkTitle); - popIfNotEmpty (_LinkClass); - break; - case HTML_H1: - case HTML_H2: - case HTML_H3: - case HTML_H4: - case HTML_H5: - case HTML_H6: - _Style.popStyle(); - endParagraph(); - break; - case HTML_P: - _Style.popStyle(); - endParagraph(); - break; - case HTML_PRE: - _Style.popStyle(); - popIfNotEmpty (_PRE); - break; - case HTML_DIV: - _Style.popStyle(); - if (isBlockLevelElement()) - { - endParagraph(); - } - _DivName.clear(); - popIfNotEmpty (_Divs); - popIfNotEmpty (_BlockLevelElement); - break; - - case HTML_TABLE: - _Style.popStyle(); - popIfNotEmpty (_CellParams); - popIfNotEmpty (_TR); - popIfNotEmpty (_Cells); - popIfNotEmpty (_Tables); - popIfNotEmpty (_Indent); - endParagraph(); - // Add a cell - break; - case HTML_TH: - // no break; - case HTML_TD: - _Style.popStyle(); - popIfNotEmpty (_CellParams); - if (!_Cells.empty()) - _Cells.back() = NULL; - break; - case HTML_TR: - _Style.popStyle(); - popIfNotEmpty (_CellParams); - break; - case HTML_TEXTAREA: - { - _TextArea = false; - if (!(_Forms.empty())) - { - CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent, _TextAreaMaxLength); - if (textArea) - { - // Add the text area to the form - CGroupHTML::CForm::CEntry entry; - entry.Name = _TextAreaName; - entry.TextArea = textArea; - _Forms.back().Entries.push_back (entry); - } - } - - _Style.popStyle(); - popIfNotEmpty (_PRE); - } - break; - case HTML_TITLE: - { - _Title = false; - - // Get the parent container - setTitle (_TitleString); - } - break; - case HTML_SELECT: - { - _SelectOption = false; - if (!(_Forms.empty())) - { - if (!_Forms.back().Entries.empty()) - { - CDBGroupComboBox *cb = _Forms.back().Entries.back().ComboBox; - if (cb) - { - cb->setSelectionNoTrigger(_Forms.back().Entries.back().InitialSelection); - cb->setW(cb->evalContentWidth() + 16); - } - } - } - } - break; - case HTML_OPTION: - if (!(_Forms.empty()) && !(_Forms.back().Entries.empty())) - { - // insert the parsed text into the select control - CDBGroupComboBox *cb = _Forms.back().Entries.back().ComboBox; - if (cb) - { - uint lineIndex = cb->getNumTexts(); - cb->addText(_SelectOptionStr); - if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex) - { - cb->setGrayed(lineIndex, true); - } - } - else - { - CGroupMenu *sb = _Forms.back().Entries.back().SelectBox; - if (sb) - { - uint lineIndex = sb->getNumLine(); - sb->addLine(_SelectOptionStr, "", ""); - - if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex) - { - sb->setGrayedLine(lineIndex, true); - } - else - { - // create option line checkbox, CGroupMenu is taking ownership of the checbox - CInterfaceGroup *ig = CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_checkbox", "", NULL, 0); - if (ig) - { - CCtrlButton *cb = dynamic_cast(ig->getCtrl("b")); - if (cb) - { - if (_Forms.back().Entries.back().sbMultiple) - { - cb->setType(CCtrlButton::ToggleButton); - cb->setTexture(DefaultCheckBoxBitmapNormal); - cb->setTexturePushed(DefaultCheckBoxBitmapPushed); - cb->setTextureOver(DefaultCheckBoxBitmapOver); - } - else - { - cb->setType(CCtrlButton::RadioButton); - cb->setTexture(DefaultRadioButtonBitmapNormal); - cb->setTexturePushed(DefaultRadioButtonBitmapPushed); - cb->setTextureOver(DefaultRadioButtonBitmapOver); - - if (_Forms.back().Entries.back().sbRBRef == NULL) - _Forms.back().Entries.back().sbRBRef = cb; - - cb->initRBRefFromRadioButton(_Forms.back().Entries.back().sbRBRef); - } - - cb->setPushed(_Forms.back().Entries.back().InitialSelection == lineIndex); - sb->setUserGroupLeft(lineIndex, ig); - } - else - { - nlwarning("Failed to get 'b' element from 'menu_checkbox' template"); - delete ig; - } - } - } - } - } - } - break; - case HTML_I: - { - _Localize = false; - } - break; - case HTML_OL: - case HTML_UL: - if (!_UL.empty()) - { - endParagraph(); - _Style.popStyle(); - popIfNotEmpty(_UL); - popIfNotEmpty(_Indent); - } - break; - case HTML_LI: - { - _Style.popStyle(); - } - break; - case HTML_DL: - if (!_DL.empty()) - { - endParagraph(); - - // unclosed DT - if (_DL.back().DT) - { - _Style.popStyle(); - } - - // unclosed DD - if (_DL.back().DD) - { - popIfNotEmpty(_Indent); - _Style.popStyle(); - } - - popIfNotEmpty (_DL); - _Style.popStyle(); - } - break; - case HTML_DT: - if (!_DL.empty()) - { - if (_DL.back().DT) - _Style.popStyle(); - _DL.back().DT = false; - } - break; - case HTML_DD: - if (!_DL.empty()) - { - // parser will process two DD in a row as nested when first DD is not closed - if (_DL.back().DD) - { - _DL.back().DD = false; - popIfNotEmpty(_Indent); - _Style.popStyle(); - } - } - break; - case HTML_SPAN: - _Style.popStyle(); - break; - case HTML_DEL: - _Style.popStyle(); - break; - case HTML_U: - _Style.popStyle(); - break; - case HTML_EM: - _Style.popStyle(); - break; - case HTML_STRONG: - _Style.popStyle(); - break; - case HTML_SMALL: - _Style.popStyle(); - break; - case HTML_STYLE: - case HTML_SCRIPT: - _IgnoreText = false; - break; - case HTML_OBJECT: - if (_TrustedDomain) - { - if (_ObjectType=="application/ryzom-data") - { - if (!_ObjectData.empty()) - { - if (addBnpDownload(_ObjectData, _ObjectAction, _ObjectScript, _ObjectMD5Sum)) - { - CLuaManager::getInstance().executeLuaScript("\nlocal __ALLREADYDL__=true\n"+_ObjectScript, true); - } - _ObjectScript.clear(); - } - } - _Object = false; - } - break; - } - } - } - // *************************************************************************** NLMISC_REGISTER_OBJECT(CViewBase, CGroupHTML, std::string, "html"); @@ -6237,77 +4665,6 @@ namespace NLGUI return 0; } - // *************************************************************************** - // @deprecated - int CGroupHTML::luaBeginElement(CLuaState &ls) - { - nlwarning("Deprecated luaBeginElement on url '%s'", _URL.c_str()); - - const char *funcName = "beginElement"; - CLuaIHM::checkArgCount(ls, funcName, 2); - CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE); - - uint element_number = (uint)ls.toInteger(1); - std::vector present; - std::vector value; - present.resize(30, false); - value.resize(30); - - CLuaObject params; - params.pop(ls); - uint max_idx = 0; - - - ENUM_LUA_TABLE(params, it) - { - if (!it.nextKey().isInteger()) - { - nlwarning("%s : bad key encountered with type %s, integer expected.", funcName, it.nextKey().getTypename()); - continue; - } - if (!it.nextValue().isString()) - { - nlwarning("%s : bad value encountered with type %s for key %s, string expected.", funcName, it.nextValue().getTypename(), it.nextKey().toString().c_str()); - continue; - } - uint idx = (uint)it.nextKey().toInteger(); - - present.insert(present.begin() + (uint)it.nextKey().toInteger(), true); - - string str = it.nextValue().toString(); - size_t size = str.size() + 1; - char * buffer = new char[ size ]; - strncpy(buffer, str.c_str(), size ); - - value.insert(value.begin() + (uint)it.nextKey().toInteger(), buffer); - } - - // ingame lua scripts from browser are using url scheme - // reason unknown - _LuaHrefHack = true; - beginElementDeprecated(element_number, present, value); - _LuaHrefHack = false; - - return 0; - } - - - // *************************************************************************** - // @deprecated - int CGroupHTML::luaEndElement(CLuaState &ls) - { - const char *funcName = "endElement"; - CLuaIHM::checkArgCount(ls, funcName, 1); - CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - - uint element_number = (uint)ls.toInteger(1); - endElementDeprecated(element_number); - - return 0; - } - - // *************************************************************************** int CGroupHTML::luaShowDiv(CLuaState &ls) {