Example #1
0
// Load and save to an XML file
void CDrawPower::SaveXML(CXMLWriter &xml)
{
	xml.addTag(GetXMLTag());

	xml.addAttribute(_T("pos"), CDPoint(m_point_a));
	xml.addAttribute(_T("which"), which);
	xml.addAttribute(_T("direction"), dir);
	xml.addChildData(str);

	xml.closeTag();
}
// Load and save to an XML file
void CDrawSquare::SaveXML( CXMLWriter &xml )
{
    xml.addTag(GetXMLTag(IsSquare()));

    xml.addAttribute( _T("a"), CDPoint(m_point_a) );
    xml.addAttribute( _T("b"), CDPoint(m_point_b) );
    xml.addAttribute( _T("style"), Style );
    xml.addAttribute( _T("fill"), Fill );

    xml.closeTag();
}
// Load and save to an XML file
void CDrawMetaFile::SaveXML( CXMLWriter &xml )
{
	xml.addTag(GetXMLTag());

	xml.addAttribute( _T("a"), CDPoint(m_point_a) );
	xml.addAttribute( _T("b"), CDPoint(m_point_b) );
	xml.addAttribute( _T("id"), m_metafile );

	xml.closeTag();

}
void COption::WriteXML(CXMLWriter &xml)
{
	xml.addTag( _T("OPTIONS") );

// !!	xml.addTag( "FONT", CurrentFont )
// !!	xml.addTag( "STYLE", CurrentStyle );
	xml.addTag( _T("GRID"), GridShow );
	xml.addTag( _T("UNITS"), Units );
	m_oColors.WriteXML( xml );

	xml.closeTag();
}
//-------------------------------------------------------------------------
void CDocResource::SaveXML( CTinyCadDoc* pDesign, const TCHAR* name, CXMLWriter& xml )
{
	// Now actually save the resources
	for( CDocResource* pointer = this; pointer != NULL; pointer = pointer->next )
	{
		if( pointer->InUse )
		{
			xml.addTag( name );
			xml.addAttribute( _T("id"), pointer->ResourceNumber );
			pointer->SaveItemXML( pDesign, xml );
			xml.closeTag();
		}
	}
}
// Load and save to an XML file
void CDrawLine::SaveXML( CXMLWriter &xml )
{
	xml.addTag(GetXMLTag(xtype));

	switch (xtype) 
	{
	case xBus:
	case xWire:
		if (!m_use_default_style)
		{
			xml.addAttribute( _T("style"), m_style );
		}
		break;
	default:
		xml.addAttribute( _T("style"), m_style );
		break;
	}	

	xml.addAttribute( _T("a"), m_point_a );
	xml.addAttribute( _T("b"), m_point_b );
	xml.closeTag();
}
Example #7
0
//-------------------------------------------------------------------------
void CTinyCadDoc::SaveXML(CXMLWriter &xml, drawingCollection &drawing, BOOL Details, BOOL SaveSelect, BOOL SaveResources )
{
  // Write the objects to the file
  try
  {  
	xml.addTag(GetXMLTag());

	// If necessary write the header stamp
	if (Details) 
	{
		xml.addTag(_T("NAME"));
		xml.addChildData( m_sheet_name );
		xml.closeTag();

		xml.addTag(_T("DETAILS"));
		m_oDetails.WriteXML( xml );
		m_snap.SaveXML( xml );
		xml.closeTag();
	}

	if (SaveResources)
	{
		// Find out which resources are in use
		
		for( drawingIterator i = drawing.begin(); i != drawing.end(); i++ )
		{
			(*i)->TagResources();
		}

		// Save the resource details details
		theOptions.SaveFontsXML(xml);
		theOptions.SaveStylesXML(xml);
		theOptions.SaveFillStylesXML(xml);
		theOptions.SaveMetaFilesXML(xml);
	}

	// Only save the symbols if we are not saving
	// to a library or the header...
	if (Details)
	{
		theOptions.SaveSymbolsXML(xml);
	}

	if (Details)
	{
		theOptions.WriteXML( xml) ;
	}

	for( drawingIterator i = drawing.begin(); i != drawing.end(); i++ )
	{
		CDrawingObject* obj = *i;

		if (obj->GetType() != xError
			&& 	(Details || !obj->IsConstruction()) 
			&&  (!SaveSelect || IsSelected( obj )) )
		{

			// Now save the actual object data
			obj->SaveXML(xml);
		}
	}

	xml.closeTag();

  }
  catch ( CException *e) 
  {
	// Could not save the file properly
    e->ReportError();
    e->Delete();
  }
}