Commit 89ff6c64 authored by jean-pierre charras's avatar jean-pierre charras

Fix bug 741352. Needs more tests

parents 175fab48 e68662c1
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2011-03-23)" #define KICAD_BUILD_VERSION "(2011-03-25)"
#endif #endif
// uncomment this line only when creating a stable version // uncomment this line only when creating a stable version
......
...@@ -43,9 +43,10 @@ void CVPCB_MAINFRAME::WriteStuffList( wxCommandEvent& event ) ...@@ -43,9 +43,10 @@ void CVPCB_MAINFRAME::WriteStuffList( wxCommandEvent& event )
{ {
if( component.m_Module.empty() ) if( component.m_Module.empty() )
continue; continue;
fprintf( FileEquiv, "comp = \"%s\" module = \"%s\"\n",
TO_UTF8( component.m_Reference ), fprintf( FileEquiv, "comp = %s module = %s\n",
TO_UTF8( component.m_Module ) ); EscapedUTF8( component.m_Reference ).c_str(),
EscapedUTF8( component.m_Module ).c_str() );
} }
fclose( FileEquiv ); fclose( FileEquiv );
......
...@@ -113,8 +113,10 @@ bool LIB_FIELD::Save( FILE* ExportFile ) ...@@ -113,8 +113,10 @@ bool LIB_FIELD::Save( FILE* ExportFile )
if( text.IsEmpty() ) if( text.IsEmpty() )
text = wxT( "~" ); text = wxT( "~" );
if( fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c%c%c", if( fprintf( ExportFile, "F%d %s %d %d %d %c %c %c %c%c%c",
m_id, TO_UTF8( text ), m_Pos.x, m_Pos.y, m_Size.x, m_id,
EscapedUTF8( text ).c_str(), // wraps in quotes
m_Pos.x, m_Pos.y, m_Size.x,
m_Orient == 0 ? 'H' : 'V', m_Orient == 0 ? 'H' : 'V',
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V', (m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
hjustify, vjustify, hjustify, vjustify,
...@@ -129,10 +131,11 @@ bool LIB_FIELD::Save( FILE* ExportFile ) ...@@ -129,10 +131,11 @@ bool LIB_FIELD::Save( FILE* ExportFile )
*/ */
wxString defName = TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id ); wxString defName = TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id );
if( m_id >= FIELD1 && !m_name.IsEmpty() if( m_id >= FIELD1 && !m_name.IsEmpty() && m_name != defName
&& m_name != defName && fprintf( ExportFile, " %s", EscapedUTF8( m_name ).c_str() ) < 0 )
&& fprintf( ExportFile, " \"%s\"", TO_UTF8( m_name ) ) < 0 ) {
return false; return false;
}
if( fprintf( ExportFile, "\n" ) < 0 ) if( fprintf( ExportFile, "\n" ) < 0 )
return false; return false;
...@@ -148,8 +151,6 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) ...@@ -148,8 +151,6 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
char textVisible; char textVisible;
char textHJustify; char textHJustify;
char textVJustify[256]; char textVJustify[256];
char fieldUserName[1024];
char* text;
if( sscanf( line + 1, "%d", &m_id ) != 1 || m_id < 0 ) if( sscanf( line + 1, "%d", &m_id ) != 1 || m_id < 0 )
{ {
...@@ -169,21 +170,12 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) ...@@ -169,21 +170,12 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
if( *line == 0 ) if( *line == 0 )
return false; return false;
line++;
text = line;
/* Find end of text. */ line += ReadDelimitedText( &m_Text, line );
while( *line && (*line != '"') )
line++;
if( *line == 0 ) if( *line == 0 )
return false; return false;
*line = 0;
line++;
fieldUserName[0] = 0;
memset( textVJustify, 0, sizeof( textVJustify ) ); memset( textVJustify, 0, sizeof( textVJustify ) );
cnt = sscanf( line, " %d %d %d %c %c %c %s", &m_Pos.x, &m_Pos.y, &m_Size.y, cnt = sscanf( line, " %d %d %d %c %c %c %s", &m_Pos.x, &m_Pos.y, &m_Size.y,
...@@ -196,7 +188,6 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) ...@@ -196,7 +188,6 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
return false; return false;
} }
m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y; m_Size.x = m_Size.y;
if( textOrient == 'H' ) if( textOrient == 'H' )
...@@ -270,8 +261,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) ...@@ -270,8 +261,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
} }
else else
{ {
ReadDelimitedText( fieldUserName, line, sizeof( fieldUserName ) ); ReadDelimitedText( &m_name, line );
m_name = FROM_UTF8( fieldUserName );
} }
return true; return true;
......
...@@ -1179,12 +1179,10 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1179,12 +1179,10 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
int fieldNdx; int fieldNdx;
char FieldUserName[1024]; wxString fieldText;
GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER; GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER;
GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER; GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER;
FieldUserName[0] = 0;
ptcar = (char*) aLine; ptcar = (char*) aLine;
while( *ptcar && (*ptcar != '"') ) while( *ptcar && (*ptcar != '"') )
...@@ -1197,32 +1195,20 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1197,32 +1195,20 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
return false; return false;
} }
for( ptcar++, ii = 0; ; ii++, ptcar++ ) ptcar += ReadDelimitedText( &fieldText, ptcar );
if( *ptcar == 0 )
{ {
Name1[ii] = *ptcar; aErrorMsg.Printf( wxT( "Component field F at line %d, aborted" ),
if( *ptcar == 0 ) aLine.LineNumber() );
{ return false;
aErrorMsg.Printf( wxT( "Component field F at line %d, aborted" ),
aLine.LineNumber() );
return false;
}
if( *ptcar == '"' )
{
Name1[ii] = 0;
ptcar++;
break;
}
} }
fieldNdx = atoi( line + 2 ); fieldNdx = atoi( line + 2 );
ReadDelimitedText( FieldUserName, ptcar, sizeof(FieldUserName) ); ReadDelimitedText( &fieldName, ptcar );
if( !FieldUserName[0] ) if( fieldName.IsEmpty() )
fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx ); fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx );
else
fieldName = FROM_UTF8( FieldUserName );
if( fieldNdx >= GetFieldCount() ) if( fieldNdx >= GetFieldCount() )
{ {
...@@ -1248,7 +1234,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1248,7 +1234,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
GetField( fieldNdx )->m_Name = fieldName; GetField( fieldNdx )->m_Name = fieldName;
} }
GetField( fieldNdx )->m_Text = FROM_UTF8( Name1 ); GetField( fieldNdx )->m_Text = fieldText;
memset( Char3, 0, sizeof(Char3) ); memset( Char3, 0, sizeof(Char3) );
if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1, if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1,
&GetField( fieldNdx )->m_Pos.x, &GetField( fieldNdx )->m_Pos.x,
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "sch_component.h" #include "sch_component.h"
#include "sch_field.h" #include "sch_field.h"
#include "template_fieldnames.h" #include "template_fieldnames.h"
#include "kicad_string.h"
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, wxString aName ) : SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, wxString aName ) :
SCH_ITEM( aParent, SCH_FIELD_T ), SCH_ITEM( aParent, SCH_FIELD_T ),
...@@ -329,9 +329,9 @@ bool SCH_FIELD::Save( FILE* aFile ) const ...@@ -329,9 +329,9 @@ bool SCH_FIELD::Save( FILE* aFile ) const
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
vjustify = 'T'; vjustify = 'T';
if( fprintf( aFile, "F %d \"%s\" %c %-3d %-3d %-3d %4.4X %c %c%c%c", if( fprintf( aFile, "F %d %s %c %-3d %-3d %-3d %4.4X %c %c%c%c",
m_FieldId, m_FieldId,
TO_UTF8( m_Text ), EscapedUTF8( m_Text ).c_str(), // wraps in quotes too
m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V', m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V',
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Size.x, m_Size.x,
...@@ -346,7 +346,7 @@ bool SCH_FIELD::Save( FILE* aFile ) const ...@@ -346,7 +346,7 @@ bool SCH_FIELD::Save( FILE* aFile ) const
// Save field name, if the name is user definable // Save field name, if the name is user definable
if( m_FieldId >= FIELD1 ) if( m_FieldId >= FIELD1 )
{ {
if( fprintf( aFile, " \"%s\"", TO_UTF8( m_Name ) ) == EOF ) if( fprintf( aFile, " %s", EscapedUTF8( m_Name ).c_str() ) == EOF )
{ {
return false; return false;
} }
......
...@@ -517,14 +517,14 @@ bool SCH_SCREEN::Save( FILE* aFile ) const ...@@ -517,14 +517,14 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
m_CurrentSheetDesc->m_Size.x, m_CurrentSheetDesc->m_Size.y ) < 0 m_CurrentSheetDesc->m_Size.x, m_CurrentSheetDesc->m_Size.y ) < 0
|| fprintf( aFile, "encoding utf-8\n") < 0 || fprintf( aFile, "encoding utf-8\n") < 0
|| fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0 || fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0
|| fprintf( aFile, "Title \"%s\"\n", TO_UTF8( m_Title ) ) < 0 || fprintf( aFile, "Title %s\n", EscapedUTF8( m_Title ).c_str() ) < 0
|| fprintf( aFile, "Date \"%s\"\n", TO_UTF8( m_Date ) ) < 0 || fprintf( aFile, "Date %s\n", EscapedUTF8( m_Date ).c_str() ) < 0
|| fprintf( aFile, "Rev \"%s\"\n", TO_UTF8( m_Revision ) ) < 0 || fprintf( aFile, "Rev %s\n", EscapedUTF8( m_Revision ).c_str() ) < 0
|| fprintf( aFile, "Comp \"%s\"\n", TO_UTF8( m_Company ) ) < 0 || fprintf( aFile, "Comp %s\n", EscapedUTF8( m_Company ).c_str() ) < 0
|| fprintf( aFile, "Comment1 \"%s\"\n", TO_UTF8( m_Commentaire1 ) ) < 0 || fprintf( aFile, "Comment1 %s\n", EscapedUTF8( m_Commentaire1 ).c_str() ) < 0
|| fprintf( aFile, "Comment2 \"%s\"\n", TO_UTF8( m_Commentaire2 ) ) < 0 || fprintf( aFile, "Comment2 %s\n", EscapedUTF8( m_Commentaire2 ).c_str() ) < 0
|| fprintf( aFile, "Comment3 \"%s\"\n", TO_UTF8( m_Commentaire3 ) ) < 0 || fprintf( aFile, "Comment3 %s\n", EscapedUTF8( m_Commentaire3 ).c_str() ) < 0
|| fprintf( aFile, "Comment4 \"%s\"\n", TO_UTF8( m_Commentaire4 ) ) < 0 || fprintf( aFile, "Comment4 %s\n", EscapedUTF8( m_Commentaire4 ).c_str() ) < 0
|| fprintf( aFile, "$EndDescr\n" ) < 0 ) || fprintf( aFile, "$EndDescr\n" ) < 0 )
return false; return false;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "sch_sheet.h" #include "sch_sheet.h"
#include "sch_sheet_path.h" #include "sch_sheet_path.h"
#include "sch_component.h" #include "sch_component.h"
#include "kicad_string.h"
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_SHEET_T ) SCH_ITEM( NULL, SCH_SHEET_T )
...@@ -131,14 +131,14 @@ bool SCH_SHEET::Save( FILE* aFile ) const ...@@ -131,14 +131,14 @@ bool SCH_SHEET::Save( FILE* aFile ) const
/* Save schematic sheetname and filename. */ /* Save schematic sheetname and filename. */
if( !m_SheetName.IsEmpty() ) if( !m_SheetName.IsEmpty() )
{ {
if( fprintf( aFile, "F0 \"%s\" %d\n", TO_UTF8( m_SheetName ), if( fprintf( aFile, "F0 %s %d\n", EscapedUTF8( m_SheetName ).c_str(),
m_SheetNameSize ) == EOF ) m_SheetNameSize ) == EOF )
return false; return false;
} }
if( !m_FileName.IsEmpty() ) if( !m_FileName.IsEmpty() )
{ {
if( fprintf( aFile, "F1 \"%s\" %d\n", TO_UTF8( m_FileName ), if( fprintf( aFile, "F1 %s %d\n", EscapedUTF8( m_FileName ).c_str(),
m_FileNameSize ) == EOF ) m_FileNameSize ) == EOF )
return false; return false;
} }
...@@ -160,8 +160,7 @@ bool SCH_SHEET::Save( FILE* aFile ) const ...@@ -160,8 +160,7 @@ bool SCH_SHEET::Save( FILE* aFile ) const
bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
int ii, fieldNdx, size; int fieldNdx, size;
char Name1[256];
SCH_SHEET_PIN* SheetLabel; SCH_SHEET_PIN* SheetLabel;
char* ptcar; char* ptcar;
...@@ -231,24 +230,15 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -231,24 +230,15 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
return false; return false;
} }
for( ptcar++, ii = 0; ; ii++, ptcar++ ) wxString sheetName;
{ ptcar += ReadDelimitedText( &sheetName, ptcar );
Name1[ii] = *ptcar;
if( *ptcar == 0 )
{
aErrorMsg.Printf( wxT( "EESchema file sheet field F at line %d, aborted\n" ),
aLine.LineNumber() );
aErrorMsg << FROM_UTF8( (char*) aLine );
return false;
}
if( *ptcar == '"' ) if( *ptcar == 0 )
{ {
Name1[ii] = 0; aErrorMsg.Printf( wxT( "EESchema file sheet field F at line %d, aborted\n" ),
ptcar++; aLine.LineNumber() );
break; aErrorMsg << FROM_UTF8( (char*) aLine );
} return false;
} }
if( ( fieldNdx == 0 ) || ( fieldNdx == 1 ) ) if( ( fieldNdx == 0 ) || ( fieldNdx == 1 ) )
...@@ -265,14 +255,12 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -265,14 +255,12 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( fieldNdx == 0 ) if( fieldNdx == 0 )
{ {
m_SheetName = FROM_UTF8( Name1 ); m_SheetName = sheetName;
m_SheetNameSize = size; m_SheetNameSize = size;
} }
else else
{ {
SetFileName( FROM_UTF8( Name1 ) ); SetFileName( sheetName );
//printf( "in ReadSheetDescr : m_FileName = %s \n", Name1 );
m_FileNameSize = size; m_FileNameSize = size;
} }
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
; General Product Description Definitions ; General Product Description Definitions
!define PRODUCT_NAME "KiCad" !define PRODUCT_NAME "KiCad"
!define PRODUCT_VERSION "2011.03.23" !define PRODUCT_VERSION "2011.03.25"
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" !define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" !define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
!define COMPANY_NAME "" !define COMPANY_NAME ""
......
...@@ -362,7 +362,7 @@ bool DIMENSION::Save( FILE* aFile ) const ...@@ -362,7 +362,7 @@ bool DIMENSION::Save( FILE* aFile ) const
fprintf( aFile, "Va %d\n", m_Value ); fprintf( aFile, "Va %d\n", m_Value );
if( !m_Text->m_Text.IsEmpty() ) if( !m_Text->m_Text.IsEmpty() )
fprintf( aFile, "Te \"%s\"\n", TO_UTF8( m_Text->m_Text ) ); fprintf( aFile, "Te %s\n", EscapedUTF8( m_Text->m_Text ).c_str() );
else else
fprintf( aFile, "Te \"?\"\n" ); fprintf( aFile, "Te \"?\"\n" );
......
...@@ -370,7 +370,7 @@ int MODULE::Write_3D_Descr( FILE* File ) const ...@@ -370,7 +370,7 @@ int MODULE::Write_3D_Descr( FILE* File ) const
{ {
fprintf( File, "$SHAPE3D\n" ); fprintf( File, "$SHAPE3D\n" );
fprintf( File, "Na \"%s\"\n", TO_UTF8( t3D->m_Shape3DName ) ); fprintf( File, "Na %s\n", EscapedUTF8( t3D->m_Shape3DName ).c_str() );
sprintf( buf, "Sc %lf %lf %lf\n", sprintf( buf, "Sc %lf %lf %lf\n",
t3D->m_MatScale.x, t3D->m_MatScale.x,
......
...@@ -286,8 +286,8 @@ bool NETCLASS::Save( FILE* aFile ) const ...@@ -286,8 +286,8 @@ bool NETCLASS::Save( FILE* aFile ) const
bool result = true; bool result = true;
fprintf( aFile, "$" BRD_NETCLASS "\n" ); fprintf( aFile, "$" BRD_NETCLASS "\n" );
fprintf( aFile, "Name \"%s\"\n", TO_UTF8( m_Name ) ); fprintf( aFile, "Name %s\n", EscapedUTF8( m_Name ).c_str() );
fprintf( aFile, "Desc \"%s\"\n", TO_UTF8( GetDescription() ) ); fprintf( aFile, "Desc %s\n", EscapedUTF8( GetDescription() ).c_str() );
// Write parameters // Write parameters
...@@ -302,7 +302,7 @@ bool NETCLASS::Save( FILE* aFile ) const ...@@ -302,7 +302,7 @@ bool NETCLASS::Save( FILE* aFile ) const
// Write members: // Write members:
for( const_iterator i = begin(); i!=end(); ++i ) for( const_iterator i = begin(); i!=end(); ++i )
fprintf( aFile, "AddNet \"%s\"\n", TO_UTF8( *i ) ); fprintf( aFile, "AddNet %s\n", EscapedUTF8( *i ).c_str() );
fprintf( aFile, "$End" BRD_NETCLASS "\n" ); fprintf( aFile, "$End" BRD_NETCLASS "\n" );
......
...@@ -78,11 +78,9 @@ bool NETINFO_ITEM::Save( FILE* aFile ) const ...@@ -78,11 +78,9 @@ bool NETINFO_ITEM::Save( FILE* aFile ) const
bool success = false; bool success = false;
fprintf( aFile, "$EQUIPOT\n" ); fprintf( aFile, "$EQUIPOT\n" );
fprintf( aFile, "Na %d \"%s\"\n", GetNet(), TO_UTF8( m_Netname ) ); fprintf( aFile, "Na %d %s\n", GetNet(), EscapedUTF8( m_Netname ).c_str() );
fprintf( aFile, "St %s\n", "~" ); fprintf( aFile, "St %s\n", "~" );
// fprintf( aFile, "NetClass \"%s\"\n", TO_UTF8(m_NetClassName) );
if( fprintf( aFile, "$EndEQUIPOT\n" ) != sizeof("$EndEQUIPOT\n") - 1 ) if( fprintf( aFile, "$EndEQUIPOT\n" ) != sizeof("$EndEQUIPOT\n") - 1 )
goto out; goto out;
......
...@@ -558,18 +558,19 @@ bool D_PAD::Save( FILE* aFile ) const ...@@ -558,18 +558,19 @@ bool D_PAD::Save( FILE* aFile ) const
fprintf( aFile, "At %s N %8.8X\n", texttype, m_Masque_Layer ); fprintf( aFile, "At %s N %8.8X\n", texttype, m_Masque_Layer );
fprintf( aFile, "Ne %d \"%s\"\n", GetNet(), TO_UTF8( m_Netname ) ); fprintf( aFile, "Ne %d %s\n", GetNet(), EscapedUTF8( m_Netname ).c_str() );
fprintf( aFile, "Po %d %d\n", m_Pos0.x, m_Pos0.y ); fprintf( aFile, "Po %d %d\n", m_Pos0.x, m_Pos0.y );
if( m_LocalSolderMaskMargin != 0 ) if( m_LocalSolderMaskMargin != 0 )
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin ); fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
if( m_LocalSolderPasteMargin != 0 ) if( m_LocalSolderPasteMargin != 0 )
fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin ); fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
if( m_LocalSolderPasteMarginRatio != 0 ) if( m_LocalSolderPasteMarginRatio != 0 )
fprintf( aFile, fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
".SolderPasteRatio %g\n",
m_LocalSolderPasteMarginRatio );
if( m_LocalClearance != 0 ) if( m_LocalClearance != 0 )
fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance ); fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance );
......
...@@ -78,7 +78,7 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const ...@@ -78,7 +78,7 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const
if( parent ) if( parent )
orient += parent->m_Orient; orient += parent->m_Orient;
int ret = fprintf( aFile, "T%d %d %d %d %d %d %d %c %c %d %c\"%s\"\n", int ret = fprintf( aFile, "T%d %d %d %d %d %d %d %c %c %d %c %s\n",
m_Type, m_Type,
m_Pos0.x, m_Pos0.y, m_Pos0.x, m_Pos0.y,
m_Size.y, m_Size.x, m_Size.y, m_Size.x,
...@@ -87,7 +87,8 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const ...@@ -87,7 +87,8 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const
m_Mirror ? 'M' : 'N', m_NoShow ? 'I' : 'V', m_Mirror ? 'M' : 'N', m_NoShow ? 'I' : 'V',
GetLayer(), GetLayer(),
m_Italic ? 'I' : 'N', m_Italic ? 'I' : 'N',
TO_UTF8( m_Text ) ); EscapedUTF8( m_Text ).c_str()
);
return ret > 20; return ret > 20;
} }
...@@ -101,37 +102,41 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const ...@@ -101,37 +102,41 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const
*/ */
int TEXTE_MODULE::ReadDescr( LINE_READER* aReader ) int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
{ {
int success = true; int success = true;
int type; int type;
int layer; char BufCar1[128], BufCar2[128], BufCar3[128];
char BufCar1[128], BufCar2[128], BufCar3[128], BufLine[256]; char* line = aReader->Line();
char *aLine;
aLine = aReader->Line(); int layer = SILKSCREEN_N_FRONT;
layer = SILKSCREEN_N_FRONT;
BufCar1[0] = 0; BufCar1[0] = 0;
BufCar2[0] = 0; BufCar2[0] = 0;
BufCar3[0] = 0; BufCar3[0] = 0;
if( sscanf( aLine + 1, "%d %d %d %d %d %d %d %s %s %d %s",
if( sscanf( line + 1, "%d %d %d %d %d %d %d %s %s %d %s",
&type, &type,
&m_Pos0.x, &m_Pos0.y, &m_Pos0.x, &m_Pos0.y,
&m_Size.y, &m_Size.x, &m_Size.y, &m_Size.x,
&m_Orient, &m_Thickness, &m_Orient, &m_Thickness,
BufCar1, BufCar2, &layer, BufCar3 ) >= 10 ) BufCar1, BufCar2, &layer, BufCar3 ) >= 10 )
{
success = true; success = true;
}
if( (type != TEXT_is_REFERENCE) && (type != TEXT_is_VALUE) ) if( (type != TEXT_is_REFERENCE) && (type != TEXT_is_VALUE) )
type = TEXT_is_DIVERS; type = TEXT_is_DIVERS;
m_Type = type; m_Type = type;
// Due to the pcbnew history, .m_Orient is saved in screen value // Due to the pcbnew history, .m_Orient is saved in screen value
// but it is handled as relative to its parent footprint // but it is handled as relative to its parent footprint
m_Orient -= ( (MODULE*) m_Parent )->m_Orient; m_Orient -= ( (MODULE*) m_Parent )->m_Orient;
if( BufCar1[0] == 'M' ) if( BufCar1[0] == 'M' )
m_Mirror = true; m_Mirror = true;
else else
m_Mirror = false; m_Mirror = false;
if( BufCar2[0] == 'I' ) if( BufCar2[0] == 'I' )
m_NoShow = true; m_NoShow = true;
else else
...@@ -154,11 +159,12 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader ) ...@@ -154,11 +159,12 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
SetLayer( layer ); SetLayer( layer );
/* Calculate the true position. */ // Calculate the actual position.
SetDrawCoord(); SetDrawCoord();
/* Read the "text" string. */
ReadDelimitedText( BufLine, aLine, sizeof(BufLine) );
m_Text = FROM_UTF8( BufLine ); // Search and read the "text" string (a quoted text).
ReadDelimitedText( &m_Text, line );
// Test for a reasonable size: // Test for a reasonable size:
if( m_Size.x < TEXTS_MIN_SIZE ) if( m_Size.x < TEXTS_MIN_SIZE )
......
...@@ -107,9 +107,9 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const ...@@ -107,9 +107,9 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
fprintf( aFile, "$CZONE_OUTLINE\n" ); fprintf( aFile, "$CZONE_OUTLINE\n" );
// Save the outline main info // Save the outline main info
ret = fprintf( aFile, "ZInfo %8.8lX %d \"%s\"\n", ret = fprintf( aFile, "ZInfo %8.8lX %d %s\n",
m_TimeStamp, m_NetCode, m_TimeStamp, m_NetCode,
TO_UTF8( m_Netname ) ); EscapedUTF8( m_Netname ).c_str() );
if( ret < 3 ) if( ret < 3 )
return false; return false;
......
...@@ -386,17 +386,14 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event ) ...@@ -386,17 +386,14 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
Module = (MODULE*) GetBoard()->m_Modules; Module = (MODULE*) GetBoard()->m_Modules;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
sprintf( line, "$MODULE \"%s\"\n", sprintf( line, "$MODULE %s\n", EscapedUTF8( Module->m_Reference->m_Text ).c_str() );
TO_UTF8( Module->m_Reference->m_Text ) );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "reference \"%s\"\n", sprintf( line, "reference %s\n", EscapedUTF8( Module->m_Reference->m_Text ).c_str() );
TO_UTF8( Module->m_Reference->m_Text ) );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "value \"%s\"\n", sprintf( line, "value %s\n", EscapedUTF8( Module->m_Value->m_Text ).c_str() );
TO_UTF8( Module->m_Value->m_Text ) );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "footprint \"%s\"\n", TO_UTF8( Module->m_LibRef ) ); sprintf( line, "footprint %s\n", EscapedUTF8( Module->m_LibRef ).c_str() );
fputs( line, rptfile ); fputs( line, rptfile );
msg = wxT( "attribut" ); msg = wxT( "attribut" );
......
...@@ -830,14 +830,14 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File ) ...@@ -830,14 +830,14 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
fprintf( File, "$SHEETDESCR\n" ); fprintf( File, "$SHEETDESCR\n" );
fprintf( File, "Sheet %s %d %d\n", fprintf( File, "Sheet %s %d %d\n",
TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y ); TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y );
fprintf( File, "Title \"%s\"\n", TO_UTF8( screen->m_Title ) ); fprintf( File, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
fprintf( File, "Date \"%s\"\n", TO_UTF8( screen->m_Date ) ); fprintf( File, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
fprintf( File, "Rev \"%s\"\n", TO_UTF8( screen->m_Revision ) ); fprintf( File, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
fprintf( File, "Comp \"%s\"\n", TO_UTF8( screen->m_Company ) ); fprintf( File, "Comp %s\n", EscapedUTF8( screen->m_Company ).c_str() );
fprintf( File, "Comment1 \"%s\"\n", TO_UTF8( screen->m_Commentaire1 ) ); fprintf( File, "Comment1 %s\n", EscapedUTF8( screen->m_Commentaire1 ).c_str() );
fprintf( File, "Comment2 \"%s\"\n", TO_UTF8( screen->m_Commentaire2 ) ); fprintf( File, "Comment2 %s\n", EscapedUTF8( screen->m_Commentaire2 ).c_str() );
fprintf( File, "Comment3 \"%s\"\n", TO_UTF8( screen->m_Commentaire3 ) ); fprintf( File, "Comment3 %s\n", EscapedUTF8( screen->m_Commentaire3 ).c_str() );
fprintf( File, "Comment4 \"%s\"\n", TO_UTF8( screen->m_Commentaire4 ) ); fprintf( File, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
fprintf( File, "$EndSHEETDESCR\n\n" ); fprintf( File, "$EndSHEETDESCR\n\n" );
return TRUE; return TRUE;
......
release version: release version:
2011 mar 17 2011 mar 17
files (.zip,.tgz): files (.zip,.tgz):
kicad-2011-03-23 kicad-2011-03-25
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment