From a3de7ec1b9ef36c607b2cdea578a53baaf3e975d Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 11 Aug 2012 19:56:30 +0200 Subject: [PATCH] CHANGED: #1471 CViewDigit fields can now be serialized. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/dbview_digit.h | 2 ++ code/nel/src/gui/dbview_digit.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/code/nel/include/nel/gui/dbview_digit.h b/code/nel/include/nel/gui/dbview_digit.h index 14adf2cba..a587a4524 100644 --- a/code/nel/include/nel/gui/dbview_digit.h +++ b/code/nel/include/nel/gui/dbview_digit.h @@ -40,6 +40,8 @@ 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; + virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual void draw (); virtual void updateCoords(); diff --git a/code/nel/src/gui/dbview_digit.cpp b/code/nel/src/gui/dbview_digit.cpp index e511d5953..f4045cbd4 100644 --- a/code/nel/src/gui/dbview_digit.cpp +++ b/code/nel/src/gui/dbview_digit.cpp @@ -103,6 +103,28 @@ namespace NLGUI } + xmlNodePtr CDBViewDigit::serialize( xmlNodePtr parentNode, const char *type ) const + { + xmlNodePtr node = CViewBase::serialize( parentNode, type ); + if( node == NULL ) + return NULL; + + if( xmlGetProp( node, BAD_CAST "type" ) == NULL ) + xmlSetProp( node, BAD_CAST "type", BAD_CAST "digit" ); + + if( _Number.getNodePtr() != NULL ) + xmlSetProp( node, BAD_CAST "value", BAD_CAST _Number.getNodePtr()->getFullName().c_str() ); + else + xmlSetProp( node, BAD_CAST "value", BAD_CAST "" ); + + xmlSetProp( node, BAD_CAST "numdigit", BAD_CAST toString( _NumDigit ).c_str() ); + xmlSetProp( node, BAD_CAST "wspace", BAD_CAST toString( _WSpace ).c_str() ); + xmlSetProp( node, BAD_CAST "color", BAD_CAST toString( _Color ).c_str() ); + + return node; + } + + // *************************************************************************** bool CDBViewDigit::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) {