diff --git a/code/nel/include/nel/gui/interface_parser.h b/code/nel/include/nel/gui/interface_parser.h index 7167757a2..d74a372de 100644 --- a/code/nel/include/nel/gui/interface_parser.h +++ b/code/nel/include/nel/gui/interface_parser.h @@ -375,6 +375,7 @@ namespace NLGUI void setEditorMode( bool b ){ editorMode = b; } bool serializeVariables( xmlNodePtr parentNode ) const; + bool serializeProcs( xmlNodePtr parentNode ) const; }; } diff --git a/code/nel/include/nel/gui/parser.h b/code/nel/include/nel/gui/parser.h index bfc9d2628..868a06c2b 100644 --- a/code/nel/include/nel/gui/parser.h +++ b/code/nel/include/nel/gui/parser.h @@ -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; }; } diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index c579fa8da..fcd8a6c93 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -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; + } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp index 9fe1268f9..097055dca 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp @@ -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();