Fix Name List xml processing (and typing into them to +find names!)
LLNameListCtrl::fromXML was ancient, and LLScrollListCtrl::fromXML had been getting updated but that processing should be done in a common virtual function so we have a valid hierarchy! This fixes that! Now all of the modern amenities added to scroll lists are in name lists.
This commit is contained in:
@@ -2712,20 +2712,14 @@ void LLScrollListCtrl::setScrollListParameters(LLXMLNodePtr node)
|
||||
node->getAttributeString("menu_file", menu);
|
||||
if (!menu.empty()) setContextMenu(menu);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
|
||||
{
|
||||
LLRect rect;
|
||||
createRect(node, rect, parent, LLRect());
|
||||
if (node->hasAttribute("heading_height"))
|
||||
{
|
||||
S32 heading_height;
|
||||
node->getAttributeS32("heading_height", heading_height);
|
||||
setHeadingHeight(heading_height);
|
||||
}
|
||||
|
||||
BOOL multi_select = false;
|
||||
node->getAttributeBOOL("multi_select", multi_select);
|
||||
BOOL draw_border = true;
|
||||
node->getAttributeBOOL("draw_border", draw_border);
|
||||
BOOL draw_heading = false;
|
||||
node->getAttributeBOOL("draw_heading", draw_heading);
|
||||
S32 search_column = 0;
|
||||
node->getAttributeS32("search_column", search_column);
|
||||
S32 sort_column = -1;
|
||||
@@ -2733,18 +2727,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
|
||||
BOOL sort_ascending = true;
|
||||
node->getAttributeBOOL("sort_ascending", sort_ascending);
|
||||
|
||||
LLScrollListCtrl* scroll_list = new LLScrollListCtrl("scroll_list", rect, NULL, multi_select, draw_border, draw_heading);
|
||||
|
||||
if (node->hasAttribute("heading_height"))
|
||||
{
|
||||
S32 heading_height;
|
||||
node->getAttributeS32("heading_height", heading_height);
|
||||
scroll_list->setHeadingHeight(heading_height);
|
||||
}
|
||||
|
||||
scroll_list->setScrollListParameters(node);
|
||||
scroll_list->initFromXML(node, parent);
|
||||
scroll_list->setSearchColumn(search_column);
|
||||
setSearchColumn(search_column);
|
||||
|
||||
LLSD columns;
|
||||
S32 index = 0;
|
||||
@@ -2806,11 +2789,11 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
|
||||
++index;
|
||||
}
|
||||
}
|
||||
scroll_list->setColumnHeadings(columns);
|
||||
setColumnHeadings(columns);
|
||||
|
||||
if (sort_column >= 0)
|
||||
{
|
||||
scroll_list->sortByColumnIndex(sort_column, sort_ascending);
|
||||
sortByColumnIndex(sort_column, sort_ascending);
|
||||
}
|
||||
|
||||
const std::string kidrow(nodename + "row");
|
||||
@@ -2856,18 +2839,39 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
|
||||
}
|
||||
}
|
||||
if(explicit_column)
|
||||
scroll_list->addElement(row);
|
||||
addElement(row);
|
||||
else
|
||||
{
|
||||
LLSD entry_id;
|
||||
if(id_found)
|
||||
entry_id = id;
|
||||
scroll_list->addSimpleElement(value,ADD_BOTTOM,entry_id);
|
||||
addSimpleElement(value,ADD_BOTTOM,entry_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scroll_list->setCommentText(node->getTextContents());
|
||||
setCommentText(node->getTextContents());
|
||||
}
|
||||
|
||||
// static
|
||||
LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
|
||||
{
|
||||
LLRect rect;
|
||||
createRect(node, rect, parent, LLRect());
|
||||
|
||||
BOOL multi_select = false;
|
||||
node->getAttributeBOOL("multi_select", multi_select);
|
||||
|
||||
BOOL draw_border = true;
|
||||
node->getAttributeBOOL("draw_border", draw_border);
|
||||
|
||||
BOOL draw_heading = false;
|
||||
node->getAttributeBOOL("draw_heading", draw_heading);
|
||||
|
||||
LLScrollListCtrl* scroll_list = new LLScrollListCtrl("scroll_list", rect, NULL, multi_select, draw_border, draw_heading);
|
||||
|
||||
scroll_list->setScrollListParameters(node);
|
||||
scroll_list->initFromXML(node, parent);
|
||||
return scroll_list;
|
||||
}
|
||||
|
||||
|
||||
@@ -461,13 +461,13 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
|
||||
LLRect rect;
|
||||
createRect(node, rect, parent, LLRect());
|
||||
|
||||
BOOL multi_select = FALSE;
|
||||
BOOL multi_select = false;
|
||||
node->getAttributeBOOL("multi_select", multi_select);
|
||||
|
||||
BOOL draw_border = TRUE;
|
||||
BOOL draw_border = true;
|
||||
node->getAttributeBOOL("draw_border", draw_border);
|
||||
|
||||
BOOL draw_heading = FALSE;
|
||||
BOOL draw_heading = false;
|
||||
node->getAttributeBOOL("draw_heading", draw_heading);
|
||||
|
||||
S32 name_column_index = 0;
|
||||
@@ -494,108 +494,5 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
|
||||
|
||||
name_list->initFromXML(node, parent);
|
||||
|
||||
LLSD columns;
|
||||
S32 index = 0;
|
||||
LLXMLNodePtr child;
|
||||
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
|
||||
{
|
||||
if (child->hasName("column"))
|
||||
{
|
||||
std::string labelname("");
|
||||
child->getAttributeString("label", labelname);
|
||||
|
||||
std::string columnname(labelname);
|
||||
child->getAttributeString("name", columnname);
|
||||
|
||||
std::string sortname(columnname);
|
||||
child->getAttributeString("sort", sortname);
|
||||
|
||||
if (child->hasAttribute("relative_width"))
|
||||
{
|
||||
F32 columnrelwidth = 0.f;
|
||||
child->getAttributeF32("relative_width", columnrelwidth);
|
||||
columns[index]["relative_width"] = columnrelwidth;
|
||||
}
|
||||
else if (child->hasAttribute("relwidth"))
|
||||
{
|
||||
F32 columnrelwidth = 0.f;
|
||||
child->getAttributeF32("relwidth", columnrelwidth);
|
||||
columns[index]["relative_width"] = columnrelwidth;
|
||||
}
|
||||
else if (child->hasAttribute("dynamic_width"))
|
||||
{
|
||||
BOOL columndynamicwidth = FALSE;
|
||||
child->getAttributeBOOL("dynamic_width", columndynamicwidth);
|
||||
columns[index]["dynamic_width"] = columndynamicwidth;
|
||||
}
|
||||
else if (child->hasAttribute("dynamicwidth"))
|
||||
{
|
||||
BOOL columndynamicwidth = FALSE;
|
||||
child->getAttributeBOOL("dynamicwidth", columndynamicwidth);
|
||||
columns[index]["dynamic_width"] = columndynamicwidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
S32 columnwidth = -1;
|
||||
child->getAttributeS32("width", columnwidth);
|
||||
columns[index]["width"] = columnwidth;
|
||||
}
|
||||
|
||||
LLFontGL::HAlign h_align = LLFontGL::LEFT;
|
||||
h_align = LLView::selectFontHAlign(child);
|
||||
|
||||
columns[index]["name"] = columnname;
|
||||
columns[index]["label"] = labelname;
|
||||
columns[index]["halign"] = (S32)h_align;
|
||||
columns[index]["sort"] = sortname;
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
name_list->setColumnHeadings(columns);
|
||||
|
||||
|
||||
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
|
||||
{
|
||||
if (child->hasName("row"))
|
||||
{
|
||||
LLUUID id;
|
||||
child->getAttributeUUID("id", id);
|
||||
|
||||
LLSD row;
|
||||
|
||||
row["id"] = id;
|
||||
|
||||
S32 column_idx = 0;
|
||||
LLXMLNodePtr row_child;
|
||||
for (row_child = node->getFirstChild(); row_child.notNull(); row_child = row_child->getNextSibling())
|
||||
{
|
||||
if (row_child->hasName("column"))
|
||||
{
|
||||
std::string value = row_child->getTextContents();
|
||||
|
||||
std::string columnname("");
|
||||
row_child->getAttributeString("name", columnname);
|
||||
|
||||
std::string font("");
|
||||
row_child->getAttributeString("font", font);
|
||||
|
||||
std::string font_style("");
|
||||
row_child->getAttributeString("font-style", font_style);
|
||||
|
||||
row["columns"][column_idx]["column"] = columnname;
|
||||
row["columns"][column_idx]["value"] = value;
|
||||
row["columns"][column_idx]["font"] = font;
|
||||
row["columns"][column_idx]["font-style"] = font_style;
|
||||
column_idx++;
|
||||
}
|
||||
}
|
||||
name_list->addElement(row);
|
||||
}
|
||||
}
|
||||
|
||||
std::string contents = node->getTextContents();
|
||||
name_list->setCommentText(contents);
|
||||
|
||||
return name_list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user