Changed: Change long if blocks to early exits

--HG--
branch : develop
feature/clean-deprecated
Nimetu 6 years ago
parent 4fcd71d7ba
commit ff3b4cfabd

@ -5539,65 +5539,67 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CGroupHTML::htmlIMG(const CHtmlElement &elm) void CGroupHTML::htmlIMG(const CHtmlElement &elm)
{ {
// Get the string name std::string src = trim(elm.getAttribute("src"));
if (elm.hasNonEmptyAttribute("src")) if (src.empty())
{ {
float tmpf; // no 'src' attribute, or empty
std::string id = elm.getAttribute("id"); return;
std::string src = elm.getAttribute("src"); }
if (elm.hasNonEmptyAttribute("width")) float tmpf;
getPercentage(_Style.Current.Width, tmpf, elm.getAttribute("width").c_str()); std::string id = elm.getAttribute("id");
if (elm.hasNonEmptyAttribute("height"))
getPercentage(_Style.Current.Height, tmpf, elm.getAttribute("height").c_str());
// Get the global color name if (elm.hasNonEmptyAttribute("width"))
if (elm.hasAttribute("global_color")) getPercentage(_Style.Current.Width, tmpf, elm.getAttribute("width").c_str());
_Style.Current.GlobalColor = true; if (elm.hasNonEmptyAttribute("height"))
getPercentage(_Style.Current.Height, tmpf, elm.getAttribute("height").c_str());
// Tooltip // Get the global color name
// keep "alt" attribute for backward compatibility if (elm.hasAttribute("global_color"))
std::string strtooltip = elm.getAttribute("alt"); _Style.Current.GlobalColor = true;
// tooltip
if (elm.hasNonEmptyAttribute("title"))
strtooltip = elm.getAttribute("title");
const char *tooltip = NULL; // Tooltip
// note: uses pointer to string data // keep "alt" attribute for backward compatibility
if (!strtooltip.empty()) std::string strtooltip = elm.getAttribute("alt");
tooltip = strtooltip.c_str(); // tooltip
if (elm.hasNonEmptyAttribute("title"))
strtooltip = elm.getAttribute("title");
// Mouse over image const char *tooltip = NULL;
string overSrc = elm.getAttribute("data-over-src"); // note: uses pointer to string data
if (!strtooltip.empty())
tooltip = strtooltip.c_str();
if (getA() && getParent () && getParent ()->getParent()) // Mouse over image
{ string overSrc = elm.getAttribute("data-over-src");
string params = "name=" + getId() + "|url=" + getLink ();
addButton(CCtrlButton::PushButton, id, src, src, overSrc, "browse", params.c_str(), tooltip, _Style.Current);
}
else
if (tooltip || !overSrc.empty())
{
addButton(CCtrlButton::PushButton, id, src, src, overSrc, "", "", tooltip, _Style.Current);
}
else
{
// Get the option to reload (class==reload)
bool reloadImg = false;
if (elm.hasNonEmptyAttribute("style")) if (getA() && getParent () && getParent ()->getParent())
{ {
string styleString = elm.getAttribute("style"); string params = "name=" + getId() + "|url=" + getLink ();
TStyle styles = parseStyle(styleString); addButton(CCtrlButton::PushButton, id, src, src, overSrc, "browse", params.c_str(), tooltip, _Style.Current);
TStyle::iterator it; }
else
if (tooltip || !overSrc.empty())
{
addButton(CCtrlButton::PushButton, id, src, src, overSrc, "", "", tooltip, _Style.Current);
}
else
{
// Get the option to reload (class==reload)
bool reloadImg = false;
it = styles.find("reload"); if (elm.hasNonEmptyAttribute("style"))
if (it != styles.end() && (*it).second == "1") {
reloadImg = true; string styleString = elm.getAttribute("style");
} TStyle styles = parseStyle(styleString);
TStyle::iterator it;
addImage(id, elm.getAttribute("src"), reloadImg, _Style.Current); it = styles.find("reload");
if (it != styles.end() && (*it).second == "1")
reloadImg = true;
} }
addImage(id, elm.getAttribute("src"), reloadImg, _Style.Current);
} }
} }
@ -5619,220 +5621,223 @@ namespace NLGUI
// Widget minimal width // Widget minimal width
string minWidth = elm.getAttribute("z_input_width"); string minWidth = elm.getAttribute("z_input_width");
// Get the type // <input type="...">
if (elm.hasNonEmptyAttribute("type")) std::string type = trim(elm.getAttribute("type"));
if (type.empty())
{ {
// Global color flag // no 'type' attribute, or empty
if (elm.hasAttribute("global_color")) return;
_Style.Current.GlobalColor = true; }
// Global color flag
if (elm.hasAttribute("global_color"))
_Style.Current.GlobalColor = true;
// Tooltip // Tooltip
std::string strtooltip = elm.getAttribute("alt"); std::string strtooltip = elm.getAttribute("alt");
const char *tooltip = NULL; const char *tooltip = NULL;
// note: uses pointer to strtooltip data // note: uses pointer to strtooltip data
if (!strtooltip.empty()) if (!strtooltip.empty())
tooltip = strtooltip.c_str(); tooltip = strtooltip.c_str();
string type = toLower(elm.getAttribute("type")); if (type == "image")
if (type == "image") {
{ // The submit button
// The submit button string name = elm.getAttribute("name");
string name = elm.getAttribute("name"); string normal = elm.getAttribute("src");
string normal = elm.getAttribute("src"); string pushed;
string pushed; string over;
string over;
// Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" // 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"; string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name + "|submit_button_type=image";
// Add the ctrl button // Add the ctrl button
addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over, addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over,
"html_submit_form", param.c_str(), tooltip, _Style.Current); "html_submit_form", param.c_str(), tooltip, _Style.Current);
} }
else if (type == "button" || type == "submit") 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())
{ {
// The submit button // escape AH param separator
string name = elm.getAttribute("name"); string tmp = text;
string normal = elm.getAttribute("src"); while(NLMISC::strFindReplace(tmp, "|", "&#124;"))
string text = elm.getAttribute("value"); ;
string pushed; param = param + "|submit_button_value=" + tmp;
string over; }
string buttonTemplate(!templateName.empty() ? templateName : DefaultButtonGroup ); // Add the ctrl button
if (!_Paragraph)
{
newParagraph (0);
paragraphChange ();
}
// Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" typedef pair<string, string> TTmplParam;
string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name + "|submit_button_type=submit"; vector<TTmplParam> tmplParams;
if (!text.empty()) tmplParams.push_back(TTmplParam("id", name));
{ tmplParams.push_back(TTmplParam("onclick", "html_submit_form"));
// escape AH param separator tmplParams.push_back(TTmplParam("onclick_param", param));
string tmp = text; //tmplParams.push_back(TTmplParam("text", text));
while(NLMISC::strFindReplace(tmp, "|", "&#124;")) tmplParams.push_back(TTmplParam("active", "true"));
; if (!minWidth.empty())
param = param + "|submit_button_value=" + tmp; tmplParams.push_back(TTmplParam("wmin", minWidth));
} CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(buttonTemplate, _Paragraph->getId(), tmplParams);
if (buttonGroup)
{
// Add the ctrl button // Add the ctrl button
if (!_Paragraph) CCtrlTextButton *ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("button"));
{ if (!ctrlButton) ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("b"));
newParagraph (0); if (ctrlButton)
paragraphChange ();
}
typedef pair<string, string> TTmplParam;
vector<TTmplParam> 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)
{ {
ctrlButton->setModulateGlobalColorAll (_Style.Current.GlobalColor);
// Add the ctrl button // Translate the tooltip
CCtrlTextButton *ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("button")); if (tooltip)
if (!ctrlButton) ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("b"));
if (ctrlButton)
{ {
ctrlButton->setModulateGlobalColorAll (_Style.Current.GlobalColor); if (CI18N::hasTranslation(tooltip))
// Translate the tooltip
if (tooltip)
{ {
if (CI18N::hasTranslation(tooltip)) ctrlButton->setDefaultContextHelp(CI18N::get(tooltip));
{ }
ctrlButton->setDefaultContextHelp(CI18N::get(tooltip)); else
} {
else ctrlButton->setDefaultContextHelp(ucstring(tooltip));
{
ctrlButton->setDefaultContextHelp(ucstring(tooltip));
}
} }
}
ctrlButton->setText(ucstring::makeFromUtf8(text)); ctrlButton->setText(ucstring::makeFromUtf8(text));
setTextButtonStyle(ctrlButton, _Style.Current); setTextButtonStyle(ctrlButton, _Style.Current);
}
getParagraph()->addChild (buttonGroup);
paragraphChange ();
} }
getParagraph()->addChild (buttonGroup);
paragraphChange ();
} }
else if (type == "text") }
{ else if (type == "text")
// Get the string name {
string name = elm.getAttribute("name"); // Get the string name
ucstring ucValue; string name = elm.getAttribute("name");
ucValue.fromUtf8(elm.getAttribute("value")); ucstring ucValue;
ucValue.fromUtf8(elm.getAttribute("value"));
uint size = 120;
uint maxlength = 1024;
if (elm.hasNonEmptyAttribute("size"))
fromString(elm.getAttribute("size"), size);
if (elm.hasNonEmptyAttribute("maxlength"))
fromString(elm.getAttribute("maxlength"), maxlength);
uint size = 120; string textTemplate(!templateName.empty() ? templateName : DefaultFormTextGroup);
uint maxlength = 1024; // Add the editbox
if (elm.hasNonEmptyAttribute("size")) CInterfaceGroup *textArea = addTextArea (textTemplate, name.c_str (), 1, size/12, false, ucValue, maxlength);
fromString(elm.getAttribute("size"), size); if (textArea)
if (elm.hasNonEmptyAttribute("maxlength"))
fromString(elm.getAttribute("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")
{ {
renderPseudoElement(":before", elm); // 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")
{
renderPseudoElement(":before", elm);
CCtrlButton::EType btnType; CCtrlButton::EType btnType;
string name = elm.getAttribute("name"); string name = elm.getAttribute("name");
string normal = elm.getAttribute("src"); string normal = elm.getAttribute("src");
string pushed; string pushed;
string over; string over;
ucstring ucValue = ucstring("on"); ucstring ucValue = ucstring("on");
bool checked = elm.hasAttribute("checked"); bool checked = elm.hasAttribute("checked");
// TODO: unknown if empty attribute should override or not // TODO: unknown if empty attribute should override or not
if (elm.hasNonEmptyAttribute("value")) if (elm.hasNonEmptyAttribute("value"))
ucValue.fromUtf8(elm.getAttribute("value")); ucValue.fromUtf8(elm.getAttribute("value"));
if (type == "radio") if (type == "radio")
{ {
btnType = CCtrlButton::RadioButton; btnType = CCtrlButton::RadioButton;
normal = DefaultRadioButtonBitmapNormal; normal = DefaultRadioButtonBitmapNormal;
pushed = DefaultRadioButtonBitmapPushed; pushed = DefaultRadioButtonBitmapPushed;
over = DefaultRadioButtonBitmapOver; over = DefaultRadioButtonBitmapOver;
} }
else else
{ {
btnType = CCtrlButton::ToggleButton; btnType = CCtrlButton::ToggleButton;
normal = DefaultCheckBoxBitmapNormal; normal = DefaultCheckBoxBitmapNormal;
pushed = DefaultCheckBoxBitmapPushed; pushed = DefaultCheckBoxBitmapPushed;
over = DefaultCheckBoxBitmapOver; over = DefaultCheckBoxBitmapOver;
} }
// Add the ctrl button // Add the ctrl button
CCtrlButton *checkbox = addButton (btnType, name, normal, pushed, over, "", "", tooltip, _Style.Current); CCtrlButton *checkbox = addButton (btnType, name, normal, pushed, over, "", "", tooltip, _Style.Current);
if (checkbox) if (checkbox)
{
if (btnType == CCtrlButton::RadioButton)
{ {
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; i<form.Entries.size(); i++)
{ {
// override with 'id' because radio buttons share same name if (form.Entries[i].Name == name && form.Entries[i].Checkbox->getType() == CCtrlButton::RadioButton)
if (!id.empty())
checkbox->setId(id);
// group together buttons with same name
CForm &form = _Forms.back();
bool notfound = true;
for (uint i=0; i<form.Entries.size(); i++)
{
if (form.Entries[i].Name == name && form.Entries[i].Checkbox->getType() == 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(form.Entries[i].Checkbox);
checkbox->initRBRefFromRadioButton(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 // Add the button to the form
CGroupHTML::CForm::CEntry entry; CGroupHTML::CForm::CEntry entry;
entry.Name = name; entry.Name = name;
entry.Value = decodeHTMLEntities(ucValue); entry.Value = decodeHTMLEntities(ucValue);
entry.Checkbox = checkbox; entry.Checkbox = checkbox;
_Forms.back().Entries.push_back (entry); _Forms.back().Entries.push_back (entry);
}
renderPseudoElement(":after", elm);
} }
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 name
string name = elm.getAttribute("name"); // Get the value
ucstring ucValue;
// Get the value ucValue.fromUtf8(elm.getAttribute("value"));
ucstring ucValue;
ucValue.fromUtf8(elm.getAttribute("value")); // Add an entry
CGroupHTML::CForm::CEntry entry;
// Add an entry entry.Name = name;
CGroupHTML::CForm::CEntry entry; entry.Value = decodeHTMLEntities(ucValue);
entry.Name = name; _Forms.back().Entries.push_back (entry);
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 httpEquiv = elm.getAttribute("http-equiv");
std::string httpContent = elm.getAttribute("content"); std::string httpContent = elm.getAttribute("content");
if (!httpEquiv.empty() && !httpContent.empty()) if (httpEquiv.empty() || httpContent.empty())
{ {
// only first http-equiv="refresh" should be handled return;
if (_RefreshUrl.empty() && httpEquiv == "refresh") }
{
const CWidgetManager::SInterfaceTimes &times = CWidgetManager::getInstance()->getInterfaceTimes();
double timeSec = times.thisFrameMs / 1000.0f;
string::size_type pos = httpContent.find_first_of(";"); // only first http-equiv="refresh" should be handled
if (pos == string::npos) if (_RefreshUrl.empty() && httpEquiv == "refresh")
{ {
fromString(httpContent, _NextRefreshTime); const CWidgetManager::SInterfaceTimes &times = CWidgetManager::getInstance()->getInterfaceTimes();
_RefreshUrl = _URL; double timeSec = times.thisFrameMs / 1000.0f;
}
else
{
fromString(httpContent.substr(0, pos), _NextRefreshTime);
pos = toLower(httpContent).find("url="); string::size_type pos = httpContent.find_first_of(";");
if (pos != string::npos) if (pos == string::npos)
_RefreshUrl = getAbsoluteUrl(httpContent.substr(pos + 4)); {
} 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(); CGroupTable *table = getTable();
if (table) if (!table)
{ {
if (_Style.hasStyle("padding")) // <td> appears to be outside <table>
{ return;
uint32 a; }
// TODO: cssLength
if (fromString(_Style.getStyle("padding"), a))
table->CellPadding = a;
}
if (!_Cells.empty()) if (_Cells.empty())
{ {
_Cells.back() = new CGroupCell(CViewBase::TCtorParam()); // <table> not started
return;
}
if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat")) if (_Style.hasStyle("padding"))
_Cells.back()->setTextureTile(true); {
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() = new CGroupCell(CViewBase::TCtorParam());
_Cells.back()->setTextureScale(true);
if (_Style.hasStyle("background-image")) if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat"))
{ _Cells.back()->setTextureTile(true);
string image = _Style.getStyle("background-image");
string::size_type texExt = toLower(image).find("url("); if (_Style.checkStyle("background-scale", "1") || _Style.checkStyle("background-size", "cover"))
// Url image _Cells.back()->setTextureScale(true);
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 (elm.hasNonEmptyAttribute("colspan")) if (_Style.hasStyle("background-image"))
fromString(elm.getAttribute("colspan"), _Cells.back()->ColSpan); {
if (elm.hasNonEmptyAttribute("rowspan")) string image = _Style.getStyle("background-image");
fromString(elm.getAttribute("rowspan"), _Cells.back()->RowSpan);
string::size_type texExt = toLower(image).find("url(");
_Cells.back()->BgColor = _CellParams.back().BgColor; // Url image
_Cells.back()->Align = _CellParams.back().Align; if (texExt != string::npos)
_Cells.back()->VAlign = _CellParams.back().VAlign; {
_Cells.back()->LeftMargin = _CellParams.back().LeftMargin; // Remove url()
_Cells.back()->NoWrap = _CellParams.back().NoWrap; image = image.substr(4, image.size()-5);
_Cells.back()->ColSpan = std::max(1, _Cells.back()->ColSpan); addImageDownload(image, _Cells.back());
_Cells.back()->RowSpan = std::max(1, _Cells.back()->RowSpan); // Image in BNP
}
float temp; else
if (_Style.hasStyle("width")) {
getPercentage (_Cells.back()->WidthWanted, _Cells.back()->TableRatio, _Style.getStyle("width").c_str()); _Cells.back()->setTexture(image);
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());
_Cells.back()->NewLine = getTR(); if (elm.hasNonEmptyAttribute("colspan"))
table->addChild (_Cells.back()); fromString(elm.getAttribute("colspan"), _Cells.back()->ColSpan);
if (elm.hasNonEmptyAttribute("rowspan"))
fromString(elm.getAttribute("rowspan"), _Cells.back()->RowSpan);
// reusing indent pushed by table _Cells.back()->BgColor = _CellParams.back().BgColor;
_Indent.back() = 0; _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); float temp;
// indent is already 0, getParagraph()->setMarginLeft(0); // maybe setIndent(0) if LI is using one 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 _Cells.back()->NewLine = getTR();
if (!_TR.empty()) table->addChild (_Cells.back());
_TR.back() = false;
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) void CGroupHTML::htmlTDend(const CHtmlElement &elm)
@ -6391,43 +6404,38 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CGroupHTML::htmlTEXTAREA(const CHtmlElement &elm) void CGroupHTML::htmlTEXTAREA(const CHtmlElement &elm)
{ {
_PRE.push_back(true); if (_Forms.empty())
return;
// Got one form ?
if (!(_Forms.empty()))
{
// read general property
string templateName;
// Widget template name // read general property
if (elm.hasNonEmptyAttribute("z_input_tmpl")) string templateName;
templateName = elm.getAttribute("z_input_tmpl");
// Get the string name // Widget template name
_TextAreaName.clear(); if (elm.hasNonEmptyAttribute("z_input_tmpl"))
_TextAreaRow = 1; templateName = elm.getAttribute("z_input_tmpl");
_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; // Get the string name
_TextArea = true; _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) void CGroupHTML::htmlTEXTAREAend(const CHtmlElement &elm)
{ {
_TextArea = false;
popIfNotEmpty (_PRE);
if (_Forms.empty()) if (_Forms.empty())
return; return;
@ -6440,6 +6448,9 @@ namespace NLGUI
entry.TextArea = textArea; entry.TextArea = textArea;
_Forms.back().Entries.push_back (entry); _Forms.back().Entries.push_back (entry);
} }
_TextArea = false;
popIfNotEmpty (_PRE);
} }
// *************************************************************************** // ***************************************************************************

Loading…
Cancel
Save