getType() == CCtrlButton::RadioButton)
- {
- checkbox->initRBRefFromRadioButton(form.Entries[i].Checkbox);
- notfound = false;
- break;
- }
- }
- if (notfound)
+ if (form.Entries[i].Name == name && form.Entries[i].Checkbox->getType() == CCtrlButton::RadioButton)
{
- // this will start a new group (initRBRef() would take first button in group container otherwise)
- checkbox->initRBRefFromRadioButton(checkbox);
+ 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);
+ 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);
- }
- renderPseudoElement(":after", elm);
+ // 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")
+ renderPseudoElement(":after", elm);
+ }
+ else if (type == "hidden")
+ {
+ if (elm.hasNonEmptyAttribute("name"))
{
- if (elm.hasNonEmptyAttribute("name"))
- {
- // Get the name
- string name = elm.getAttribute("name");
-
- // Get the value
- ucstring ucValue;
- ucValue.fromUtf8(elm.getAttribute("value"));
-
- // Add an entry
- CGroupHTML::CForm::CEntry entry;
- entry.Name = name;
- entry.Value = decodeHTMLEntities(ucValue);
- _Forms.back().Entries.push_back (entry);
- }
+ // Get the name
+ string name = elm.getAttribute("name");
+
+ // Get the value
+ ucstring ucValue;
+ ucValue.fromUtf8(elm.getAttribute("value"));
+
+ // Add an entry
+ CGroupHTML::CForm::CEntry entry;
+ entry.Name = name;
+ entry.Value = decodeHTMLEntities(ucValue);
+ _Forms.back().Entries.push_back (entry);
}
}
}
@@ -5908,31 +5913,33 @@ namespace NLGUI
std::string httpEquiv = elm.getAttribute("http-equiv");
std::string httpContent = elm.getAttribute("content");
- if (!httpEquiv.empty() && !httpContent.empty())
+ if (httpEquiv.empty() || httpContent.empty())
{
- // only first http-equiv="refresh" should be handled
- if (_RefreshUrl.empty() && httpEquiv == "refresh")
- {
- const CWidgetManager::SInterfaceTimes × = CWidgetManager::getInstance()->getInterfaceTimes();
- double timeSec = times.thisFrameMs / 1000.0f;
+ return;
+ }
- string::size_type pos = httpContent.find_first_of(";");
- if (pos == string::npos)
- {
- fromString(httpContent, _NextRefreshTime);
- _RefreshUrl = _URL;
- }
- else
- {
- fromString(httpContent.substr(0, pos), _NextRefreshTime);
+ // only first http-equiv="refresh" should be handled
+ if (_RefreshUrl.empty() && httpEquiv == "refresh")
+ {
+ const CWidgetManager::SInterfaceTimes × = CWidgetManager::getInstance()->getInterfaceTimes();
+ double timeSec = times.thisFrameMs / 1000.0f;
- pos = toLower(httpContent).find("url=");
- if (pos != string::npos)
- _RefreshUrl = getAbsoluteUrl(httpContent.substr(pos + 4));
- }
+ string::size_type pos = httpContent.find_first_of(";");
+ if (pos == string::npos)
+ {
+ fromString(httpContent, _NextRefreshTime);
+ _RefreshUrl = _URL;
+ }
+ else
+ {
+ fromString(httpContent.substr(0, pos), _NextRefreshTime);
- _NextRefreshTime += timeSec;
+ pos = toLower(httpContent).find("url=");
+ if (pos != string::npos)
+ _RefreshUrl = getAbsoluteUrl(httpContent.substr(pos + 4));
}
+
+ _NextRefreshTime += timeSec;
}
}
@@ -6298,85 +6305,91 @@ namespace NLGUI
}
CGroupTable *table = getTable();
- if (table)
+ if (!table)
{
- if (_Style.hasStyle("padding"))
- {
- uint32 a;
- // TODO: cssLength
- if (fromString(_Style.getStyle("padding"), a))
- table->CellPadding = a;
- }
+ // appears to be outside
+ return;
+ }
- if (!_Cells.empty())
- {
- _Cells.back() = new CGroupCell(CViewBase::TCtorParam());
+ if (_Cells.empty())
+ {
+ // not started
+ return;
+ }
- if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat"))
- _Cells.back()->setTextureTile(true);
+ if (_Style.hasStyle("padding"))
+ {
+ uint32 a;
+ // TODO: cssLength
+ if (fromString(_Style.getStyle("padding"), a))
+ table->CellPadding = a;
+ }
- if (_Style.checkStyle("background-scale", "1") || _Style.checkStyle("background-size", "cover"))
- _Cells.back()->setTextureScale(true);
+ _Cells.back() = new CGroupCell(CViewBase::TCtorParam());
- if (_Style.hasStyle("background-image"))
- {
- string image = _Style.getStyle("background-image");
+ if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat"))
+ _Cells.back()->setTextureTile(true);
- 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 (_Style.checkStyle("background-scale", "1") || _Style.checkStyle("background-size", "cover"))
+ _Cells.back()->setTextureScale(true);
- if (elm.hasNonEmptyAttribute("colspan"))
- fromString(elm.getAttribute("colspan"), _Cells.back()->ColSpan);
- if (elm.hasNonEmptyAttribute("rowspan"))
- fromString(elm.getAttribute("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 (_Style.hasStyle("width"))
- 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"))
- getPercentage (_Cells.back()->Height, temp, elm.getAttribute("height").c_str());
+ 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);
+ }
+ }
- _Cells.back()->NewLine = getTR();
- table->addChild (_Cells.back());
+ if (elm.hasNonEmptyAttribute("colspan"))
+ fromString(elm.getAttribute("colspan"), _Cells.back()->ColSpan);
+ if (elm.hasNonEmptyAttribute("rowspan"))
+ fromString(elm.getAttribute("rowspan"), _Cells.back()->RowSpan);
- // reusing indent pushed by table
- _Indent.back() = 0;
+ _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);
- newParagraph(TDBeginSpace);
- // indent is already 0, getParagraph()->setMarginLeft(0); // maybe setIndent(0) if LI is using one
+ float temp;
+ if (_Style.hasStyle("width"))
+ 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"))
+ getPercentage (_Cells.back()->Height, temp, elm.getAttribute("height").c_str());
- // Reset TR flag
- if (!_TR.empty())
- _TR.back() = false;
+ _Cells.back()->NewLine = getTR();
+ table->addChild (_Cells.back());
- renderPseudoElement(":before", elm);
- }
- }
+ // 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;
+
+ renderPseudoElement(":before", elm);
}
void CGroupHTML::htmlTDend(const CHtmlElement &elm)
@@ -6391,43 +6404,38 @@ namespace NLGUI
// ***************************************************************************
void CGroupHTML::htmlTEXTAREA(const CHtmlElement &elm)
{
- _PRE.push_back(true);
-
- // Got one form ?
- if (!(_Forms.empty()))
- {
- // read general property
- string templateName;
+ if (_Forms.empty())
+ return;
- // Widget template name
- if (elm.hasNonEmptyAttribute("z_input_tmpl"))
- templateName = elm.getAttribute("z_input_tmpl");
+ // read general property
+ string templateName;
- // Get the string name
- _TextAreaName.clear();
- _TextAreaRow = 1;
- _TextAreaCols = 10;
- _TextAreaContent.clear();
- _TextAreaMaxLength = 1024;
- if (elm.hasNonEmptyAttribute("name"))
- _TextAreaName = elm.getAttribute("name");
- if (elm.hasNonEmptyAttribute("rows"))
- fromString(elm.getAttribute("rows"), _TextAreaRow);
- if (elm.hasNonEmptyAttribute("cols"))
- fromString(elm.getAttribute("cols"), _TextAreaCols);
- if (elm.hasNonEmptyAttribute("maxlength"))
- fromString(elm.getAttribute("maxlength"), _TextAreaMaxLength);
+ // Widget template name
+ if (elm.hasNonEmptyAttribute("z_input_tmpl"))
+ templateName = elm.getAttribute("z_input_tmpl");
- _TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup;
- _TextArea = true;
- }
+ // Get the string name
+ _TextAreaName.clear();
+ _TextAreaRow = 1;
+ _TextAreaCols = 10;
+ _TextAreaContent.clear();
+ _TextAreaMaxLength = 1024;
+ if (elm.hasNonEmptyAttribute("name"))
+ _TextAreaName = elm.getAttribute("name");
+ if (elm.hasNonEmptyAttribute("rows"))
+ fromString(elm.getAttribute("rows"), _TextAreaRow);
+ if (elm.hasNonEmptyAttribute("cols"))
+ fromString(elm.getAttribute("cols"), _TextAreaCols);
+ if (elm.hasNonEmptyAttribute("maxlength"))
+ fromString(elm.getAttribute("maxlength"), _TextAreaMaxLength);
+
+ _TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup;
+ _TextArea = true;
+ _PRE.push_back(true);
}
void CGroupHTML::htmlTEXTAREAend(const CHtmlElement &elm)
{
- _TextArea = false;
- popIfNotEmpty (_PRE);
-
if (_Forms.empty())
return;
@@ -6440,6 +6448,9 @@ namespace NLGUI
entry.TextArea = textArea;
_Forms.back().Entries.push_back (entry);
}
+
+ _TextArea = false;
+ popIfNotEmpty (_PRE);
}
// ***************************************************************************
|