From db38ac9e8f2b20c1d3d5441d9e8c7f083d00e054 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 12 Aug 2012 03:36:44 +0200 Subject: [PATCH] CHANGED: #1471 CDBViewBar fields can now be serialized. --- code/nel/include/nel/gui/dbview_bar.h | 1 + code/nel/src/gui/dbview_bar.cpp | 44 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/code/nel/include/nel/gui/dbview_bar.h b/code/nel/include/nel/gui/dbview_bar.h index f905453c9..b1232f06d 100644 --- a/code/nel/include/nel/gui/dbview_bar.h +++ b/code/nel/include/nel/gui/dbview_bar.h @@ -54,6 +54,7 @@ namespace NLGUI std::string getProperty( const std::string &name ) const; void setProperty( const std::string &name, const std::string &value ); + xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup); virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } virtual void updateCoords (); diff --git a/code/nel/src/gui/dbview_bar.cpp b/code/nel/src/gui/dbview_bar.cpp index 36999f5dd..79317a31f 100644 --- a/code/nel/src/gui/dbview_bar.cpp +++ b/code/nel/src/gui/dbview_bar.cpp @@ -171,6 +171,50 @@ namespace NLGUI CViewBitmap::setProperty( name, value ); } + + xmlNodePtr CDBViewBar::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 "bar" ); + + if( _Value.getNodePtr() != NULL ) + xmlSetProp( node, BAD_CAST "value", BAD_CAST _Value.getNodePtr()->getFullName().c_str() ); + else + xmlSetProp( node, BAD_CAST "value", BAD_CAST toString( _RangeInt ).c_str() ); + + if( _Range.getNodePtr() != NULL ) + xmlSetProp( node, BAD_CAST "range", BAD_CAST _Range.getNodePtr()->getFullName().c_str() ); + else + xmlSetProp( node, BAD_CAST "range", BAD_CAST toString( _RangeInt ).c_str() ); + + if( _Reference.getNodePtr() != NULL ) + xmlSetProp( node, BAD_CAST "reference", BAD_CAST _Reference.getNodePtr()->getFullName().c_str() ); + else + xmlSetProp( node, BAD_CAST "reference", BAD_CAST toString( _ReferenceInt ).c_str() ); + + xmlSetProp( node, BAD_CAST "color_negative", BAD_CAST toString( _ColorNegative ).c_str() ); + + if( _Type == ViewBar_Mini ) + xmlSetProp( node, BAD_CAST "mini", BAD_CAST "true" ); + else + xmlSetProp( node, BAD_CAST "mini", BAD_CAST "false" ); + + if( _Type == ViewBar_UltraMini ) + xmlSetProp( node, BAD_CAST "ultra_mini", BAD_CAST "true" ); + else + xmlSetProp( node, BAD_CAST "ultra_mini", BAD_CAST "false" ); + + if( _Type == ViewBar_MiniThick ) + xmlSetProp( node, BAD_CAST "mini_thick", BAD_CAST "true" ); + else + xmlSetProp( node, BAD_CAST "mini_thick", BAD_CAST "false" ); + + return node; + } + // ---------------------------------------------------------------------------- bool CDBViewBar::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) {