MODIFIED: #1471 Forgot to remove parents' properties before saving the node properties.

--HG--
branch : gsoc2012-gui-editor
hg/feature/sse2
dfighter1985 12 years ago
parent e376bed8f1
commit a98b99865e

@ -37,6 +37,16 @@ namespace GUIEditor
entry.propDefault = propdefault;
return entry;
}
bool operator==( const SPropEntry &other ) const
{
if( ( propName == other.propName ) &&
( propType == other.propType ) &&
( propDefault == other.propDefault ) )
return true;
else
return false;
}
};
struct SWidgetInfo

@ -30,6 +30,27 @@ namespace GUIEditor
std::fstream f;
std::string filename = "widgets/" + node->getInfo().name + ".xml";
SWidgetInfo &info = node->getInfo();
// Make a copy of the properties, then remove all the parents' properties, since we only want to save the properties of this node
std::vector< SPropEntry > props;
props.resize( info.props.size() );
std::copy( info.props.begin(), info.props.end(), props.begin() );
CWidgetInfoTreeNode *parent = node->getParent();
if( parent != NULL )
{
SWidgetInfo &parentInfo = parent->getInfo();
std::vector< SPropEntry >::const_iterator itr = parentInfo.props.begin();
while( itr != parentInfo.props.end() )
{
std::vector< SPropEntry >::const_iterator fItr;
fItr = std::find( props.begin(), props.end(), *itr );
if( fItr == props.end() )
continue;
props.erase( fItr );
++itr;
}
}
f.open( filename.c_str(), std::ios_base::out );
if( !f.is_open() )
@ -55,7 +76,7 @@ namespace GUIEditor
f << "\t</header>" << std::endl;
f << "\t<properties>" << std::endl;
for( std::vector< SPropEntry >::const_iterator itr = info.props.begin(); itr != info.props.end(); ++itr )
for( std::vector< SPropEntry >::const_iterator itr = props.begin(); itr != props.end(); ++itr )
{
f << "\t\t<property>" << std::endl;

Loading…
Cancel
Save