CHANGED: #1471 CViewTextFormated and CViewTextID fields can now be serialized.

This commit is contained in:
dfighter1985 2012-08-12 01:19:05 +02:00
parent 75f77ea756
commit 179d9e524c
13 changed files with 46 additions and 22 deletions

View file

@ -48,6 +48,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;
virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
virtual void checkCoords();
const ucstring &getFormatString() const { return _FormatString; }

View file

@ -93,6 +93,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;
virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
virtual void checkCoords();

View file

@ -396,9 +396,7 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "button" );
xmlSetProp( node, BAD_CAST "type", BAD_CAST "button" );
xmlNewProp( node, BAD_CAST "button_type", BAD_CAST getTypeString().c_str() );
xmlNewProp( node, BAD_CAST "pushed", BAD_CAST toString( _Pushed ).c_str() );
xmlNewProp( node, BAD_CAST "over_when_pushed", BAD_CAST toString( _OverWhenPushed ).c_str() );

View file

@ -153,8 +153,7 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "button" );
xmlSetProp( node, BAD_CAST "type", BAD_CAST "button" );
xmlNewProp( node, BAD_CAST "tx_normal",
BAD_CAST CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal ).c_str() );

View file

@ -156,8 +156,7 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "colpick" );
xmlSetProp( node, BAD_CAST "type", BAD_CAST "colpick" );
xmlSetProp( node, BAD_CAST "texture",
BAD_CAST CViewRenderer::getInstance()->getTextureNameFromId( _Texture ).c_str() );

View file

@ -398,9 +398,7 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "scroll" );
xmlSetProp( node, BAD_CAST "type", BAD_CAST "scroll" );
xmlSetProp( node, BAD_CAST "tx_bottomleft", BAD_CAST getTextureBottomOrLeft().c_str() );
xmlSetProp( node, BAD_CAST "tx_middle", BAD_CAST getTextureMiddle().c_str() );
xmlSetProp( node, BAD_CAST "tx_topright", BAD_CAST getTextureTopOrRight().c_str() );

View file

@ -386,8 +386,7 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_button" );
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_button" );
std::string tex;
tex = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal[ 0 ] );

View file

@ -51,8 +51,7 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "tooltip" );
xmlSetProp( node, BAD_CAST "type", BAD_CAST "tooltip" );
return node;
}

View file

@ -109,8 +109,7 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "digit" );
xmlSetProp( node, BAD_CAST "type", BAD_CAST "digit" );
if( _Number.getNodePtr() != NULL )
xmlSetProp( node, BAD_CAST "value", BAD_CAST _Number.getNodePtr()->getFullName().c_str() );

View file

@ -798,9 +798,7 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "tab" );
xmlSetProp( node, BAD_CAST "type", BAD_CAST "tab" );
xmlNewProp( node, BAD_CAST "group", BAD_CAST _AssociatedGroup.c_str() );
return node;

View file

@ -501,9 +501,7 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text" );
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",

View file

@ -46,6 +46,18 @@ namespace NLGUI
CViewText::setProperty( name, value );
}
xmlNodePtr CViewTextFormated::serialize( xmlNodePtr parentNode, const char *type ) const
{
xmlNodePtr node = CViewText::serialize( parentNode, type );
if( node == NULL )
return NULL;
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_formated" );
xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().c_str() );
return NULL;
}
// ****************************************************************************
bool CViewTextFormated::parse(xmlNodePtr cur,CInterfaceGroup * parentGroup)
{

View file

@ -106,6 +106,29 @@ namespace NLGUI
CViewText::setProperty( name, value );
}
xmlNodePtr CViewTextID::serialize( xmlNodePtr parentNode, const char *type ) const
{
xmlNodePtr node = CViewText::serialize( parentNode, type );
if( node == NULL )
return NULL;
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_id" );
if( _DBTextId.getNodePtr() != NULL )
xmlSetProp( node, BAD_CAST "textid", BAD_CAST _DBTextId.getNodePtr()->getFullName().c_str() );
else
xmlSetProp( node, BAD_CAST "textid", BAD_CAST "" );
xmlSetProp( node, BAD_CAST "dynamic_string",
BAD_CAST NLMISC::toString( _DynamicString ).c_str() );
xmlSetProp( node, BAD_CAST "format_taged",
BAD_CAST NLMISC::toString( _IsTextFormatTaged ).c_str() );
return node;
}
// ***************************************************************************
bool CViewTextID::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
{