1
0

Remove unused attribute saving and loading (#86)

This commit is contained in:
ROllerozxa
2021-12-29 23:00:56 +01:00
committed by GitHub
parent dd09fdcb4e
commit 52e03a8485
72 changed files with 21 additions and 6512 deletions

View File

@@ -1135,160 +1135,6 @@ bool CGUITable::isDrawBackgroundEnabled() const
return DrawBack;
}
//! Writes attributes of the element.
void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IGUITable::serializeAttributes(out, options);
out->addInt("ColumnCount", Columns.size());
u32 i;
for (i=0;i<Columns.size(); ++i)
{
core::stringc label;
label = "Column"; label += i; label += "name";
out->addString(label.c_str(), Columns[i].Name.c_str() );
label = "Column"; label += i; label += "width";
out->addInt(label.c_str(), Columns[i].Width );
label = "Column"; label += i; label += "OrderingMode";
out->addEnum(label.c_str(), Columns[i].OrderingMode, GUIColumnOrderingNames);
}
out->addInt("RowCount", Rows.size());
for (i=0;i<Rows.size(); ++i)
{
core::stringc label;
// Height currently not used and could be recalculated anyway
//label = "Row"; label += i; label += "height";
//out->addInt(label.c_str(), Rows[i].Height );
//label = "Row"; label += i; label += "ItemCount";
//out->addInt(label.c_str(), Rows[i].Items.size());
u32 c;
for ( c=0; c < Rows[i].Items.size(); ++c )
{
label = "Row"; label += i; label += "cell"; label += c; label += "text";
out->addString(label.c_str(), Rows[i].Items[c].Text.c_str() );
// core::stringw BrokenText; // can be recalculated
label = "Row"; label += i; label += "cell"; label += c; label += "color";
out->addColor(label.c_str(), Rows[i].Items[c].Color );
label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor";
out->addColor(label.c_str(), Rows[i].Items[c].IsOverrideColor );
// void *data; // can't be serialized
}
}
// s32 ItemHeight; // can be calculated
// TotalItemHeight // calculated
// TotalItemWidth // calculated
// gui::IGUIFont* ActiveFont; // TODO: we don't have a sane font-serialization so far
// gui::IGUIScrollBar* VerticalScrollBar; // not serialized
// gui::IGUIScrollBar* HorizontalScrollBar; // not serialized
out->addBool ("Clip", Clip);
out->addBool ("DrawBack", DrawBack);
out->addBool ("MoveOverSelect", MoveOverSelect);
// s32 CurrentResizedColumn; // runtime info - depends on user action
out->addBool ("ResizableColumns", ResizableColumns);
// s32 Selected; // runtime info - depends on user action
out->addInt("CellWidthPadding", CellWidthPadding );
out->addInt("CellHeightPadding", CellHeightPadding );
// s32 ActiveTab; // runtime info - depends on user action
// bool Selecting; // runtime info - depends on user action
out->addEnum("CurrentOrdering", CurrentOrdering, GUIOrderingModeNames);
out->addInt("DrawFlags", DrawFlags);
}
//! Reads attributes of the element
void CGUITable::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
IGUITable::deserializeAttributes(in, options);
Columns.clear();
u32 columnCount = in->getAttributeAsInt("ColumnCount");
u32 i;
for (i=0;i<columnCount; ++i)
{
core::stringc label;
Column column;
label = "Column"; label += i; label += "name";
column.Name = core::stringw(in->getAttributeAsString(label.c_str()).c_str());
label = "Column"; label += i; label += "width";
column.Width = in->getAttributeAsInt(label.c_str());
label = "Column"; label += i; label += "OrderingMode";
column.OrderingMode = EGCO_NONE;
s32 co = in->getAttributeAsEnumeration(label.c_str(), GUIColumnOrderingNames);
if (co > 0)
column.OrderingMode = EGUI_COLUMN_ORDERING(co);
Columns.push_back(column);
}
Rows.clear();
u32 rowCount = in->getAttributeAsInt("RowCount");
for (i=0; i<rowCount; ++i)
{
core::stringc label;
Row row;
// Height currently not used and could be recalculated anyway
//label = "Row"; label += i; label += "height";
//row.Height = in->getAttributeAsInt(label.c_str() );
Rows.push_back(row);
//label = "Row"; label += i; label += "ItemCount";
//u32 itemCount = in->getAttributeAsInt(label.c_str());
u32 c;
for ( c=0; c < columnCount; ++c )
{
Cell cell;
label = "Row"; label += i; label += "cell"; label += c; label += "text";
cell.Text = core::stringw(in->getAttributeAsString(label.c_str()).c_str());
breakText( cell.Text, cell.BrokenText, Columns[c].Width );
label = "Row"; label += i; label += "cell"; label += c; label += "color";
cell.Color = in->getAttributeAsColor(label.c_str());
label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor";
cell.IsOverrideColor = in->getAttributeAsBool(label.c_str());
cell.Data = NULL;
Rows[Rows.size()-1].Items.push_back(cell);
}
}
ItemHeight = 0; // calculated
TotalItemHeight = 0; // calculated
TotalItemWidth = 0; // calculated
Clip = in->getAttributeAsBool("Clip", Clip);
DrawBack = in->getAttributeAsBool("DrawBack", DrawBack);
MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect);
CurrentResizedColumn = -1;
ResizeStart = 0;
ResizableColumns = in->getAttributeAsBool("ResizableColumns", ResizableColumns);
Selected = -1;
CellWidthPadding = in->getAttributeAsInt("CellWidthPadding", CellWidthPadding);
CellHeightPadding = in->getAttributeAsInt("CellHeightPadding", CellHeightPadding);
ActiveTab = -1;
Selecting = false;
CurrentOrdering = (EGUI_ORDERING_MODE) in->getAttributeAsEnumeration("CurrentOrdering", GUIOrderingModeNames, (s32)CurrentOrdering);
DrawFlags = in->getAttributeAsInt("DrawFlags", DrawFlags);
refreshControls();
}
} // end namespace gui
} // end namespace irr