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 ebadfe84a1
commit 0985fd8acd
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" );
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,7 +153,6 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "button" );
xmlNewProp( node, BAD_CAST "tx_normal",

View file

@ -156,7 +156,6 @@ 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 "texture",

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 "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,7 +386,6 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_button" );
std::string tex;

View file

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

View file

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

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" );
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 "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)
{