CHANGED: #1471 CDBViewBar3 fields can now be serialized.

--HG--
branch : gsoc2012-gui-editor
This commit is contained in:
dfighter1985 2012-08-12 03:43:31 +02:00
parent 7d72abed71
commit eb7e805fa5
2 changed files with 33 additions and 0 deletions

View file

@ -40,6 +40,7 @@ namespace NLGUI
std::string getProperty( const std::string &name ) const; std::string getProperty( const std::string &name ) const;
void setProperty( const std::string &name, const std::string &value ); void setProperty( const std::string &name, const std::string &value );
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup); bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup);
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
virtual void updateCoords (); virtual void updateCoords ();

View file

@ -237,6 +237,38 @@ namespace NLGUI
} }
xmlNodePtr CDBViewBar3::serialize( xmlNodePtr parentNode, const char *type ) const
{
xmlNodePtr node = CViewBitmap::serialize( parentNode, type );
if( node == NULL )
return NULL;
xmlSetProp( node, BAD_CAST "type", BAD_CAST "bar3" );
xmlSetProp( node, BAD_CAST "value1", BAD_CAST getValProp( _Value[ 0 ], _ValueInt[ 0 ] ).c_str() );
xmlSetProp( node, BAD_CAST "value2", BAD_CAST getValProp( _Value[ 1 ], _ValueInt[ 1 ] ).c_str() );
xmlSetProp( node, BAD_CAST "value3", BAD_CAST getValProp( _Value[ 2 ], _ValueInt[ 2 ] ).c_str() );
xmlSetProp( node, BAD_CAST "range1", BAD_CAST getValProp( _Range[ 0 ], _RangeInt[ 0 ] ).c_str() );
xmlSetProp( node, BAD_CAST "range2", BAD_CAST getValProp( _Range[ 1 ], _RangeInt[ 1 ] ).c_str() );
xmlSetProp( node, BAD_CAST "range3", BAD_CAST getValProp( _Range[ 2 ], _RangeInt[ 2 ] ).c_str() );
xmlSetProp( node, BAD_CAST "color1", BAD_CAST toString( _Colors[ 0 ] ).c_str() );
xmlSetProp( node, BAD_CAST "color2", BAD_CAST toString( _Colors[ 1 ] ).c_str() );
xmlSetProp( node, BAD_CAST "color3", BAD_CAST toString( _Colors[ 2 ] ).c_str() );
xmlSetProp( node, BAD_CAST "color1_negative", BAD_CAST toString( _ColorsNegative[ 0 ] ).c_str() );
xmlSetProp( node, BAD_CAST "color2_negative", BAD_CAST toString( _ColorsNegative[ 1 ] ).c_str() );
xmlSetProp( node, BAD_CAST "color3_negative", BAD_CAST toString( _ColorsNegative[ 2 ] ).c_str() );
if( _Mini )
xmlSetProp( node, BAD_CAST "mini", BAD_CAST "true" );
else
xmlSetProp( node, BAD_CAST "mini", BAD_CAST "false" );
return node;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CDBViewBar3::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) bool CDBViewBar3::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{ {