From caa024b0be490951db628a09753d61db5f6a2b70 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 18 Aug 2012 02:46:19 +0200 Subject: [PATCH] CHANGED: #1471 Serialize text options for Buttons with text too. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/view_text.h | 1 + code/nel/src/gui/ctrl_text_button.cpp | 3 +++ code/nel/src/gui/view_text.cpp | 21 +++++++++++++++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/code/nel/include/nel/gui/view_text.h b/code/nel/include/nel/gui/view_text.h index 86eb793ca..3625ef0e6 100644 --- a/code/nel/include/nel/gui/view_text.h +++ b/code/nel/include/nel/gui/view_text.h @@ -57,6 +57,7 @@ namespace NLGUI std::string getProperty( const std::string &name ) const; void setProperty( const std::string &name, const std::string &value ); bool setTextProperty( const std::string &name, const std::string &value ); + bool serializeTextOptions( xmlNodePtr node ) const; xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; void parseTextOptions (xmlNodePtr cur); bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); diff --git a/code/nel/src/gui/ctrl_text_button.cpp b/code/nel/src/gui/ctrl_text_button.cpp index 7143bd51f..27785248b 100644 --- a/code/nel/src/gui/ctrl_text_button.cpp +++ b/code/nel/src/gui/ctrl_text_button.cpp @@ -444,6 +444,9 @@ namespace NLGUI xmlNewProp( node, BAD_CAST "force_text_over", BAD_CAST toString( _ForceTextOver ).c_str() ); xmlNewProp( node, BAD_CAST "text_header_color", BAD_CAST toString( _TextHeaderColor ).c_str() ); + if( _ViewText != NULL ) + _ViewText->serializeTextOptions( node ); + return node; } diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 0b082262e..64a6ec51a 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -495,13 +495,8 @@ namespace NLGUI } - xmlNodePtr CViewText::serialize( xmlNodePtr parentNode, const char *type ) const + bool CViewText::serializeTextOptions( xmlNodePtr node ) const { - xmlNodePtr node = CViewBase::serialize( parentNode, type ); - if( node == NULL ) - return NULL; - - xmlSetProp( node, BAD_CAST "type", BAD_CAST "text" ); xmlSetProp( node, BAD_CAST "color", BAD_CAST toString( _Color ).c_str() ); xmlSetProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() ); xmlSetProp( node, BAD_CAST "fontsize", @@ -544,6 +539,20 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "clamp_right", BAD_CAST toString( _ClampRight ).c_str() ); xmlSetProp( node, BAD_CAST "auto_clamp_offset", BAD_CAST toString( _AutoClampOffset ).c_str() ); xmlSetProp( node, BAD_CAST "continuous_update", BAD_CAST toString( _ContinuousUpdate ).c_str() ); + + return true; + } + + + xmlNodePtr CViewText::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 "text" ); + + serializeTextOptions( node ); std::string hs = _Text.toString();