mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-28 11:50:53 +00:00
CHANGED: #1471 CViewTextFormated and CViewTextID fields can now be serialized.
This commit is contained in:
parent
ebadfe84a1
commit
0985fd8acd
13 changed files with 46 additions and 22 deletions
|
@ -48,6 +48,7 @@ namespace NLGUI
|
||||||
{}
|
{}
|
||||||
std::string getProperty( const std::string &name ) const;
|
std::string getProperty( const std::string &name ) const;
|
||||||
void setProperty( const std::string &name, const std::string &value );
|
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 bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
|
||||||
virtual void checkCoords();
|
virtual void checkCoords();
|
||||||
const ucstring &getFormatString() const { return _FormatString; }
|
const ucstring &getFormatString() const { return _FormatString; }
|
||||||
|
|
|
@ -93,6 +93,7 @@ namespace NLGUI
|
||||||
|
|
||||||
std::string getProperty( const std::string &name ) const;
|
std::string getProperty( const std::string &name ) const;
|
||||||
void setProperty( const std::string &name, const std::string &value );
|
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 bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
|
||||||
virtual void checkCoords();
|
virtual void checkCoords();
|
||||||
|
|
||||||
|
|
|
@ -396,9 +396,7 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return 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 "button_type", BAD_CAST getTypeString().c_str() );
|
||||||
xmlNewProp( node, BAD_CAST "pushed", BAD_CAST toString( _Pushed ).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() );
|
xmlNewProp( node, BAD_CAST "over_when_pushed", BAD_CAST toString( _OverWhenPushed ).c_str() );
|
||||||
|
|
|
@ -153,8 +153,7 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return 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",
|
xmlNewProp( node, BAD_CAST "tx_normal",
|
||||||
BAD_CAST CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal ).c_str() );
|
BAD_CAST CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal ).c_str() );
|
||||||
|
|
|
@ -156,8 +156,7 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return 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",
|
xmlSetProp( node, BAD_CAST "texture",
|
||||||
BAD_CAST CViewRenderer::getInstance()->getTextureNameFromId( _Texture ).c_str() );
|
BAD_CAST CViewRenderer::getInstance()->getTextureNameFromId( _Texture ).c_str() );
|
||||||
|
|
|
@ -398,9 +398,7 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return 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_bottomleft", BAD_CAST getTextureBottomOrLeft().c_str() );
|
||||||
xmlSetProp( node, BAD_CAST "tx_middle", BAD_CAST getTextureMiddle().c_str() );
|
xmlSetProp( node, BAD_CAST "tx_middle", BAD_CAST getTextureMiddle().c_str() );
|
||||||
xmlSetProp( node, BAD_CAST "tx_topright", BAD_CAST getTextureTopOrRight().c_str() );
|
xmlSetProp( node, BAD_CAST "tx_topright", BAD_CAST getTextureTopOrRight().c_str() );
|
||||||
|
|
|
@ -386,8 +386,7 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return 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;
|
std::string tex;
|
||||||
tex = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal[ 0 ] );
|
tex = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal[ 0 ] );
|
||||||
|
|
|
@ -51,8 +51,7 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return 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;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,8 +109,7 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return 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 )
|
if( _Number.getNodePtr() != NULL )
|
||||||
xmlSetProp( node, BAD_CAST "value", BAD_CAST _Number.getNodePtr()->getFullName().c_str() );
|
xmlSetProp( node, BAD_CAST "value", BAD_CAST _Number.getNodePtr()->getFullName().c_str() );
|
||||||
|
|
|
@ -798,9 +798,7 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return 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() );
|
xmlNewProp( node, BAD_CAST "group", BAD_CAST _AssociatedGroup.c_str() );
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -501,9 +501,7 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return 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 "color", BAD_CAST toString( _Color ).c_str() );
|
||||||
xmlSetProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() );
|
xmlSetProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() );
|
||||||
xmlSetProp( node, BAD_CAST "fontsize",
|
xmlSetProp( node, BAD_CAST "fontsize",
|
||||||
|
|
|
@ -46,6 +46,18 @@ namespace NLGUI
|
||||||
CViewText::setProperty( name, value );
|
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)
|
bool CViewTextFormated::parse(xmlNodePtr cur,CInterfaceGroup * parentGroup)
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,6 +106,29 @@ namespace NLGUI
|
||||||
CViewText::setProperty( name, value );
|
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)
|
bool CViewTextID::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue