From 341d8c355482ea84119bfb05c62d22ba92d2c97c Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 12 Aug 2012 03:20:03 +0200 Subject: [PATCH] CHANGED: #1471 CViewBitmap fields can now be serialized. --- code/nel/include/nel/gui/view_bitmap.h | 1 + code/nel/src/gui/view_bitmap.cpp | 36 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/code/nel/include/nel/gui/view_bitmap.h b/code/nel/include/nel/gui/view_bitmap.h index e2243e714..3378ae379 100644 --- a/code/nel/include/nel/gui/view_bitmap.h +++ b/code/nel/include/nel/gui/view_bitmap.h @@ -60,6 +60,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; /** * parse an xml node and initialize the base view mambers. Must call CViewBase::parse diff --git a/code/nel/src/gui/view_bitmap.cpp b/code/nel/src/gui/view_bitmap.cpp index 43d078df2..742150ead 100644 --- a/code/nel/src/gui/view_bitmap.cpp +++ b/code/nel/src/gui/view_bitmap.cpp @@ -230,6 +230,42 @@ namespace NLGUI CViewBase::setProperty( name, value ); } + + xmlNodePtr CViewBitmap::serialize( xmlNodePtr parentNode, const char *type ) const + { + xmlNodePtr node = CViewBase::serialize( parentNode, type ); + if( node == NULL ) + return NULL; + + xmlSetProp( node, BAD_CAST "type", BAD_CAST "bitmap" ); + xmlSetProp( node, BAD_CAST "color", BAD_CAST toString( _Color ).c_str() ); + xmlSetProp( node, BAD_CAST "txtoffsetx", BAD_CAST toString( _TxtOffsetX ).c_str() ); + xmlSetProp( node, BAD_CAST "txtoffsety", BAD_CAST toString( _TxtOffsetY ).c_str() ); + xmlSetProp( node, BAD_CAST "txtwidth", BAD_CAST toString( _TxtWidth ).c_str() ); + xmlSetProp( node, BAD_CAST "txtheight", BAD_CAST toString( _TxtHeight ).c_str() ); + xmlSetProp( node, BAD_CAST "texture", BAD_CAST getTexture().c_str() ); + xmlSetProp( node, BAD_CAST "scale", BAD_CAST toString( _Scale ).c_str() ); + xmlSetProp( node, BAD_CAST "rot", BAD_CAST toString( _Rot ).c_str() ); + xmlSetProp( node, BAD_CAST "flip", BAD_CAST toString( _Flip ).c_str() ); + xmlSetProp( node, BAD_CAST "tile", BAD_CAST toString( _Tile ).c_str() ); + xmlSetProp( node, BAD_CAST "inherit_gc_alpha", BAD_CAST toString( _InheritGCAlpha ).c_str() ); + + std::string align; + if( ( _Align & 1 ) != 0 ) + align += "R"; + else + align += "L"; + + if( ( _Align & 2 ) != 0 ) + align += "T"; + else + align += "B"; + + xmlSetProp( node, BAD_CAST "txtoffsetx", BAD_CAST align.c_str() ); + + return node; + } + // ---------------------------------------------------------------------------- bool CViewBitmap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)