// 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();
		}
	}
}
Example #5
0
inline	void	XMLSaver::SaveKeySig(CXMLWriter& writer, const CKeySigObj& obj)
{
	writer.WriteKeyStart(_T("attributes"));
	writer.WriteKeyStart(_T("key"));

		obj.GetChromAlter(m_CA);

		int nCount = 0;
		if ( obj.mSharp )
			nCount = bitcount(obj.mSharp);
		else if ( obj.mFlat )
			nCount = -bitcount(obj.mFlat);

		writer.WriteInteger(_T("fifths"), nCount);

	writer.WriteKeyEnd();
	writer.WriteKeyEnd();
}
Example #6
0
//-------------------------------------------------------------------------
void CUserColor::WriteXML(CXMLWriter& xml)
{
	for (TNamesMapIterator i = m_colNames.begin(); i != m_colNames.end(); i++)
	{
		int nID = i->first;
		CString sName = i->second;
		COLORREF crColor = Get(nID);

		xml.addTag(sName, crColor);
	}
}
// 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 #8
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();
}
Example #9
0
inline	void	XMLSaver::SaveClef(CXMLWriter& writer, const CClefObj& obj)
{
	writer.WriteKeyStart(_T("attributes"));
	writer.WriteKeyStart(_T("clef"));

		wxChar chSign[2] = {'G', 0};
		int nLine = 2;
		int nClefOctaveChange = 0;
		switch ( obj.mClefType )
		{
		case	0 :	//Treble
			chSign[0] = 'G'; nLine = 2;
			m_CA.clefShift = 0;
			break;
		case	1 :	//Bass
			chSign[0] = 'F'; nLine = 4;
			m_CA.clefShift = 12;
			break;
		case	2 :	//Alto
			chSign[0] = 'C'; nLine = 3;
			m_CA.clefShift = 0;
			break;
		case	3 :	//Tenor
			chSign[0] = 'G'; nLine = 2;
			nClefOctaveChange = -1;
			m_CA.clefShift = 0;
			break;
		}

		writer.WriteString(_T("sign"), chSign);
		writer.WriteInteger(_T("line"), nLine);
		if ( nClefOctaveChange != 0 )
			writer.WriteInteger(_T("clef-octave-change"), nClefOctaveChange);

	writer.WriteKeyEnd();
	writer.WriteKeyEnd();
}
Example #10
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();
  }
}