mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-05 23:09:02 +00:00
CHANGED: #1471 Pointer settings are now parsed even when the particular pointer cannot be instantiated. They are also serialized when serializing the GUI.
This commit is contained in:
parent
3a6ae1b74a
commit
530a141bee
4 changed files with 61 additions and 0 deletions
|
@ -150,6 +150,7 @@ namespace NLGUI
|
||||||
bool parseLUAScript (xmlNodePtr cur);
|
bool parseLUAScript (xmlNodePtr cur);
|
||||||
bool setupTree (xmlNodePtr cur, CWidgetManager::SMasterGroup *parentGroup);
|
bool setupTree (xmlNodePtr cur, CWidgetManager::SMasterGroup *parentGroup);
|
||||||
bool setupTreeNode (xmlNodePtr cur, CGroupContainer *parentGroup);
|
bool setupTreeNode (xmlNodePtr cur, CGroupContainer *parentGroup);
|
||||||
|
void savePointerSettings( xmlNodePtr node );
|
||||||
|
|
||||||
void addModule( std::string name, IParserModule *module );
|
void addModule( std::string name, IParserModule *module );
|
||||||
IParserModule* getModuleFor( std::string name ) const;
|
IParserModule* getModuleFor( std::string name ) const;
|
||||||
|
@ -348,6 +349,7 @@ namespace NLGUI
|
||||||
|
|
||||||
bool editorMode;
|
bool editorMode;
|
||||||
std::map< std::string, VariableData > variableCache;
|
std::map< std::string, VariableData > variableCache;
|
||||||
|
std::map< std::string, std::string > pointerSettings;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void initLUA();
|
void initLUA();
|
||||||
|
@ -376,6 +378,7 @@ namespace NLGUI
|
||||||
|
|
||||||
bool serializeVariables( xmlNodePtr parentNode ) const;
|
bool serializeVariables( xmlNodePtr parentNode ) const;
|
||||||
bool serializeProcs( xmlNodePtr parentNode ) const;
|
bool serializeProcs( xmlNodePtr parentNode ) const;
|
||||||
|
bool serializePointerSettings( xmlNodePtr parentNode ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ namespace NLGUI
|
||||||
virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0;
|
virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0;
|
||||||
virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0;
|
virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0;
|
||||||
virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0;
|
virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0;
|
||||||
|
virtual bool serializePointerSettings( xmlNodePtr parentNode ) const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1363,6 +1363,9 @@ namespace NLGUI
|
||||||
|
|
||||||
if ( !strcmp(ptr,"pointer"))
|
if ( !strcmp(ptr,"pointer"))
|
||||||
{
|
{
|
||||||
|
if( editorMode )
|
||||||
|
savePointerSettings( cur );
|
||||||
|
|
||||||
CWidgetManager::getInstance()->setPointer( dynamic_cast<CViewPointer*>(view) );
|
CWidgetManager::getInstance()->setPointer( dynamic_cast<CViewPointer*>(view) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1552,6 +1555,27 @@ namespace NLGUI
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInterfaceParser::savePointerSettings( xmlNodePtr node )
|
||||||
|
{
|
||||||
|
if( node == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
xmlAttrPtr prop = node->properties;
|
||||||
|
|
||||||
|
std::string key;
|
||||||
|
std::string value;
|
||||||
|
|
||||||
|
while( prop != NULL )
|
||||||
|
{
|
||||||
|
key = std::string( reinterpret_cast< const char* >( prop->name ) );
|
||||||
|
value = std::string( reinterpret_cast< char* >( prop->children->content ) );
|
||||||
|
|
||||||
|
pointerSettings[ key ] = value;
|
||||||
|
|
||||||
|
prop = prop->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CInterfaceParser::addModule( std::string name, IParserModule *module )
|
void CInterfaceParser::addModule( std::string name, IParserModule *module )
|
||||||
{
|
{
|
||||||
std::map< std::string, IParserModule* >::iterator itr =
|
std::map< std::string, IParserModule* >::iterator itr =
|
||||||
|
@ -2582,6 +2606,7 @@ namespace NLGUI
|
||||||
NLMISC::contReset (_ParentSizesMaxMap);
|
NLMISC::contReset (_ParentSizesMaxMap);
|
||||||
NLMISC::contReset (_LuaClassAssociation);
|
NLMISC::contReset (_LuaClassAssociation);
|
||||||
variableCache.clear();
|
variableCache.clear();
|
||||||
|
pointerSettings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3022,5 +3047,29 @@ namespace NLGUI
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CInterfaceParser::serializePointerSettings( xmlNodePtr parentNode ) const
|
||||||
|
{
|
||||||
|
if( parentNode == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
xmlNodePtr node = xmlNewNode( NULL, BAD_CAST "view" );
|
||||||
|
if( node == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
xmlAddChild( parentNode, node );
|
||||||
|
|
||||||
|
std::map< std::string, std::string >::const_iterator itr;
|
||||||
|
for( itr = pointerSettings.begin(); itr != pointerSettings.end(); ++itr )
|
||||||
|
{
|
||||||
|
const std::string &key = itr->first;
|
||||||
|
const std::string &value = itr->second;
|
||||||
|
|
||||||
|
xmlSetProp( node, BAD_CAST key.c_str(), BAD_CAST value.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,14 @@ namespace GUIEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( !CWidgetManager::getInstance()->getParser()->serializePointerSettings( root ) )
|
||||||
|
{
|
||||||
|
xmlFreeNode( root );
|
||||||
|
out.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if( !CWidgetManager::getInstance()->getParser()->serializeVariables( root ) )
|
if( !CWidgetManager::getInstance()->getParser()->serializeVariables( root ) )
|
||||||
{
|
{
|
||||||
xmlFreeNode( root );
|
xmlFreeNode( root );
|
||||||
|
|
Loading…
Reference in a new issue