From 0aff44286488bd5fa4f8ac69e868c4c17b60a468 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 12 Aug 2012 03:43:31 +0200 Subject: [PATCH] CHANGED: #1471 CDBViewBar3 fields can now be serialized. --- code/nel/include/nel/gui/dbview_bar3.h | 1 + code/nel/src/gui/dbview_bar3.cpp | 32 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/code/nel/include/nel/gui/dbview_bar3.h b/code/nel/include/nel/gui/dbview_bar3.h index a8e3ff36f..ab984ae63 100644 --- a/code/nel/include/nel/gui/dbview_bar3.h +++ b/code/nel/include/nel/gui/dbview_bar3.h @@ -40,6 +40,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_bar3.cpp b/code/nel/src/gui/dbview_bar3.cpp index f6cd55772..f2034cf91 100644 --- a/code/nel/src/gui/dbview_bar3.cpp +++ b/code/nel/src/gui/dbview_bar3.cpp @@ -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) {