mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 07:36:16 +00:00
CHANGED: #1471 GUI Procedures are now serialized.
--HG-- branch : gsoc2012-gui-editor
This commit is contained in:
parent
87001d8ff1
commit
91368514b6
4 changed files with 59 additions and 1 deletions
|
@ -375,6 +375,7 @@ namespace NLGUI
|
|||
void setEditorMode( bool b ){ editorMode = b; }
|
||||
|
||||
bool serializeVariables( xmlNodePtr parentNode ) const;
|
||||
bool serializeProcs( xmlNodePtr parentNode ) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ namespace NLGUI
|
|||
virtual bool getLinkData( uint32 id, SLinkData &linkData ) = 0;
|
||||
virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0;
|
||||
virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0;
|
||||
virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2972,5 +2972,52 @@ namespace NLGUI
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CInterfaceParser::serializeProcs( xmlNodePtr parentNode) const
|
||||
{
|
||||
if( parentNode == NULL )
|
||||
return false;
|
||||
|
||||
xmlNodePtr procNode = NULL;
|
||||
xmlNodePtr actionNode = NULL;
|
||||
|
||||
TProcedureMap::const_iterator itr;
|
||||
for( itr = _ProcedureMap.begin(); itr != _ProcedureMap.end(); ++itr )
|
||||
{
|
||||
procNode = xmlNewNode( NULL, BAD_CAST "proc" );
|
||||
if( procNode == NULL )
|
||||
return false;
|
||||
|
||||
xmlAddChild( parentNode, procNode );
|
||||
|
||||
const CProcedure &proc = itr->second;
|
||||
|
||||
xmlSetProp( procNode, BAD_CAST "id", BAD_CAST itr->first.c_str() );
|
||||
|
||||
std::vector< CProcAction >::const_iterator itr2;
|
||||
for( itr2 = proc.Actions.begin(); itr2 != proc.Actions.end(); ++itr2 )
|
||||
{
|
||||
actionNode = xmlNewNode( NULL, BAD_CAST "action" );
|
||||
if( actionNode == NULL )
|
||||
return false;
|
||||
|
||||
xmlAddChild( procNode, actionNode );
|
||||
|
||||
const CProcAction &action = *itr2;
|
||||
|
||||
xmlSetProp( actionNode, BAD_CAST "handler", BAD_CAST action.Action.c_str() );
|
||||
|
||||
if( !action.Parameters.empty() )
|
||||
xmlSetProp( actionNode, BAD_CAST "params", BAD_CAST action.Parameters.c_str() );
|
||||
|
||||
if( !action.Conditions.empty() )
|
||||
xmlSetProp( actionNode, BAD_CAST "cond", BAD_CAST action.Conditions.c_str() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,14 @@ namespace GUIEditor
|
|||
return false;
|
||||
}
|
||||
|
||||
if( !CWidgetManager::getInstance()->serializeOptions( root ) )
|
||||
{
|
||||
xmlFreeNode( root );
|
||||
out.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if( !CWidgetManager::getInstance()->getParser()->serializeVariables( root ) )
|
||||
{
|
||||
xmlFreeNode( root );
|
||||
|
@ -50,7 +58,8 @@ namespace GUIEditor
|
|||
return false;
|
||||
}
|
||||
|
||||
if( !CWidgetManager::getInstance()->serializeOptions( root ) )
|
||||
|
||||
if( !CWidgetManager::getInstance()->getParser()->serializeProcs( root ) )
|
||||
{
|
||||
xmlFreeNode( root );
|
||||
out.close();
|
||||
|
|
Loading…
Reference in a new issue