Use UTF-8 encoding only in kicad files. Under Linux, this was already the case. Under Windows, texts with non ascii characters must be corrected.

This ensure compatibility between platforms.
This commit is contained in:
jean-pierre charras 2011-02-28 19:36:19 +01:00
parent ffa9feda69
commit 92952b70aa
82 changed files with 2329 additions and 2331 deletions

View File

@ -789,7 +789,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
default: default:
s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape ); s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape );
D( printf( "%s", CONV_TO_UTF8( s ) ); ) D( printf( "%s", TO_UTF8( s ) ); )
break; break;
} }
} }
@ -837,7 +837,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
default: default:
s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape ); s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape );
D( printf( "%s", CONV_TO_UTF8( s ) ); ) D( printf( "%s", TO_UTF8( s ) ); )
break; break;
} }
} }

View File

@ -97,7 +97,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
command = strtok( NULL, " \t\n\r" ); command = strtok( NULL, " \t\n\r" );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, " \t\n\r" );
mat_name = CONV_FROM_UTF8( text ); mat_name = FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 ) if( stricmp( command, "USE" ) == 0 )
{ {
for( material = m_Materials; material; material = material->Next() ) for( material = m_Materials; material; material = material->Next() )

View File

@ -379,7 +379,7 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
tmp = wxT( "Application: " ) + wxGetApp().GetTitle() + wxT( "\n" ); tmp = wxT( "Application: " ) + wxGetApp().GetTitle() + wxT( "\n" );
tmp += wxT( "Version: " ) + GetBuildVersion() + wxT( "\n" ); tmp += wxT( "Version: " ) + GetBuildVersion() + wxT( "\n" );
tmp << wxT( "Build: " ) << wxVERSION_STRING tmp << wxT( "Build: " ) << wxVERSION_STRING
<< CONV_FROM_UTF8( KICAD_BUILD_OPTIONS_SIGNATURE() ) << wxT( "\n" ) << FROM_UTF8( KICAD_BUILD_OPTIONS_SIGNATURE() ) << wxT( "\n" )
<< wxT( "Platform: " ) << wxGetOsDescription() << wxT( ", " ) << wxT( "Platform: " ) << wxGetOsDescription() << wxT( ", " )
<< info.GetArchName() << wxT( ", " ) << info.GetEndiannessName() << wxT( ", " ) << info.GetArchName() << wxT( ", " ) << info.GetEndiannessName() << wxT( ", " )
<< info.GetPortIdName(); << info.GetPortIdName();

View File

@ -39,7 +39,7 @@ bool DXF_PLOTTER::start_plot( FILE* fout )
{ {
wxString cname = ColorRefs[i].m_Name; wxString cname = ColorRefs[i].m_Name;
fprintf( output_file, "0\nLAYER\n2\n%s\n70\n0\n62\n%d\n6\nCONTINUOUS\n", fprintf( output_file, "0\nLAYER\n2\n%s\n70\n0\n62\n%d\n6\nCONTINUOUS\n",
CONV_TO_UTF8( cname ), i + 1 ); TO_UTF8( cname ), i + 1 );
} }
/* End of layer table, begin entities */ /* End of layer table, begin entities */
@ -97,17 +97,17 @@ void DXF_PLOTTER::circle( wxPoint centre, int diameter, FILL_T fill, int width )
wxString cname = ColorRefs[current_color].m_Name; wxString cname = ColorRefs[current_color].m_Name;
if (!fill) { if (!fill) {
fprintf( output_file, "0\nCIRCLE\n8\n%s\n10\n%d.0\n20\n%d.0\n40\n%g\n", fprintf( output_file, "0\nCIRCLE\n8\n%s\n10\n%d.0\n20\n%d.0\n40\n%g\n",
CONV_TO_UTF8( cname ), TO_UTF8( cname ),
centre.x, centre.y, radius ); centre.x, centre.y, radius );
} }
if (fill == FILLED_SHAPE) { if (fill == FILLED_SHAPE) {
int r = (int)(radius*0.5); int r = (int)(radius*0.5);
fprintf( output_file, "0\nPOLYLINE\n"); fprintf( output_file, "0\nPOLYLINE\n");
fprintf( output_file, "8\n%s\n66\n1\n70\n1\n", CONV_TO_UTF8( cname )); fprintf( output_file, "8\n%s\n66\n1\n70\n1\n", TO_UTF8( cname ));
fprintf( output_file, "40\n%g\n41\n%g\n", radius,radius); fprintf( output_file, "40\n%g\n41\n%g\n", radius,radius);
fprintf( output_file, "0\nVERTEX\n8\n%s\n", CONV_TO_UTF8( cname )); fprintf( output_file, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
fprintf( output_file, "10\n%d.0\n 20\n%d.0\n42\n1.0\n", centre.x-r,centre.y); fprintf( output_file, "10\n%d.0\n 20\n%d.0\n42\n1.0\n", centre.x-r,centre.y);
fprintf( output_file, "0\nVERTEX\n8\n%s\n", CONV_TO_UTF8( cname )); fprintf( output_file, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
fprintf( output_file, "10\n%d.0\n 20\n%d.0\n42\n1.0\n", centre.x+r,centre.y); fprintf( output_file, "10\n%d.0\n 20\n%d.0\n42\n1.0\n", centre.x+r,centre.y);
fprintf( output_file, "0\nSEQEND\n"); fprintf( output_file, "0\nSEQEND\n");
} }
@ -160,7 +160,7 @@ void DXF_PLOTTER::pen_to( wxPoint pos, char plume )
/* DXF LINE */ /* DXF LINE */
wxString cname = ColorRefs[current_color].m_Name; wxString cname = ColorRefs[current_color].m_Name;
fprintf( output_file, "0\nLINE\n8\n%s\n10\n%d.0\n20\n%d.0\n11\n%d.0\n21\n%d.0\n", fprintf( output_file, "0\nLINE\n8\n%s\n10\n%d.0\n20\n%d.0\n11\n%d.0\n21\n%d.0\n",
CONV_TO_UTF8( cname ), TO_UTF8( cname ),
pen_lastpos.x, pen_lastpos.y, pos.x, pos.y ); pen_lastpos.x, pen_lastpos.y, pos.x, pos.y );
} }
pen_lastpos = pos; pen_lastpos = pos;
@ -214,7 +214,7 @@ void DXF_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
wxString cname = ColorRefs[current_color].m_Name; wxString cname = ColorRefs[current_color].m_Name;
fprintf( output_file, fprintf( output_file,
"0\nARC\n8\n%s\n10\n%d.0\n20\n%d.0\n40\n%d.0\n50\n%d.0\n51\n%d.0\n", "0\nARC\n8\n%s\n10\n%d.0\n20\n%d.0\n40\n%d.0\n50\n%d.0\n51\n%d.0\n",
CONV_TO_UTF8( cname ), TO_UTF8( cname ),
centre.x, centre.y, radius, centre.x, centre.y, radius,
StAngle / 10, EndAngle / 10 ); StAngle / 10, EndAngle / 10 );
} }

View File

@ -60,7 +60,7 @@ bool GERBER_PLOTTER::start_plot( FILE* aFile )
DateAndTime( Line ); DateAndTime( Line );
wxString Title = creator + wxT( " " ) + GetBuildVersion(); wxString Title = creator + wxT( " " ) + GetBuildVersion();
fprintf( output_file, "G04 (created by %s) date %s*\n", fprintf( output_file, "G04 (created by %s) date %s*\n",
CONV_TO_UTF8( Title ), Line ); TO_UTF8( Title ), Line );
// Specify linear interpol (G01), unit = INCH (G70), abs format (G90): // Specify linear interpol (G01), unit = INCH (G70), abs format (G90):
fputs( "G01*\nG70*\nG90*\n", output_file ); fputs( "G01*\nG70*\nG90*\n", output_file );

View File

@ -293,12 +293,12 @@ bool PS_PLOTTER::start_plot( FILE* fout )
fputs( "%!PS-Adobe-3.0\n", output_file ); // Print header fputs( "%!PS-Adobe-3.0\n", output_file ); // Print header
fprintf( output_file, "%%%%Creator: %s\n", CONV_TO_UTF8( creator ) ); fprintf( output_file, "%%%%Creator: %s\n", TO_UTF8( creator ) );
// A "newline" character ("\n") is not included in the following string, // A "newline" character ("\n") is not included in the following string,
// because it is provided by the ctime() function. // because it is provided by the ctime() function.
fprintf( output_file, "%%%%CreationDate: %s", ctime( &time1970 ) ); fprintf( output_file, "%%%%CreationDate: %s", ctime( &time1970 ) );
fprintf( output_file, "%%%%Title: %s\n", CONV_TO_UTF8( filename ) ); fprintf( output_file, "%%%%Title: %s\n", TO_UTF8( filename ) );
fprintf( output_file, "%%%%Pages: 1\n" ); fprintf( output_file, "%%%%Pages: 1\n" );
fprintf( output_file, "%%%%PageOrder: Ascend\n" ); fprintf( output_file, "%%%%PageOrder: Ascend\n" );
@ -333,7 +333,7 @@ bool PS_PLOTTER::start_plot( FILE* fout )
else // ( if sheet->m_Name does not equal "User" ) else // ( if sheet->m_Name does not equal "User" )
fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n", fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
CONV_TO_UTF8( sheet->m_Name ), TO_UTF8( sheet->m_Name ),
wxRound( sheet->m_Size.y * 10 * CONV_SCALE ), wxRound( sheet->m_Size.y * 10 * CONV_SCALE ),
wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) ); wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) );

View File

@ -411,7 +411,7 @@ bool WinEDA_App::SetBinDir()
native_str = new char[len]; native_str = new char[len];
CFStringGetCString( str, native_str, len, kCFStringEncodingUTF8 ); CFStringGetCString( str, native_str, len, kCFStringEncodingUTF8 );
m_BinDir = CONV_FROM_UTF8( native_str ); m_BinDir = FROM_UTF8( native_str );
delete[] native_str; delete[] native_str;
/* Linux and Unix */ /* Linux and Unix */
@ -431,7 +431,7 @@ bool WinEDA_App::SetBinDir()
str_arg0 = argv[0]; str_arg0 = argv[0];
if( strchr( (const char*) argv[0], '/' ) == NULL ) // no path if( strchr( (const char*) argv[0], '/' ) == NULL ) // no path
{ {
sprintf( FileName, "which %s > %s", CONV_TO_UTF8( str_arg0 ), TMP_FILE ); sprintf( FileName, "which %s > %s", TO_UTF8( str_arg0 ), TMP_FILE );
ii = system( FileName ); ii = system( FileName );
if( ( ftmp = fopen( TMP_FILE, "rt" ) ) != NULL ) if( ( ftmp = fopen( TMP_FILE, "rt" ) ) != NULL )
@ -440,7 +440,7 @@ bool WinEDA_App::SetBinDir()
fclose( ftmp ); fclose( ftmp );
remove( TMP_FILE ); remove( TMP_FILE );
} }
m_BinDir = CONV_FROM_UTF8( Line ); m_BinDir = FROM_UTF8( Line );
} }
else else
m_BinDir = argv[0]; m_BinDir = argv[0];

View File

@ -101,7 +101,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
line += 7; line += 7;
FOOTPRINT_INFO* ItemLib = new FOOTPRINT_INFO(); FOOTPRINT_INFO* ItemLib = new FOOTPRINT_INFO();
ItemLib->m_Module = CONV_FROM_UTF8( StrPurge( line ) ); ItemLib->m_Module = FROM_UTF8( StrPurge( line ) );
ItemLib->m_LibName = libname; ItemLib->m_LibName = libname;
AddItem( ItemLib ); AddItem( ItemLib );
@ -117,12 +117,12 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
{ {
/* KeyWords */ /* KeyWords */
case (('K'<<8) + 'w'): case (('K'<<8) + 'w'):
ItemLib->m_KeyWord = CONV_FROM_UTF8( StrPurge( line + 3 ) ); ItemLib->m_KeyWord = FROM_UTF8( StrPurge( line + 3 ) );
break; break;
/* Doc */ /* Doc */
case (('C'<<8) + 'd'): case (('C'<<8) + 'd'):
ItemLib->m_Doc = CONV_FROM_UTF8( StrPurge( line + 3 ) ); ItemLib->m_Doc = FROM_UTF8( StrPurge( line + 3 ) );
break; break;
} }
} }

View File

@ -265,10 +265,10 @@ wxString EDA_FileSelector( const wxString& Title,
#if 0 && defined (DEBUG) #if 0 && defined (DEBUG)
printf( "defaultpath=\"%s\" defaultname=\"%s\" Ext=\"%s\" Mask=\"%s\" flag=%d keep_working_directory=%d\n", printf( "defaultpath=\"%s\" defaultname=\"%s\" Ext=\"%s\" Mask=\"%s\" flag=%d keep_working_directory=%d\n",
CONV_TO_UTF8( defaultpath ), TO_UTF8( defaultpath ),
CONV_TO_UTF8( defaultname ), TO_UTF8( defaultname ),
CONV_TO_UTF8( Ext ), TO_UTF8( Ext ),
CONV_TO_UTF8( Mask ), TO_UTF8( Mask ),
flag, flag,
keep_working_directory ); keep_working_directory );
#endif #endif

View File

@ -422,7 +422,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD
{ {
FILE* file = wxFopen( *aFullFileName, wxT( "wt" ) ); FILE* file = wxFopen( *aFullFileName, wxT( "wt" ) );
if( file ) if( file )
fputs( CONV_TO_UTF8( msg ), file ); fputs( TO_UTF8( msg ), file );
else else
{ {
msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) ); msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) );

View File

@ -133,7 +133,7 @@ char* DateAndTime( char* aBuffer )
wxString datetime; wxString datetime;
datetime = DateAndTime(); datetime = DateAndTime();
strcpy( aBuffer, CONV_TO_UTF8( datetime ) ); strcpy( aBuffer, TO_UTF8( datetime ) );
return aBuffer; return aBuffer;
} }

View File

@ -44,8 +44,8 @@ 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", fprintf( FileEquiv, "comp = \"%s\" module = \"%s\"\n",
CONV_TO_UTF8( component.m_Reference ), TO_UTF8( component.m_Reference ),
CONV_TO_UTF8( component.m_Module ) ); TO_UTF8( component.m_Module ) );
} }
fclose( FileEquiv ); fclose( FileEquiv );

View File

@ -96,7 +96,7 @@ found in the default search paths." ),
break; break;
StrPurge( Line ); StrPurge( Line );
if( stricmp( Line, CONV_TO_UTF8( CmpName ) ) == 0 ) if( stricmp( Line, TO_UTF8( CmpName ) ) == 0 )
{ {
Found = 1; Found = 1;
break; break;
@ -119,7 +119,7 @@ found in the default search paths." ),
/* Read component name. */ /* Read component name. */
sscanf( Line + 7, " %s", Name ); sscanf( Line + 7, " %s", Name );
if( stricmp( Name, CONV_TO_UTF8( CmpName ) ) == 0 ) if( stricmp( Name, TO_UTF8( CmpName ) ) == 0 )
{ {
Module = new MODULE( GetBoard() ); Module = new MODULE( GetBoard() );
// Switch the locale to standard C (needed to print floating // Switch the locale to standard C (needed to print floating

View File

@ -134,7 +134,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
if( idx != 0 ) if( idx != 0 )
{ {
wxString msg, Lineconv = CONV_FROM_UTF8( Line ); wxString msg, Lineconv = FROM_UTF8( Line );
msg.Printf( _( "Unknown file format <%s>" ), Lineconv.GetData() ); msg.Printf( _( "Unknown file format <%s>" ), Lineconv.GetData() );
DisplayError( this, msg ); DisplayError( this, msg );
return -3; return -3;
@ -185,7 +185,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
while( Line[idx] != ' ' && Line[idx] ) while( Line[idx] != ' ' && Line[idx] )
cbuffer[jj++] = Line[idx++]; cbuffer[jj++] = Line[idx++];
cbuffer[jj] = 0; cbuffer[jj] = 0;
Cmp->m_TimeStamp = CONV_FROM_UTF8(cbuffer); Cmp->m_TimeStamp = FROM_UTF8(cbuffer);
/* search val/ref.lib */ /* search val/ref.lib */
while( Line[idx] == ' ' ) while( Line[idx] == ' ' )
@ -197,7 +197,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
if( ptchar == 0 ) if( ptchar == 0 )
{ {
wxString msg = _( "Netlist error: " ); wxString msg = _( "Netlist error: " );
msg << CONV_FROM_UTF8( Line ); msg << FROM_UTF8( Line );
DisplayError( this, msg ); DisplayError( this, msg );
k = 0; k = 0;
} }
@ -213,7 +213,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
cbuffer[jj] = 0; cbuffer[jj] = 0;
// Copy footprint name: // Copy footprint name:
if( m_isEESchemaNetlist && strnicmp( cbuffer, "$noname", 7 ) != 0 ) if( m_isEESchemaNetlist && strnicmp( cbuffer, "$noname", 7 ) != 0 )
Cmp->m_Module = CONV_FROM_UTF8(cbuffer); Cmp->m_Module = FROM_UTF8(cbuffer);
if( (Line[++idx] == '(') && (Line[k - 1] == ')' ) ) if( (Line[++idx] == '(') && (Line[k - 1] == ')' ) )
{ {
@ -240,7 +240,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
cbuffer[jj++] = Line[idx]; cbuffer[jj++] = Line[idx];
} }
cbuffer[jj] = 0; cbuffer[jj] = 0;
Cmp->m_Reference = CONV_FROM_UTF8(cbuffer); Cmp->m_Reference = FROM_UTF8(cbuffer);
/* Search component value */ /* Search component value */
while( Line[idx] == ' ' && Line[idx] ) while( Line[idx] == ' ' && Line[idx] )
@ -255,7 +255,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
cbuffer[jj++] = Line[idx]; cbuffer[jj++] = Line[idx];
} }
cbuffer[jj] = 0; cbuffer[jj] = 0;
Cmp->m_Value = CONV_FROM_UTF8(cbuffer); Cmp->m_Value = FROM_UTF8(cbuffer);
m_components.push_back( Cmp ); m_components.push_back( Cmp );
@ -288,7 +288,7 @@ int ReadFootprintFilterList( FILE_LINE_READER& aNetlistReader, COMPONENT_LIST&
if( strnicmp( Line, "$component", 10 ) == 0 ) // New component ref found if( strnicmp( Line, "$component", 10 ) == 0 ) // New component ref found
{ {
CmpRef = CONV_FROM_UTF8( Line + 11 ); CmpRef = FROM_UTF8( Line + 11 );
CmpRef.Trim( true ); CmpRef.Trim( true );
CmpRef.Trim( false ); CmpRef.Trim( false );
@ -302,7 +302,7 @@ int ReadFootprintFilterList( FILE_LINE_READER& aNetlistReader, COMPONENT_LIST&
} }
else if( Cmp ) else if( Cmp )
{ {
wxString fp = CONV_FROM_UTF8( Line + 1 ); wxString fp = FROM_UTF8( Line + 1 );
fp.Trim( false ); fp.Trim( false );
fp.Trim( true ); fp.Trim( true );
Cmp->m_FootprintFilter.Add( fp ); Cmp->m_FootprintFilter.Add( fp );
@ -355,7 +355,7 @@ int ReadPinConnection( FILE_LINE_READER& aNetlistReader, COMPONENT* Cmp )
cbuffer[jj++] = Line[i]; cbuffer[jj++] = Line[i];
} }
cbuffer[jj] = 0; cbuffer[jj] = 0;
Pin->m_Number = CONV_FROM_UTF8(cbuffer); Pin->m_Number = FROM_UTF8(cbuffer);
/* Read netname */ /* Read netname */
while( Line[i] == ' ' ) while( Line[i] == ' ' )
@ -368,7 +368,7 @@ int ReadPinConnection( FILE_LINE_READER& aNetlistReader, COMPONENT* Cmp )
cbuffer[jj++] = Line[i]; cbuffer[jj++] = Line[i];
} }
cbuffer[jj] = 0; cbuffer[jj] = 0;
Pin->m_Net = CONV_FROM_UTF8(cbuffer); Pin->m_Net = FROM_UTF8(cbuffer);
Cmp->m_Pins.push_back( Pin ); Cmp->m_Pins.push_back( Pin );
} }

View File

@ -43,20 +43,20 @@ int CVPCB_MAINFRAME::SaveComponentList( const wxString& NetlistFullFileName )
return 0; return 0;
fprintf( dest, "%s", EnteteCmpMod ); fprintf( dest, "%s", EnteteCmpMod );
fprintf( dest, " Created by %s", CONV_TO_UTF8( Title ) ); fprintf( dest, " Created by %s", TO_UTF8( Title ) );
fprintf( dest, " date = %s\n", DateAndTime( Line ) ); fprintf( dest, " date = %s\n", DateAndTime( Line ) );
BOOST_FOREACH( COMPONENT& component, m_components ) BOOST_FOREACH( COMPONENT& component, m_components )
{ {
fprintf( dest, "\nBeginCmp\n" ); fprintf( dest, "\nBeginCmp\n" );
fprintf( dest, "TimeStamp = %s;\n", fprintf( dest, "TimeStamp = %s;\n",
CONV_TO_UTF8( component.m_TimeStamp ) ); TO_UTF8( component.m_TimeStamp ) );
fprintf( dest, "Reference = %s;\n", fprintf( dest, "Reference = %s;\n",
CONV_TO_UTF8( component.m_Reference ) ); TO_UTF8( component.m_Reference ) );
fprintf( dest, "ValeurCmp = %s;\n", fprintf( dest, "ValeurCmp = %s;\n",
CONV_TO_UTF8( component.m_Value ) ); TO_UTF8( component.m_Value ) );
fprintf( dest, "IdModule = %s;\n", fprintf( dest, "IdModule = %s;\n",
CONV_TO_UTF8( component.m_Module ) ); TO_UTF8( component.m_Module ) );
fprintf( dest, "EndCmp\n" ); fprintf( dest, "EndCmp\n" );
} }
@ -139,7 +139,7 @@ bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& fileName )
if( strnicmp( ident, "TimeStamp", 9 ) == 0 ) if( strnicmp( ident, "TimeStamp", 9 ) == 0 )
{ {
timestamp = CONV_FROM_UTF8( data ); timestamp = FROM_UTF8( data );
timestamp.Trim( TRUE ); timestamp.Trim( TRUE );
timestamp.Trim( FALSE ); timestamp.Trim( FALSE );
continue; continue;
@ -147,7 +147,7 @@ bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& fileName )
if( strnicmp( ident, "Reference", 9 ) == 0 ) if( strnicmp( ident, "Reference", 9 ) == 0 )
{ {
namecmp = CONV_FROM_UTF8( data ); namecmp = FROM_UTF8( data );
namecmp.Trim( TRUE ); namecmp.Trim( TRUE );
namecmp.Trim( FALSE ); namecmp.Trim( FALSE );
continue; continue;
@ -155,7 +155,7 @@ bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& fileName )
if( strnicmp( ident, "ValeurCmp", 9 ) == 0 ) if( strnicmp( ident, "ValeurCmp", 9 ) == 0 )
{ {
valeur = CONV_FROM_UTF8( data ); valeur = FROM_UTF8( data );
valeur.Trim( TRUE ); valeur.Trim( TRUE );
valeur.Trim( FALSE ); valeur.Trim( FALSE );
continue; continue;
@ -163,7 +163,7 @@ bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& fileName )
if( strnicmp( ident, "IdModule", 8 ) == 0 ) if( strnicmp( ident, "IdModule", 8 ) == 0 )
{ {
ilib = CONV_FROM_UTF8( data ); ilib = FROM_UTF8( data );
ilib.Trim( TRUE ); ilib.Trim( TRUE );
ilib.Trim( FALSE ); ilib.Trim( FALSE );
continue; continue;

View File

@ -79,17 +79,17 @@ int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
BOOST_FOREACH( COMPONENT& component, m_components ) BOOST_FOREACH( COMPONENT& component, m_components )
{ {
fprintf( file, " ( %s ", CONV_TO_UTF8( component.m_TimeStamp ) ); fprintf( file, " ( %s ", TO_UTF8( component.m_TimeStamp ) );
if( !component.m_Module.IsEmpty() ) if( !component.m_Module.IsEmpty() )
fprintf( file, "%s", CONV_TO_UTF8( component.m_Module ) ); fprintf( file, "%s", TO_UTF8( component.m_Module ) );
else else
fprintf( file, "$noname$" ); fprintf( file, "$noname$" );
fprintf( file, " %s ", CONV_TO_UTF8( component.m_Reference ) ); fprintf( file, " %s ", TO_UTF8( component.m_Reference ) );
fprintf( file, "%s\n", CONV_TO_UTF8( component.m_Value ) ); fprintf( file, "%s\n", TO_UTF8( component.m_Value ) );
component.m_Pins.sort(); component.m_Pins.sort();
RemoveDuplicatePins( component ); RemoveDuplicatePins( component );
@ -98,10 +98,10 @@ int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
{ {
if( !pin.m_Net.IsEmpty() ) if( !pin.m_Net.IsEmpty() )
fprintf( file, " ( %s %s )\n", fprintf( file, " ( %s %s )\n",
CONV_TO_UTF8( pin.m_Number ), TO_UTF8( pin.m_Number ),
CONV_TO_UTF8( pin.m_Net ) ); TO_UTF8( pin.m_Net ) );
else else
fprintf( file, " ( %s ? )\n", CONV_TO_UTF8( pin.m_Number ) ); fprintf( file, " ( %s ? )\n", TO_UTF8( pin.m_Number ) );
} }
fprintf( file, " )\n" ); fprintf( file, " )\n" );
@ -136,12 +136,12 @@ void WriteFootprintFilterInfos( FILE* file, COMPONENT_LIST& list )
WriteHeader = TRUE; WriteHeader = TRUE;
} }
fprintf( file, "$component %s\n", fprintf( file, "$component %s\n",
CONV_TO_UTF8( component.m_Reference ) ); TO_UTF8( component.m_Reference ) );
/* Write the footprint list */ /* Write the footprint list */
for( unsigned int jj = 0; jj < FilterCount; jj++ ) for( unsigned int jj = 0; jj < FilterCount; jj++ )
{ {
fprintf( file, " %s\n", fprintf( file, " %s\n",
CONV_TO_UTF8( component.m_FootprintFilter[jj] ) ); TO_UTF8( component.m_FootprintFilter[jj] ) );
} }
fprintf( file, "$endlist\n" ); fprintf( file, "$endlist\n" );

View File

@ -102,8 +102,8 @@ bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aFilename, bool aSetFieldAttributeT
if( *cp == '"' ) if( *cp == '"' )
*cp = 0; *cp = 0;
wxString reference = CONV_FROM_UTF8( Ref ); wxString reference = FROM_UTF8( Ref );
wxString Footprint = CONV_FROM_UTF8( FootPrint ); wxString Footprint = FROM_UTF8( FootPrint );
FillFootprintFieldForAllInstancesofComponent( reference, FillFootprintFieldForAllInstancesofComponent( reference,
Footprint, Footprint,
aSetFieldAttributeToVisible ); aSetFieldAttributeToVisible );

View File

@ -154,7 +154,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
(float) label->m_Pos.x / 1000, (float) label->m_Pos.x / 1000,
(float) label->m_Pos.y / 1000 ); (float) label->m_Pos.y / 1000 );
fputs( CONV_TO_UTF8( msg ), f ); fputs( TO_UTF8( msg ), f );
break; break;
case SCH_SHEET_LABEL_T: case SCH_SHEET_LABEL_T:
@ -168,7 +168,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
if( jj > NET_TMAX ) if( jj > NET_TMAX )
jj = 4; jj = 4;
wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] ); wxString labtype = FROM_UTF8( SheetLabelType[jj] );
msg.Printf( _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ), msg.Printf( _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
GetChars( pinsheet->m_Text ), GetChars( pinsheet->m_Text ),
@ -177,7 +177,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
(float) pinsheet->m_Pos.x / 1000, (float) pinsheet->m_Pos.x / 1000,
(float) pinsheet->m_Pos.y / 1000 ); (float) pinsheet->m_Pos.y / 1000 );
fputs( CONV_TO_UTF8( msg ), f ); fputs( TO_UTF8( msg ), f );
} }
break; break;
@ -187,6 +187,6 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
} }
msg = _( "#End labels\n" ); msg = _( "#End labels\n" );
fputs( CONV_TO_UTF8( msg ), f ); fputs( TO_UTF8( msg ), f );
return 0; return 0;
} }

View File

@ -106,19 +106,19 @@ bool LIB_ALIAS::SaveDoc( FILE* aFile )
if( description.IsEmpty() && keyWords.IsEmpty() && docFileName.IsEmpty() ) if( description.IsEmpty() && keyWords.IsEmpty() && docFileName.IsEmpty() )
return true; return true;
if( fprintf( aFile, "#\n$CMP %s\n", CONV_TO_UTF8( name ) ) < 0 ) if( fprintf( aFile, "#\n$CMP %s\n", TO_UTF8( name ) ) < 0 )
return false; return false;
if( ! description.IsEmpty() if( ! description.IsEmpty()
&& fprintf( aFile, "D %s\n", CONV_TO_UTF8( description ) ) < 0 ) && fprintf( aFile, "D %s\n", TO_UTF8( description ) ) < 0 )
return false; return false;
if( ! keyWords.IsEmpty() if( ! keyWords.IsEmpty()
&& fprintf( aFile, "K %s\n", CONV_TO_UTF8( keyWords ) ) < 0 ) && fprintf( aFile, "K %s\n", TO_UTF8( keyWords ) ) < 0 )
return false; return false;
if( ! docFileName.IsEmpty() if( ! docFileName.IsEmpty()
&& fprintf( aFile, "F %s\n", CONV_TO_UTF8( docFileName ) ) < 0 ) && fprintf( aFile, "F %s\n", TO_UTF8( docFileName ) ) < 0 )
return false; return false;
if( fprintf( aFile, "$ENDCMP\n" ) < 0 ) if( fprintf( aFile, "$ENDCMP\n" ) < 0 )
@ -539,7 +539,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
LIB_FIELD& value = GetValueField(); LIB_FIELD& value = GetValueField();
/* First line: it s a comment (component name for readers) */ /* First line: it s a comment (component name for readers) */
if( fprintf( aFile, "#\n# %s\n#\n", CONV_TO_UTF8( value.m_Text ) ) < 0 ) if( fprintf( aFile, "#\n# %s\n#\n", TO_UTF8( value.m_Text ) ) < 0 )
return false; return false;
/* Save data */ /* Save data */
@ -548,12 +548,12 @@ bool LIB_COMPONENT::Save( FILE* aFile )
if( value.IsVisible() ) if( value.IsVisible() )
{ {
if( fprintf( aFile, " %s", CONV_TO_UTF8( value.m_Text ) ) < 0 ) if( fprintf( aFile, " %s", TO_UTF8( value.m_Text ) ) < 0 )
return false; return false;
} }
else else
{ {
if( fprintf( aFile, " ~%s", CONV_TO_UTF8( value.m_Text ) ) < 0 ) if( fprintf( aFile, " ~%s", TO_UTF8( value.m_Text ) ) < 0 )
return false; return false;
} }
@ -561,7 +561,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
if( !reference.m_Text.IsEmpty() ) if( !reference.m_Text.IsEmpty() )
{ {
if( fprintf( aFile, " %s", CONV_TO_UTF8( reference.m_Text ) ) < 0 ) if( fprintf( aFile, " %s", TO_UTF8( reference.m_Text ) ) < 0 )
return false; return false;
} }
else else
@ -623,7 +623,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
for( i = 1; i < m_aliases.size(); i++ ) for( i = 1; i < m_aliases.size(); i++ )
{ {
if( fprintf( aFile, " %s", CONV_TO_UTF8( m_aliases[i]->GetName() ) ) < 0 ) if( fprintf( aFile, " %s", TO_UTF8( m_aliases[i]->GetName() ) ) < 0 )
return false; return false;
} }
@ -639,7 +639,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
for( i = 0; i < m_FootprintList.GetCount(); i++ ) for( i = 0; i < m_FootprintList.GetCount(); i++ )
{ {
if( fprintf( aFile, " %s\n", CONV_TO_UTF8( m_FootprintList[i] ) ) < 0 ) if( fprintf( aFile, " %s\n", TO_UTF8( m_FootprintList[i] ) ) < 0 )
return false; return false;
} }
@ -736,11 +736,11 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum, wxString& aEr
strupper( componentName ); strupper( componentName );
if( componentName[0] != '~' ) if( componentName[0] != '~' )
{ {
m_name = value.m_Text = CONV_FROM_UTF8( componentName ); m_name = value.m_Text = FROM_UTF8( componentName );
} }
else else
{ {
m_name = value.m_Text = CONV_FROM_UTF8( &componentName[1] ); m_name = value.m_Text = FROM_UTF8( &componentName[1] );
value.m_Attributs |= TEXT_NO_VISIBLE; value.m_Attributs |= TEXT_NO_VISIBLE;
} }
@ -756,7 +756,7 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum, wxString& aEr
} }
else else
{ {
reference.m_Text = CONV_FROM_UTF8( prefix ); reference.m_Text = FROM_UTF8( prefix );
} }
// Copy optional infos // Copy optional infos
@ -896,7 +896,7 @@ bool LIB_COMPONENT::LoadAliases( char* aLine, wxString& aErrorMsg )
while( text ) while( text )
{ {
m_aliases.push_back( new LIB_ALIAS( CONV_FROM_UTF8( text ), this ) ); m_aliases.push_back( new LIB_ALIAS( FROM_UTF8( text ), this ) );
text = strtok( NULL, " \t\r\n" ); text = strtok( NULL, " \t\r\n" );
} }
@ -953,7 +953,7 @@ bool LIB_COMPONENT::LoadFootprints( FILE* aFile, char* aLine,
if( stricmp( aLine, "$ENDFPLIST" ) == 0 ) if( stricmp( aLine, "$ENDFPLIST" ) == 0 )
break; break;
m_FootprintList.Add( CONV_FROM_UTF8( aLine + 1 ) ); m_FootprintList.Add( FROM_UTF8( aLine + 1 ) );
} }
return true; return true;

View File

@ -431,7 +431,7 @@ bool CMP_LIBRARY::Load( wxString& aErrorMsg )
{ {
wxString tmp; wxString tmp;
header = CONV_FROM_UTF8( line ); header = FROM_UTF8( line );
wxStringTokenizer tkn( header ); wxStringTokenizer tkn( header );
@ -628,7 +628,7 @@ bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg )
/* Read one $CMP/$ENDCMP part entry from library: */ /* Read one $CMP/$ENDCMP part entry from library: */
name = strtok( line + 5, "\n\r" ); name = strtok( line + 5, "\n\r" );
wxString cmpname = CONV_FROM_UTF8( name ); wxString cmpname = FROM_UTF8( name );
entry = FindEntry( cmpname ); entry = FindEntry( cmpname );
@ -643,15 +643,15 @@ bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg )
switch( line[0] ) switch( line[0] )
{ {
case 'D': case 'D':
entry->SetDescription( CONV_FROM_UTF8( text ) ); entry->SetDescription( FROM_UTF8( text ) );
break; break;
case 'K': case 'K':
entry->SetKeyWords( CONV_FROM_UTF8( text ) ); entry->SetKeyWords( FROM_UTF8( text ) );
break; break;
case 'F': case 'F':
entry->SetDocFileName( CONV_FROM_UTF8( text ) ); entry->SetDocFileName( FROM_UTF8( text ) );
break; break;
} }
} }
@ -795,6 +795,10 @@ bool CMP_LIBRARY::SaveHeader( FILE* aFile )
if( fprintf( aFile, "%s %d.%d Date: %s\n", LIBFILE_IDENT, if( fprintf( aFile, "%s %d.%d Date: %s\n", LIBFILE_IDENT,
LIB_VERSION_MAJOR, LIB_VERSION_MINOR, BufLine ) < 0 ) LIB_VERSION_MAJOR, LIB_VERSION_MINOR, BufLine ) < 0 )
succes = false; succes = false;
if( fprintf( aFile, "#encoding utf-8\n") < 0 )
succes = false;
#if 0 #if 0
if( ( fprintf( aFile, "$HEADER\n" ) < 0 ) if( ( fprintf( aFile, "$HEADER\n" ) < 0 )
|| ( fprintf( aFile, "TimeStamp %8.8lX\n", m_TimeStamp ) < 0 ) || ( fprintf( aFile, "TimeStamp %8.8lX\n", m_TimeStamp ) < 0 )

View File

@ -77,7 +77,7 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx )
out << "<netItem ndx=\"" << ndx << '"' << out << "<netItem ndx=\"" << ndx << '"' <<
" type=\"" << ShowType( m_Type ) << '"' << " type=\"" << ShowType( m_Type ) << '"' <<
" netCode=\"" << GetNet() << '"' << " netCode=\"" << GetNet() << '"' <<
" sheet=\"" << CONV_TO_UTF8( path ) << '"' << " sheet=\"" << TO_UTF8( path ) << '"' <<
">\n"; ">\n";
out << " <start " << m_Start << "/> <end " << m_End << "/>\n"; out << " <start " << m_Start << "/> <end " << m_End << "/>\n";

View File

@ -691,9 +691,9 @@ void SCH_REFERENCE::Annotate()
if( m_NumRef < 0 ) if( m_NumRef < 0 )
m_Ref += wxChar( '?' ); m_Ref += wxChar( '?' );
else else
m_Ref = CONV_TO_UTF8( GetRef() << m_NumRef ); m_Ref = TO_UTF8( GetRef() << m_NumRef );
m_RootCmp->SetRef( &m_SheetPath, CONV_FROM_UTF8( m_Ref.c_str() ) ); m_RootCmp->SetRef( &m_SheetPath, FROM_UTF8( m_Ref.c_str() ) );
m_RootCmp->SetUnit( m_Unit ); m_RootCmp->SetUnit( m_Unit );
m_RootCmp->SetUnitSelection( &m_SheetPath, m_Unit ); m_RootCmp->SetUnitSelection( &m_SheetPath, m_Unit );
} }

View File

@ -53,7 +53,7 @@ void RemoteCommand( const char* cmdline )
if( strcmp( idcmd, "$PART:" ) != 0 ) if( strcmp( idcmd, "$PART:" ) != 0 )
return; return;
part_ref = CONV_FROM_UTF8( text ); part_ref = FROM_UTF8( text );
/* look for a complement */ /* look for a complement */
idcmd = strtok( NULL, " \n\r" ); idcmd = strtok( NULL, " \n\r" );
@ -69,7 +69,7 @@ void RemoteCommand( const char* cmdline )
if( text == NULL ) if( text == NULL )
return; return;
msg = CONV_FROM_UTF8( text ); msg = FROM_UTF8( text );
if( strcmp( idcmd, "$REF:" ) == 0 ) if( strcmp( idcmd, "$REF:" ) == 0 )
{ {
@ -112,14 +112,14 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT*
if( LibItem == NULL ) if( LibItem == NULL )
break; break;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
} }
break; break;
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
LibItem = (SCH_COMPONENT*) objectToSync; LibItem = (SCH_COMPONENT*) objectToSync;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
break; break;
@ -133,12 +133,12 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT*
{ {
wxString pinnum; wxString pinnum;
Pin->ReturnPinStringNum( pinnum ); Pin->ReturnPinStringNum( pinnum );
sprintf( Line, "$PIN: %s $PART: %s", CONV_TO_UTF8( pinnum ), sprintf( Line, "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
} }
else else
{ {
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
} }
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );

View File

@ -486,7 +486,7 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion(); wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line ); fprintf( f, "%s >> Creation date: %s\n", TO_UTF8( Title ), Line );
// sort component list // sort component list
cmplist.SortByReferenceOnly(); cmplist.SortByReferenceOnly();
@ -520,7 +520,7 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
( order = Sheet Number ) count = %d\n" ), ( order = Sheet Number ) count = %d\n" ),
itemCount ); itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) ); fprintf( f, "%s", TO_UTF8( msg ) );
PrintListeGLabel( f, listOfLabels ); PrintListeGLabel( f, listOfLabels );
} }
@ -532,13 +532,13 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
order = Alphab. ) count = %d\n\n" ), order = Alphab. ) count = %d\n\n" ),
itemCount ); itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) ); fprintf( f, "%s", TO_UTF8( msg ) );
PrintListeGLabel( f, listOfLabels ); PrintListeGLabel( f, listOfLabels );
} }
} }
msg = _( "\n#End List\n" ); msg = _( "\n#End List\n" );
fprintf( f, "%s", CONV_TO_UTF8( msg ) ); fprintf( f, "%s", TO_UTF8( msg ) );
fclose( f ); fclose( f );
} }
@ -553,12 +553,12 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if( CompactForm ) if( CompactForm )
{ {
fprintf( f, "%c%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) ); TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
} }
else else
{ {
fprintf( f, "; %-12s", fprintf( f, "; %-12s",
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) ); TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
} }
} }
@ -569,10 +569,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if( CompactForm ) if( CompactForm )
fprintf( f, "%c%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) ); TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
else else
fprintf( f, "; %-12s", fprintf( f, "; %-12s",
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) ); TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
} }
} }
@ -611,7 +611,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
msg = _( "Field" ); msg = _( "Field" );
fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 ); fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, TO_UTF8( msg ), ii - FIELD1 + 1 );
} }
fprintf( f, "\n" ); fprintf( f, "\n" );
@ -623,7 +623,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
if( aIncludeSubComponents ) if( aIncludeSubComponents )
msg << _( " (with SubCmp)" ); msg << _( " (with SubCmp)" );
fprintf( f, "%s\n", CONV_TO_UTF8( msg ) ); fprintf( f, "%s\n", TO_UTF8( msg ) );
} }
std::string CmpName; std::string CmpName;
@ -656,26 +656,26 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
CmpName = aList[ii].GetRefStr(); CmpName = aList[ii].GetRefStr();
if( !CompactForm ) if( !CompactForm )
CmpName += CONV_TO_UTF8(subRef); CmpName += TO_UTF8(subRef);
if( CompactForm ) if( CompactForm )
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
fprintf( f, "%s%c%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol, fprintf( f, "%s%c%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ), s_ExportSeparatorSymbol, TO_UTF8( comp->GetField( VALUE )->m_Text ), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) ); TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else #else
fprintf( f, "%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol, fprintf( f, "%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) ); TO_UTF8( comp->GetField( VALUE )->m_Text ) );
#endif #endif
else else
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
fprintf( f, "| %-10s %-12s %-20s", CmpName.c_str(), fprintf( f, "| %-10s %-12s %-20s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ), TO_UTF8( comp->GetField( VALUE )->m_Text ),
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) ); TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else #else
fprintf( f, "| %-10s %-12s", CmpName.c_str(), fprintf( f, "| %-10s %-12s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) ); TO_UTF8( comp->GetField( VALUE )->m_Text ) );
#endif #endif
if( aIncludeSubComponents ) if( aIncludeSubComponents )
@ -687,16 +687,16 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{ {
if( CompactForm ) if( CompactForm )
{ {
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) ); fprintf( f, "%c%s", s_ExportSeparatorSymbol, TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, comp->m_Pos ); msg = m_Parent->GetXYSheetReferences( screen, comp->m_Pos );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol, fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
CONV_TO_UTF8( msg ) ); TO_UTF8( msg ) );
} }
else else
{ {
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, comp->m_Pos ); msg = m_Parent->GetXYSheetReferences( screen, comp->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (loc %s)", TO_UTF8( msg ) );
} }
} }
} }
@ -709,7 +709,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
if( !CompactForm ) if( !CompactForm )
{ {
msg = _( "#End Cmp\n" ); msg = _( "#End Cmp\n" );
fputs( CONV_TO_UTF8( msg ), f ); fputs( TO_UTF8( msg ), f );
} }
return 0; return 0;
@ -816,22 +816,22 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL
continue; continue;
// Print line for the current component value: // Print line for the current component value:
fprintf( f, "%15s%c%3d", CONV_TO_UTF8( valName ), s_ExportSeparatorSymbol, qty ); fprintf( f, "%15s%c%3d", TO_UTF8( valName ), s_ExportSeparatorSymbol, qty );
if( IsFieldChecked(FOOTPRINT ) ) if( IsFieldChecked(FOOTPRINT ) )
fprintf( f, "%c%15s", s_ExportSeparatorSymbol, fprintf( f, "%c%15s", s_ExportSeparatorSymbol,
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
CONV_TO_UTF8( footName ) ); TO_UTF8( footName ) );
#else #else
CONV_TO_UTF8( currCmp->GetField( FOOTPRINT )->m_Text ) ); TO_UTF8( currCmp->GetField( FOOTPRINT )->m_Text ) );
#endif #endif
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
fprintf( f, "%c%20s", s_ExportSeparatorSymbol,CONV_TO_UTF8( datsName ) ); fprintf( f, "%c%20s", s_ExportSeparatorSymbol,TO_UTF8( datsName ) );
#endif #endif
// wrap the field in quotes, since it has commas in it. // wrap the field in quotes, since it has commas in it.
fprintf( f, "%c\"%s\"", s_ExportSeparatorSymbol, CONV_TO_UTF8( refNames ) ); fprintf( f, "%c\"%s\"", s_ExportSeparatorSymbol, TO_UTF8( refNames ) );
// print fields, on demand // print fields, on demand
int last_nonempty_field_idx = 0; int last_nonempty_field_idx = 0;
@ -844,7 +844,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL
{ {
if ( IsFieldChecked( jj ) ) if ( IsFieldChecked( jj ) )
fprintf( f, "%c%4s", s_ExportSeparatorSymbol, fprintf( f, "%c%4s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( dummyCmp.GetField( jj )->m_Text ) ); TO_UTF8( dummyCmp.GetField( jj )->m_Text ) );
} }
fprintf( f, "\n" ); fprintf( f, "\n" );
@ -878,7 +878,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
msg << wxT( "\n" ); msg << wxT( "\n" );
fputs( CONV_TO_UTF8( msg ), f ); fputs( TO_UTF8( msg ), f );
for( unsigned ii = 0; ii < aList.GetCount(); ii++ ) for( unsigned ii = 0; ii < aList.GetCount(); ii++ )
{ {
@ -906,10 +906,10 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
subRef.Empty(); subRef.Empty();
CmpName = aList[ii].GetRefStr(); CmpName = aList[ii].GetRefStr();
CmpName += CONV_TO_UTF8(subRef); CmpName += TO_UTF8(subRef);
fprintf( f, "| %-12s %-10s", fprintf( f, "| %-12s %-10s",
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ), TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ),
CmpName.c_str() ); CmpName.c_str() );
// print the sheet path // print the sheet path
@ -919,9 +919,9 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
if( screen ) if( screen )
{ {
msg = aList[ii].GetSheetPath().PathHumanReadable(); msg = aList[ii].GetSheetPath().PathHumanReadable();
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, DrawLibItem->m_Pos ); msg = m_Parent->GetXYSheetReferences( screen, DrawLibItem->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (loc %s)", TO_UTF8( msg ) );
} }
} }
@ -931,6 +931,6 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
} }
msg = _( "#End Cmp\n" ); msg = _( "#End Cmp\n" );
fputs( CONV_TO_UTF8( msg ), f ); fputs( TO_UTF8( msg ), f );
return 0; return 0;
} }

View File

@ -342,7 +342,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::moveUpButtonHandler( wxCommandEvent& ev
SCH_FIELD tmp = m_FieldsBuf[fieldNdx - 1]; SCH_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
D( printf( "tmp.m_Text=\"%s\" tmp.m_Name=\"%s\"\n", D( printf( "tmp.m_Text=\"%s\" tmp.m_Name=\"%s\"\n",
CONV_TO_UTF8( tmp.m_Text ), CONV_TO_UTF8( tmp.m_Name ) ); ) TO_UTF8( tmp.m_Text ), TO_UTF8( tmp.m_Name ) ); )
m_FieldsBuf[fieldNdx - 1] = m_FieldsBuf[fieldNdx]; m_FieldsBuf[fieldNdx - 1] = m_FieldsBuf[fieldNdx];
setRowItem( fieldNdx - 1, m_FieldsBuf[fieldNdx] ); setRowItem( fieldNdx - 1, m_FieldsBuf[fieldNdx] );
@ -495,7 +495,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i ) for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
{ {
printf( "m_FieldsBuf[%d] (x=%-3d, y=%-3d) name:%s\n", i, m_FieldsBuf[i].m_Pos.x, printf( "m_FieldsBuf[%d] (x=%-3d, y=%-3d) name:%s\n", i, m_FieldsBuf[i].m_Pos.x,
m_FieldsBuf[i].m_Pos.y, CONV_TO_UTF8(m_FieldsBuf[i].m_Name) ); m_FieldsBuf[i].m_Pos.y, TO_UTF8(m_FieldsBuf[i].m_Name) );
} }
#endif #endif

View File

@ -263,8 +263,8 @@ An alias %s already exists!\nCannot update this component" ),
for( unsigned i=0; i<m_FieldsBuf.size(); ++i ) for( unsigned i=0; i<m_FieldsBuf.size(); ++i )
{ {
printf( "save[%d].name:'%s' value:'%s'\n", i, printf( "save[%d].name:'%s' value:'%s'\n", i,
CONV_TO_UTF8( m_FieldsBuf[i].GetName() ), TO_UTF8( m_FieldsBuf[i].GetName() ),
CONV_TO_UTF8( m_FieldsBuf[i].m_Text ) ); TO_UTF8( m_FieldsBuf[i].m_Text ) );
} }
#endif #endif
@ -456,7 +456,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
#if defined(DEBUG) #if defined(DEBUG)
for( unsigned i=0; i<cmpFields.size(); ++i ) for( unsigned i=0; i<cmpFields.size(); ++i )
{ {
printf( "cmpFields[%d].name:%s\n", i, CONV_TO_UTF8( cmpFields[i].GetName() ) ); printf( "cmpFields[%d].name:%s\n", i, TO_UTF8( cmpFields[i].GetName() ) );
} }
#endif #endif
@ -484,7 +484,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
// fixed fields: // fixed fields:
for( int i=0; i<MANDATORY_FIELDS; ++i ) for( int i=0; i<MANDATORY_FIELDS; ++i )
{ {
D( printf( "add fixed:%s\n", CONV_TO_UTF8( cmpFields[i].GetName() ) ); ) D( printf( "add fixed:%s\n", TO_UTF8( cmpFields[i].GetName() ) ); )
m_FieldsBuf.push_back( cmpFields[i] ); m_FieldsBuf.push_back( cmpFields[i] );
} }
@ -509,7 +509,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
// values from the component will be set. // values from the component will be set.
if( !libField ) if( !libField )
{ {
D( printf( "add template:%s\n", CONV_TO_UTF8( it->m_Name ) ); ) D( printf( "add template:%s\n", TO_UTF8( it->m_Name ) ); )
fld.SetName( it->m_Name ); fld.SetName( it->m_Name );
fld.m_Text = it->m_Value; // empty? ok too. fld.m_Text = it->m_Value; // empty? ok too.
@ -521,7 +521,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
} }
else else
{ {
D( printf( "match template:%s\n", CONV_TO_UTF8( libField->GetName() ) ); ) D( printf( "match template:%s\n", TO_UTF8( libField->GetName() ) ); )
fld = *libField; // copy values from component, m_Name too fld = *libField; // copy values from component, m_Name too
} }
@ -537,7 +537,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
if( !buf ) if( !buf )
{ {
D( printf( "add cmp:%s\n", CONV_TO_UTF8( cmp->GetName() ) ); ) D( printf( "add cmp:%s\n", TO_UTF8( cmp->GetName() ) ); )
m_FieldsBuf.push_back( *cmp ); m_FieldsBuf.push_back( *cmp );
} }
} }

View File

@ -203,7 +203,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
for( unsigned i=0; i<tfnames.size(); ++i ) for( unsigned i=0; i<tfnames.size(); ++i )
{ {
D(printf("dlg.SetFieldName(%d, '%s')\n", i, CONV_TO_UTF8( tfnames[i].m_Name) );) D(printf("dlg.SetFieldName(%d, '%s')\n", i, TO_UTF8( tfnames[i].m_Name) );)
dlg.SetFieldName( i, tfnames[i].m_Name ); dlg.SetFieldName( i, tfnames[i].m_Name );
} }
@ -629,7 +629,7 @@ void SCH_EDIT_FRAME::LoadSettings()
if( !templateFieldNames.IsEmpty() ) if( !templateFieldNames.IsEmpty() )
{ {
TEMPLATE_FIELDNAMES_LEXER lexer( CONV_TO_UTF8( templateFieldNames ) ); TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
try try
{ {
m_TemplateFieldNames.Parse( &lexer ); m_TemplateFieldNames.Parse( &lexer );
@ -638,7 +638,7 @@ void SCH_EDIT_FRAME::LoadSettings()
{ {
// @todo show error msg // @todo show error msg
D( printf( "templatefieldnames parsing error: '%s'\n", D( printf( "templatefieldnames parsing error: '%s'\n",
CONV_TO_UTF8( e.errorText ) ); ) TO_UTF8( e.errorText ) ); )
} }
} }
} }
@ -710,7 +710,7 @@ void SCH_EDIT_FRAME::SaveSettings()
m_TemplateFieldNames.Format( &sf, 0 ); m_TemplateFieldNames.Format( &sf, 0 );
wxString record = CONV_FROM_UTF8( sf.GetString().c_str() ); wxString record = FROM_UTF8( sf.GetString().c_str() );
record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
record.Replace( wxT(" "), wxT(" "), true ); // double space to single record.Replace( wxT(" "), wxT(" "), true ); // double space to single

View File

@ -271,7 +271,7 @@ void Diagnose( EDA_DRAW_PANEL* aPanel,
char ascii_buf[5]; char ascii_buf[5];
ascii_buf[4] = 0; ascii_buf[4] = 0;
memcpy( ascii_buf, &aNetItemRef->m_PinNum, 4 ); memcpy( ascii_buf, &aNetItemRef->m_PinNum, 4 );
string_pinnum = CONV_FROM_UTF8( ascii_buf ); string_pinnum = FROM_UTF8( ascii_buf );
cmp_ref = wxT( "?" ); cmp_ref = wxT( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link ) if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
@ -330,7 +330,7 @@ void Diagnose( EDA_DRAW_PANEL* aPanel,
wxString alt_string_pinnum, alt_cmp; wxString alt_string_pinnum, alt_cmp;
memcpy( ascii_buf, &aNetItemTst->m_PinNum, 4 ); memcpy( ascii_buf, &aNetItemTst->m_PinNum, 4 );
alt_string_pinnum = CONV_FROM_UTF8( ascii_buf ); alt_string_pinnum = FROM_UTF8( ascii_buf );
alt_cmp = wxT( "?" ); alt_cmp = wxT( "?" );
if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link ) if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link )
alt_cmp = ( (SCH_COMPONENT*) aNetItemTst->m_Link )->GetRef( alt_cmp = ( (SCH_COMPONENT*) aNetItemTst->m_Link )->GetRef(
@ -511,7 +511,7 @@ bool WriteDiagnosticERC( const wxString& FullFileName )
DateAndTime( Line ); DateAndTime( Line );
msg = _( "ERC report" ); msg = _( "ERC report" );
fprintf( OutErc, "%s (%s)\n", CONV_TO_UTF8( msg ), Line ); fprintf( OutErc, "%s (%s)\n", TO_UTF8( msg ), Line );
SCH_SHEET_LIST SheetList; SCH_SHEET_LIST SheetList;
@ -527,7 +527,7 @@ bool WriteDiagnosticERC( const wxString& FullFileName )
msg.Printf( _( "\n***** Sheet %s\n" ), GetChars( str ) ); msg.Printf( _( "\n***** Sheet %s\n" ), GetChars( str ) );
} }
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) ); fprintf( OutErc, "%s", TO_UTF8( msg ) );
DrawStruct = Sheet->LastDrawList(); DrawStruct = Sheet->LastDrawList();
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
@ -539,12 +539,12 @@ bool WriteDiagnosticERC( const wxString& FullFileName )
if( Marker->GetMarkerType() != MARK_ERC ) if( Marker->GetMarkerType() != MARK_ERC )
continue; continue;
msg = Marker->GetReporter().ShowReport(); msg = Marker->GetReporter().ShowReport();
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) ); fprintf( OutErc, "%s", TO_UTF8( msg ) );
} }
} }
msg.Printf( _( "\n >> Errors ERC: %d\n" ), g_EESchemaVar.NbErrorErc ); msg.Printf( _( "\n >> Errors ERC: %d\n" ), g_EESchemaVar.NbErrorErc );
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) ); fprintf( OutErc, "%s", TO_UTF8( msg ) );
fclose( OutErc ); fclose( OutErc );
return TRUE; return TRUE;

View File

@ -326,7 +326,7 @@ void SCH_EDIT_FRAME::SaveProject()
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ {
D( printf( "SaveEEFile, %s\n", CONV_TO_UTF8( screen->GetFileName() ) ); ) D( printf( "SaveEEFile, %s\n", TO_UTF8( screen->GetFileName() ) ); )
SaveEEFile( screen, FILE_SAVE_AS ); SaveEEFile( screen, FILE_SAVE_AS );
} }

View File

@ -114,7 +114,7 @@ bool LIB_FIELD::Save( FILE* ExportFile )
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, CONV_TO_UTF8( text ), m_Pos.x, m_Pos.y, m_Size.x, m_id, TO_UTF8( text ), 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,
@ -131,7 +131,7 @@ bool LIB_FIELD::Save( FILE* ExportFile )
if( m_id >= FIELD1 && !m_name.IsEmpty() if( m_id >= FIELD1 && !m_name.IsEmpty()
&& m_name != defName && m_name != defName
&& fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_name ) ) < 0 ) && fprintf( ExportFile, " \"%s\"", TO_UTF8( m_name ) ) < 0 )
return false; return false;
if( fprintf( ExportFile, "\n" ) < 0 ) if( fprintf( ExportFile, "\n" ) < 0 )
@ -196,7 +196,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
return false; return false;
} }
m_Text = CONV_FROM_UTF8( text ); m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y; m_Size.x = m_Size.y;
if( textOrient == 'H' ) if( textOrient == 'H' )
@ -271,7 +271,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
else else
{ {
ReadDelimitedText( fieldUserName, line, sizeof( fieldUserName ) ); ReadDelimitedText( fieldUserName, line, sizeof( fieldUserName ) );
m_name = CONV_FROM_UTF8( fieldUserName ); m_name = FROM_UTF8( fieldUserName );
} }
return true; return true;

View File

@ -600,7 +600,7 @@ bool LIB_PIN::Save( FILE* ExportFile )
if( !m_name.IsEmpty() ) if( !m_name.IsEmpty() )
{ {
if( fprintf( ExportFile, "X %s", CONV_TO_UTF8( m_name ) ) < 0 ) if( fprintf( ExportFile, "X %s", TO_UTF8( m_name ) ) < 0 )
return false; return false;
} }
else else
@ -610,7 +610,7 @@ bool LIB_PIN::Save( FILE* ExportFile )
} }
if( fprintf( ExportFile, " %s %d %d %d %c %d %d %d %d %c", if( fprintf( ExportFile, " %s %d %d %d %c %d %d %d %d %c",
CONV_TO_UTF8( StringPinNum ), m_position.x, m_position.y, TO_UTF8( StringPinNum ), m_position.x, m_position.y,
(int) m_length, (int) m_orientation, m_PinNumSize, m_PinNameSize, (int) m_length, (int) m_orientation, m_PinNumSize, m_PinNameSize,
m_Unit, m_Convert, Etype ) < 0 ) m_Unit, m_Convert, Etype ) < 0 )
return false; return false;
@ -674,7 +674,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
m_orientation = pinOrient[0] & 255; m_orientation = pinOrient[0] & 255;
strncpy( (char*) &m_number, pinNum, 4 ); strncpy( (char*) &m_number, pinNum, 4 );
m_name = CONV_FROM_UTF8( pinName ); m_name = FROM_UTF8( pinName );
switch( *pinType & 255 ) switch( *pinType & 255 )
{ {
@ -1562,7 +1562,7 @@ wxString LIB_PIN::ReturnPinStringNum( long aPinNum )
memcpy( ascii_buf, &aPinNum, 4 ); memcpy( ascii_buf, &aPinNum, 4 );
ascii_buf[4] = 0; ascii_buf[4] = 0;
wxString buffer = CONV_FROM_UTF8( ascii_buf ); wxString buffer = FROM_UTF8( ascii_buf );
return buffer; return buffer;
} }

View File

@ -44,7 +44,7 @@ bool LIB_TEXT::Save( FILE* ExportFile )
text.Replace( wxT( " " ), wxT( "~" ) ); text.Replace( wxT( " " ), wxT( "~" ) );
if( fprintf( ExportFile, "T %d %d %d %d %d %d %d %s ", m_Orient, m_Pos.x, m_Pos.y, if( fprintf( ExportFile, "T %d %d %d %d %d %d %d %s ", m_Orient, m_Pos.x, m_Pos.y,
m_Size.x, m_Attributs, m_Unit, m_Convert, CONV_TO_UTF8( text ) ) < 0 ) m_Size.x, m_Attributs, m_Unit, m_Convert, TO_UTF8( text ) ) < 0 )
return false; return false;
if( fprintf( ExportFile, " %s %d", m_Italic ? "Italic" : "Normal", if( fprintf( ExportFile, " %s %d", m_Italic ? "Italic" : "Normal",
( m_Bold > 0 ) ? 1 : 0 ) < 0 ) ( m_Bold > 0 ) ? 1 : 0 ) < 0 )
@ -130,7 +130,7 @@ bool LIB_TEXT::Load( char* line, wxString& errorMsg )
} }
/* Convert '~' to spaces. */ /* Convert '~' to spaces. */
m_Text = CONV_FROM_UTF8( buf ); m_Text = FROM_UTF8( buf );
m_Text.Replace( wxT( "~" ), wxT( " " ) ); m_Text.Replace( wxT( "~" ), wxT( " " ) );
return true; return true;

View File

@ -50,7 +50,7 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFile
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
screen->SetFileName( FullFileName ); screen->SetFileName( FullFileName );
// D(printf("LoadOneEEFile:%s\n", CONV_TO_UTF8( FullFileName ) ); ) // D(printf("LoadOneEEFile:%s\n", TO_UTF8( FullFileName ) ); )
FILE* f; FILE* f;
if( ( f = wxFopen( FullFileName, wxT( "rt" ) ) ) == NULL ) if( ( f = wxFopen( FullFileName, wxT( "rt" ) ) ) == NULL )
@ -184,7 +184,7 @@ again." );
itemLoaded = false; itemLoaded = false;
MsgDiag.Printf( wxT( "EESchema file undefined object at line %d, aborted" ), MsgDiag.Printf( wxT( "EESchema file undefined object at line %d, aborted" ),
reader.LineNumber() ); reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); MsgDiag << wxT( "\n" ) << FROM_UTF8( line );
} }
if( item ) if( item )
@ -287,7 +287,7 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* aScre
sscanf( line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y ); sscanf( line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y );
wxString pagename = CONV_FROM_UTF8( Text ); wxString pagename = FROM_UTF8( Text );
for( ii = 0; SheetFormatList[ii] != NULL; ii++ ) for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
{ {
@ -310,7 +310,7 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* aScre
aMsgDiag.Printf( wxT( "EESchema file dimension definition error \ aMsgDiag.Printf( wxT( "EESchema file dimension definition error \
line %d, \aAbort reading file.\n" ), line %d, \aAbort reading file.\n" ),
aLine->LineNumber() ); aLine->LineNumber() );
aMsgDiag << CONV_FROM_UTF8( line ); aMsgDiag << FROM_UTF8( line );
} }
aScreen->m_CurrentSheetDesc = wsheet; aScreen->m_CurrentSheetDesc = wsheet;
@ -332,56 +332,56 @@ line %d, \aAbort reading file.\n" ),
if( strnicmp( line, "Title", 2 ) == 0 ) if( strnicmp( line, "Title", 2 ) == 0 )
{ {
ReadDelimitedText( buf, line, 256 ); ReadDelimitedText( buf, line, 256 );
aScreen->m_Title = CONV_FROM_UTF8( buf ); aScreen->m_Title = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( line, "Date", 2 ) == 0 ) if( strnicmp( line, "Date", 2 ) == 0 )
{ {
ReadDelimitedText( buf, line, 256 ); ReadDelimitedText( buf, line, 256 );
aScreen->m_Date = CONV_FROM_UTF8( buf ); aScreen->m_Date = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( line, "Rev", 2 ) == 0 ) if( strnicmp( line, "Rev", 2 ) == 0 )
{ {
ReadDelimitedText( buf, line, 256 ); ReadDelimitedText( buf, line, 256 );
aScreen->m_Revision = CONV_FROM_UTF8( buf ); aScreen->m_Revision = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( line, "Comp", 4 ) == 0 ) if( strnicmp( line, "Comp", 4 ) == 0 )
{ {
ReadDelimitedText( buf, line, 256 ); ReadDelimitedText( buf, line, 256 );
aScreen->m_Company = CONV_FROM_UTF8( buf ); aScreen->m_Company = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( line, "Comment1", 8 ) == 0 ) if( strnicmp( line, "Comment1", 8 ) == 0 )
{ {
ReadDelimitedText( buf, line, 256 ); ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire1 = CONV_FROM_UTF8( buf ); aScreen->m_Commentaire1 = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( line, "Comment2", 8 ) == 0 ) if( strnicmp( line, "Comment2", 8 ) == 0 )
{ {
ReadDelimitedText( buf, line, 256 ); ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire2 = CONV_FROM_UTF8( buf ); aScreen->m_Commentaire2 = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( line, "Comment3", 8 ) == 0 ) if( strnicmp( line, "Comment3", 8 ) == 0 )
{ {
ReadDelimitedText( buf, line, 256 ); ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire3 = CONV_FROM_UTF8( buf ); aScreen->m_Commentaire3 = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( line, "Comment4", 8 ) == 0 ) if( strnicmp( line, "Comment4", 8 ) == 0 )
{ {
ReadDelimitedText( buf, line, 256 ); ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire4 = CONV_FROM_UTF8( buf ); aScreen->m_Commentaire4 = FROM_UTF8( buf );
continue; continue;
} }
} }

View File

@ -407,7 +407,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
wxFileName tmpFile = aFullFileName; wxFileName tmpFile = aFullFileName;
tmpFile.SetExt( INTERMEDIATE_NETLIST_EXT ); tmpFile.SetExt( INTERMEDIATE_NETLIST_EXT );
D(printf("tmpFile:'%s'\n", CONV_TO_UTF8( tmpFile.GetFullPath() ) );) D(printf("tmpFile:'%s'\n", TO_UTF8( tmpFile.GetFullPath() ) );)
ret = helper.WriteGENERICNetList( tmpFile.GetFullPath() ); ret = helper.WriteGENERICNetList( tmpFile.GetFullPath() );
if( !ret ) if( !ret )
@ -426,7 +426,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
tmpFile.GetFullPath(), tmpFile.GetFullPath(),
aFullFileName ); aFullFileName );
D(printf("commandLine:'%s'\n", CONV_TO_UTF8( commandLine ) );) D(printf("commandLine:'%s'\n", TO_UTF8( commandLine ) );)
ProcessExecute( commandLine, wxEXEC_SYNC ); ProcessExecute( commandLine, wxEXEC_SYNC );
@ -650,7 +650,7 @@ XNODE* EXPORT_HELP::makeGenericDesignHeader()
// the root sheet is a special sheet, call it source // the root sheet is a special sheet, call it source
xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) ); xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) );
xdesign->AddChild( node( wxT( "date" ), CONV_FROM_UTF8( date )) ); xdesign->AddChild( node( wxT( "date" ), FROM_UTF8( date )) );
// which eeschema tool // which eeschema tool
xdesign->AddChild( node( wxT( "tool" ), wxGetApp().GetAppName() + wxChar(' ') + GetBuildVersion() ) ); xdesign->AddChild( node( wxT( "tool" ), wxGetApp().GetAppName() + wxChar(' ') + GetBuildVersion() ) );
@ -1135,19 +1135,19 @@ bool EXPORT_HELP::WriteGENERICNetList( const wxString& aOutFileName )
ret |= fprintf( out, "\n$BeginComponent\n" ); ret |= fprintf( out, "\n$BeginComponent\n" );
ret |= fprintf( out, "TimeStamp=%8.8lX\n", comp->m_TimeStamp ); ret |= fprintf( out, "TimeStamp=%8.8lX\n", comp->m_TimeStamp );
ret |= fprintf( out, "Footprint=%s\n", CONV_TO_UTF8( footprint ) ); ret |= fprintf( out, "Footprint=%s\n", TO_UTF8( footprint ) );
field = wxT( "Reference=" ) + comp->GetRef( path ) + wxT( "\n" ); field = wxT( "Reference=" ) + comp->GetRef( path ) + wxT( "\n" );
field.Replace( wxT( " " ), wxT( "_" ) ); field.Replace( wxT( " " ), wxT( "_" ) );
ret |= fputs( CONV_TO_UTF8( field ), out ); ret |= fputs( TO_UTF8( field ), out );
field = comp->GetField( VALUE )->m_Text; field = comp->GetField( VALUE )->m_Text;
field.Replace( wxT( " " ), wxT( "_" ) ); field.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( out, "Value=%s\n", CONV_TO_UTF8( field ) ); ret |= fprintf( out, "Value=%s\n", TO_UTF8( field ) );
field = comp->GetLibName(); field = comp->GetLibName();
field.Replace( wxT( " " ), wxT( "_" ) ); field.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( out, "Libref=%s\n", CONV_TO_UTF8( field ) ); ret |= fprintf( out, "Libref=%s\n", TO_UTF8( field ) );
// Write pin list: // Write pin list:
ret |= fprintf( out, "$BeginPinList\n" ); ret |= fprintf( out, "$BeginPinList\n" );
@ -1161,7 +1161,7 @@ bool EXPORT_HELP::WriteGENERICNetList( const wxString& aOutFileName )
if( netname.IsEmpty() ) if( netname.IsEmpty() )
netname = wxT( "?" ); netname = wxT( "?" );
ret |= fprintf( out, "%.4s=%s\n", (char*) &Pin->m_PinNum, CONV_TO_UTF8( netname ) ); ret |= fprintf( out, "%.4s=%s\n", (char*) &Pin->m_PinNum, TO_UTF8( netname ) );
} }
ret |= fprintf( out, "$EndPinList\n" ); ret |= fprintf( out, "$EndPinList\n" );
@ -1269,7 +1269,7 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames )
spiceCommandAtBeginFile[ii].Remove( 0, BUFYPOS_LEN ); spiceCommandAtBeginFile[ii].Remove( 0, BUFYPOS_LEN );
spiceCommandAtBeginFile[ii].Trim( true ); spiceCommandAtBeginFile[ii].Trim( true );
spiceCommandAtBeginFile[ii].Trim( false ); spiceCommandAtBeginFile[ii].Trim( false );
ret |= fprintf( f, "%s\n", CONV_TO_UTF8( spiceCommandAtBeginFile[ii] ) ); ret |= fprintf( f, "%s\n", TO_UTF8( spiceCommandAtBeginFile[ii] ) );
} }
} }
ret |= fprintf( f, "\n" ); ret |= fprintf( f, "\n" );
@ -1288,7 +1288,7 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames )
item = comp; item = comp;
ret |= fprintf( f, "%s ", CONV_TO_UTF8( comp->GetRef( sheet ) ) ); ret |= fprintf( f, "%s ", TO_UTF8( comp->GetRef( sheet ) ) );
// Write pin list: // Write pin list:
for( unsigned ii = 0; ii < m_SortedComponentPinList.size(); ii++ ) for( unsigned ii = 0; ii < m_SortedComponentPinList.size(); ii++ )
@ -1303,7 +1303,7 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames )
netName = wxT( "?" ); netName = wxT( "?" );
if( use_netnames ) if( use_netnames )
ret |= fprintf( f, " %s", CONV_TO_UTF8( netName ) ); ret |= fprintf( f, " %s", TO_UTF8( netName ) );
else // Use number for net names (net number = 0 for "GND") else // Use number for net names (net number = 0 for "GND")
{ {
@ -1316,7 +1316,7 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames )
} }
ret |= fprintf( f, " %s\n", ret |= fprintf( f, " %s\n",
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) ); TO_UTF8( comp->GetField( VALUE )->m_Text ) );
} }
} }
@ -1333,7 +1333,7 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames )
spiceCommandAtEndFile[ii].Remove( 0, +BUFYPOS_LEN ); spiceCommandAtEndFile[ii].Remove( 0, +BUFYPOS_LEN );
spiceCommandAtEndFile[ii].Trim( true ); spiceCommandAtEndFile[ii].Trim( true );
spiceCommandAtEndFile[ii].Trim( false ); spiceCommandAtEndFile[ii].Trim( false );
ret |= fprintf( f, "%s\n", CONV_TO_UTF8( spiceCommandAtEndFile[ii] ) ); ret |= fprintf( f, "%s\n", TO_UTF8( spiceCommandAtEndFile[ii] ) );
} }
} }
@ -1403,20 +1403,20 @@ bool EXPORT_HELP::WriteNetListPCBNEW( FILE* f, bool with_pcbnew )
field = comp->GetRef( path ); field = comp->GetRef( path );
ret |= fprintf( f, " ( %s %s", ret |= fprintf( f, " ( %s %s",
CONV_TO_UTF8( comp->GetPath( path ) ), TO_UTF8( comp->GetPath( path ) ),
CONV_TO_UTF8( footprint ) ); TO_UTF8( footprint ) );
ret |= fprintf( f, " %s", CONV_TO_UTF8( field ) ); ret |= fprintf( f, " %s", TO_UTF8( field ) );
field = comp->GetField( VALUE )->m_Text; field = comp->GetField( VALUE )->m_Text;
field.Replace( wxT( " " ), wxT( "_" ) ); field.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( f, " %s", CONV_TO_UTF8( field ) ); ret |= fprintf( f, " %s", TO_UTF8( field ) );
if( with_pcbnew ) // Add the lib name for this component if( with_pcbnew ) // Add the lib name for this component
{ {
field = comp->GetLibName(); field = comp->GetLibName();
field.Replace( wxT( " " ), wxT( "_" ) ); field.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( f, " {Lib=%s}", CONV_TO_UTF8( field ) ); ret |= fprintf( f, " {Lib=%s}", TO_UTF8( field ) );
} }
ret |= fprintf( f, "\n" ); ret |= fprintf( f, "\n" );
@ -1434,7 +1434,7 @@ bool EXPORT_HELP::WriteNetListPCBNEW( FILE* f, bool with_pcbnew )
netName.Replace( wxT( " " ), wxT( "_" ) ); netName.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( f, " ( %4.4s %s )\n", (char*) &pin->m_PinNum, ret |= fprintf( f, " ( %4.4s %s )\n", (char*) &pin->m_PinNum,
CONV_TO_UTF8( netName ) ); TO_UTF8( netName ) );
} }
ret |= fprintf( f, " )\n" ); ret |= fprintf( f, " )\n" );
@ -1460,12 +1460,12 @@ bool EXPORT_HELP::WriteNetListPCBNEW( FILE* f, bool with_pcbnew )
ref.Replace( wxT( " " ), wxT( "_" ) ); ref.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( f, "$component %s\n", CONV_TO_UTF8( ref ) ); ret |= fprintf( f, "$component %s\n", TO_UTF8( ref ) );
// Write the footprint list // Write the footprint list
for( unsigned jj = 0; jj < entry->GetFootPrints().GetCount(); jj++ ) for( unsigned jj = 0; jj < entry->GetFootPrints().GetCount(); jj++ )
{ {
ret |= fprintf( f, " %s\n", CONV_TO_UTF8( entry->GetFootPrints()[jj] ) ); ret |= fprintf( f, " %s\n", TO_UTF8( entry->GetFootPrints()[jj] ) );
} }
ret |= fprintf( f, "$endlist\n" ); ret |= fprintf( f, "$endlist\n" );
@ -1693,7 +1693,7 @@ bool EXPORT_HELP::writeGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjects
if( ++sameNetcodeCount == 1 ) if( ++sameNetcodeCount == 1 )
{ {
snprintf( firstItemInNet, sizeof(firstItemInNet), " %s %.4s\n", snprintf( firstItemInNet, sizeof(firstItemInNet), " %s %.4s\n",
CONV_TO_UTF8( ref ), TO_UTF8( ref ),
(const char*) &aObjectsList[ii]->m_PinNum ); (const char*) &aObjectsList[ii]->m_PinNum );
} }
@ -1701,12 +1701,12 @@ bool EXPORT_HELP::writeGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjects
// first item // first item
if( sameNetcodeCount == 2 ) if( sameNetcodeCount == 2 )
{ {
ret |= fprintf( f, "%s\n", CONV_TO_UTF8( netcodeName ) ); ret |= fprintf( f, "%s\n", TO_UTF8( netcodeName ) );
ret |= fputs( firstItemInNet, f ); ret |= fputs( firstItemInNet, f );
} }
if( sameNetcodeCount >= 2 ) if( sameNetcodeCount >= 2 )
ret |= fprintf( f, " %s %.4s\n", CONV_TO_UTF8( ref ), ret |= fprintf( f, " %s %.4s\n", TO_UTF8( ref ),
(const char*) &aObjectsList[ii]->m_PinNum ); (const char*) &aObjectsList[ii]->m_PinNum );
} }
@ -1729,11 +1729,11 @@ void EXPORT_HELP::WriteNetListCADSTAR( FILE* f )
SCH_COMPONENT* Component; SCH_COMPONENT* Component;
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion(); wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
fprintf( f, "%sHEA\n", CONV_TO_UTF8( StartLine ) ); fprintf( f, "%sHEA\n", TO_UTF8( StartLine ) );
DateAndTime( Line ); DateAndTime( Line );
fprintf( f, "%sTIM %s\n", CONV_TO_UTF8( StartLine ), Line ); fprintf( f, "%sTIM %s\n", TO_UTF8( StartLine ), Line );
fprintf( f, "%sAPP ", CONV_TO_UTF8( StartLine ) ); fprintf( f, "%sAPP ", TO_UTF8( StartLine ) );
fprintf( f, "\"%s\"\n", CONV_TO_UTF8( Title ) ); fprintf( f, "\"%s\"\n", TO_UTF8( Title ) );
fprintf( f, "\n" ); fprintf( f, "\n" );
// Prepare list of nets generation // Prepare list of nets generation
@ -1765,12 +1765,12 @@ void EXPORT_HELP::WriteNetListCADSTAR( FILE* f )
*/ */
msg = Component->GetRef( sheet ); msg = Component->GetRef( sheet );
fprintf( f, "%s ", CONV_TO_UTF8( StartCmpDesc ) ); fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
fprintf( f, "%s", CONV_TO_UTF8( msg ) ); fprintf( f, "%s", TO_UTF8( msg ) );
msg = Component->GetField( VALUE )->m_Text; msg = Component->GetField( VALUE )->m_Text;
msg.Replace( wxT( " " ), wxT( "_" ) ); msg.Replace( wxT( " " ), wxT( "_" ) );
fprintf( f, " \"%s\"", CONV_TO_UTF8( msg ) ); fprintf( f, " \"%s\"", TO_UTF8( msg ) );
fprintf( f, "\n" ); fprintf( f, "\n" );
} }
} }
@ -1781,7 +1781,7 @@ void EXPORT_HELP::WriteNetListCADSTAR( FILE* f )
writeListOfNetsCADSTAR( f, g_NetObjectslist ); writeListOfNetsCADSTAR( f, g_NetObjectslist );
fprintf( f, "\n%sEND\n", CONV_TO_UTF8( StartLine ) ); fprintf( f, "\n%sEND\n", TO_UTF8( StartLine ) );
} }
@ -1847,7 +1847,7 @@ void EXPORT_HELP::writeListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjects
wxString str_pinnum; wxString str_pinnum;
strncpy( buf, (char*) &aObjectsList[ii]->m_PinNum, 4 ); strncpy( buf, (char*) &aObjectsList[ii]->m_PinNum, 4 );
buf[4] = 0; buf[4] = 0;
str_pinnum = CONV_FROM_UTF8( buf ); str_pinnum = FROM_UTF8( buf );
InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ), InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ),
GetChars( InitNetDesc ), GetChars( InitNetDesc ),
GetChars( refstr ), GetChars( refstr ),
@ -1858,17 +1858,17 @@ void EXPORT_HELP::writeListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjects
break; break;
case 1: case 1:
fprintf( f, "%s\n", CONV_TO_UTF8( InitNetDescLine ) ); fprintf( f, "%s\n", TO_UTF8( InitNetDescLine ) );
fprintf( f, "%s %s %.4s\n", fprintf( f, "%s %s %.4s\n",
CONV_TO_UTF8( StartNetDesc ), TO_UTF8( StartNetDesc ),
CONV_TO_UTF8( refstr ), TO_UTF8( refstr ),
(char*) &aObjectsList[ii]->m_PinNum ); (char*) &aObjectsList[ii]->m_PinNum );
print_ter++; print_ter++;
break; break;
default: default:
fprintf( f, " %s %.4s\n", fprintf( f, " %s %.4s\n",
CONV_TO_UTF8( refstr ), TO_UTF8( refstr ),
(char*) &aObjectsList[ii]->m_PinNum ); (char*) &aObjectsList[ii]->m_PinNum );
break; break;
} }

View File

@ -128,12 +128,12 @@ public:
void SetRef( const wxString& aReference ) void SetRef( const wxString& aReference )
{ {
m_Ref = CONV_TO_UTF8( aReference ); m_Ref = TO_UTF8( aReference );
} }
wxString GetRef() const wxString GetRef() const
{ {
return CONV_FROM_UTF8( m_Ref.c_str() ); return FROM_UTF8( m_Ref.c_str() );
} }
void SetRefStr( const std::string& aReference ) void SetRefStr( const std::string& aReference )
{ {

View File

@ -94,7 +94,7 @@ bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ), aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false; return false;
} }
@ -108,7 +108,7 @@ bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ), aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false; return false;
} }

View File

@ -368,7 +368,7 @@ const wxString SCH_COMPONENT::GetRef( SCH_SHEET_PATH* sheet )
h_ref = tokenizer.GetNextToken(); h_ref = tokenizer.GetNextToken();
/* printf( "GetRef hpath: %s\n", /* printf( "GetRef hpath: %s\n",
* CONV_TO_UTF8( m_PathsAndReferences[ii] ) ); */ * TO_UTF8( m_PathsAndReferences[ii] ) ); */
return h_ref; return h_ref;
} }
} }
@ -623,7 +623,7 @@ void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath ) void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
{ {
wxString defRef = m_prefix; wxString defRef = m_prefix;
bool KeepMulti = false; bool keepMulti = false;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
wxString separators( wxT( " " ) ); wxString separators( wxT( " " ) );
wxArrayString reference_fields; wxArrayString reference_fields;
@ -631,7 +631,7 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
if( Entry && Entry->UnitsLocked() ) if( Entry && Entry->UnitsLocked() )
KeepMulti = true; keepMulti = true;
while( defRef.Last() == '?' ) while( defRef.Last() == '?' )
defRef.RemoveLast(); defRef.RemoveLast();
@ -641,7 +641,7 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
wxString multi = wxT( "1" ); wxString multi = wxT( "1" );
// We cannot remove all annotations: part selection must be kept // We cannot remove all annotations: part selection must be kept
if( KeepMulti ) if( keepMulti )
{ {
wxString NewHref; wxString NewHref;
wxString path; wxString path;
@ -656,7 +656,7 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
if( aSheetPath == NULL || reference_fields[0].Cmp( path ) == 0 ) if( aSheetPath == NULL || reference_fields[0].Cmp( path ) == 0 )
{ {
if( KeepMulti ) // Get and keep part selection if( keepMulti ) // Get and keep part selection
multi = reference_fields[2]; multi = reference_fields[2];
NewHref = reference_fields[0]; NewHref = reference_fields[0];
@ -862,9 +862,9 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
{ {
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
<< " ref=\"" << CONV_TO_UTF8( ReturnFieldName( 0 ) ) << " ref=\"" << TO_UTF8( ReturnFieldName( 0 ) )
<< '"' << " chipName=\"" << '"' << " chipName=\""
<< CONV_TO_UTF8( m_ChipName ) << '"' << m_Pos << TO_UTF8( m_ChipName ) << '"' << m_Pos
<< " layer=\"" << m_Layer << " layer=\"" << m_Layer
<< '"' << ">\n"; << '"' << ">\n";
@ -876,13 +876,13 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
if( !value.IsEmpty() ) if( !value.IsEmpty() )
{ {
NestedSpace( nestLevel + 1, os ) << "<field" << " name=\"" NestedSpace( nestLevel + 1, os ) << "<field" << " name=\""
<< CONV_TO_UTF8( ReturnFieldName( i ) ) << TO_UTF8( ReturnFieldName( i ) )
<< '"' << " value=\"" << '"' << " value=\""
<< CONV_TO_UTF8( value ) << "\"/>\n"; << TO_UTF8( value ) << "\"/>\n";
} }
} }
NestedSpace( nestLevel, os ) << "</" << CONV_TO_UTF8( GetClass().Lower() ) << ">\n"; NestedSpace( nestLevel, os ) << "</" << TO_UTF8( GetClass().Lower() ) << ">\n";
} }
#endif #endif
@ -902,14 +902,14 @@ bool SCH_COMPONENT::Save( FILE* f ) const
{ {
reference_fields = wxStringTokenize( m_PathsAndReferences[0], reference_fields = wxStringTokenize( m_PathsAndReferences[0],
delimiters ); delimiters );
strncpy( Name1, CONV_TO_UTF8( reference_fields[1] ), sizeof( Name1 ) ); strncpy( Name1, TO_UTF8( reference_fields[1] ), sizeof( Name1 ) );
} }
else else
{ {
if( GetField( REFERENCE )->m_Text.IsEmpty() ) if( GetField( REFERENCE )->m_Text.IsEmpty() )
strncpy( Name1, CONV_TO_UTF8( m_prefix ), sizeof( Name1 ) ); strncpy( Name1, TO_UTF8( m_prefix ), sizeof( Name1 ) );
else else
strncpy( Name1, CONV_TO_UTF8( GetField( REFERENCE )->m_Text ), sizeof( Name1 ) ); strncpy( Name1, TO_UTF8( GetField( REFERENCE )->m_Text ), sizeof( Name1 ) );
} }
for( ii = 0; ii < (int) strlen( Name1 ); ii++ ) for( ii = 0; ii < (int) strlen( Name1 ); ii++ )
@ -925,7 +925,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const
if( !m_ChipName.IsEmpty() ) if( !m_ChipName.IsEmpty() )
{ {
strncpy( Name2, CONV_TO_UTF8( m_ChipName ), sizeof( Name2 ) ); strncpy( Name2, TO_UTF8( m_ChipName ), sizeof( Name2 ) );
for( ii = 0; ii < (int) strlen( Name2 ); ii++ ) for( ii = 0; ii < (int) strlen( Name2 ); ii++ )
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
@ -974,9 +974,9 @@ bool SCH_COMPONENT::Save( FILE* f ) const
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], delimiters ); reference_fields = wxStringTokenize( m_PathsAndReferences[ii], delimiters );
if( fprintf( f, "AR Path=\"%s\" Ref=\"%s\" Part=\"%s\" \n", if( fprintf( f, "AR Path=\"%s\" Ref=\"%s\" Part=\"%s\" \n",
CONV_TO_UTF8( reference_fields[0] ), TO_UTF8( reference_fields[0] ),
CONV_TO_UTF8( reference_fields[1] ), TO_UTF8( reference_fields[1] ),
CONV_TO_UTF8( reference_fields[2] ) ) == EOF ) TO_UTF8( reference_fields[2] ) ) == EOF )
return false; return false;
} }
} }
@ -1055,7 +1055,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema Component descr error at line %d, aborted" ), aErrorMsg.Printf( wxT( "EESchema Component descr error at line %d, aborted" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( line ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( line );
return false; return false;
} }
@ -1065,10 +1065,10 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( Name1[ii] == '~' ) if( Name1[ii] == '~' )
Name1[ii] = ' '; Name1[ii] = ' ';
m_ChipName = CONV_FROM_UTF8( Name1 ); m_ChipName = FROM_UTF8( Name1 );
if( !newfmt ) if( !newfmt )
GetField( VALUE )->m_Text = CONV_FROM_UTF8( Name1 ); GetField( VALUE )->m_Text = FROM_UTF8( Name1 );
} }
else else
{ {
@ -1112,13 +1112,13 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
} }
else else
{ {
m_prefix = CONV_FROM_UTF8( &Name1[jj] ); m_prefix = FROM_UTF8( &Name1[jj] );
//printf("prefix: %s\n", CONV_TO_UTF8(component->m_prefix)); //printf("prefix: %s\n", TO_UTF8(component->m_prefix));
} }
if( !newfmt ) if( !newfmt )
GetField( REFERENCE )->m_Text = CONV_FROM_UTF8( Name2 ); GetField( REFERENCE )->m_Text = FROM_UTF8( Name2 );
} }
else else
{ {
@ -1171,12 +1171,12 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
//copy the path. //copy the path.
ii = ReadDelimitedText( Name1, ptcar, 255 ); ii = ReadDelimitedText( Name1, ptcar, 255 );
ptcar += ii + 1; ptcar += ii + 1;
wxString path = CONV_FROM_UTF8( Name1 ); wxString path = FROM_UTF8( Name1 );
// copy the reference // copy the reference
ii = ReadDelimitedText( Name1, ptcar, 255 ); ii = ReadDelimitedText( Name1, ptcar, 255 );
ptcar += ii + 1; ptcar += ii + 1;
wxString ref = CONV_FROM_UTF8( Name1 ); wxString ref = FROM_UTF8( Name1 );
// copy the multi, if exists // copy the multi, if exists
ii = ReadDelimitedText( Name1, ptcar, 255 ); ii = ReadDelimitedText( Name1, ptcar, 255 );
@ -1235,7 +1235,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( !FieldUserName[0] ) if( !FieldUserName[0] )
fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx ); fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx );
else else
fieldName = CONV_FROM_UTF8( FieldUserName ); fieldName = FROM_UTF8( FieldUserName );
if( fieldNdx >= GetFieldCount() ) if( fieldNdx >= GetFieldCount() )
{ {
@ -1261,7 +1261,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
GetField( fieldNdx )->m_Name = fieldName; GetField( fieldNdx )->m_Name = fieldName;
} }
GetField( fieldNdx )->m_Text = CONV_FROM_UTF8( Name1 ); GetField( fieldNdx )->m_Text = FROM_UTF8( Name1 );
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,

View File

@ -331,7 +331,7 @@ bool SCH_FIELD::Save( FILE* aFile ) const
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,
CONV_TO_UTF8( m_Text ), TO_UTF8( m_Text ),
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
// 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\"", CONV_TO_UTF8( m_Name ) ) == EOF ) if( fprintf( aFile, " \"%s\"", TO_UTF8( m_Name ) ) == EOF )
{ {
return false; return false;
} }

View File

@ -81,7 +81,7 @@ bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file connection load error at line %d, aborted" ), aErrorMsg.Printf( wxT( "EESchema file connection load error at line %d, aborted" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false; return false;
} }

View File

@ -149,7 +149,7 @@ bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file segment error at line %d, aborted" ), aErrorMsg.Printf( wxT( "EESchema file segment error at line %d, aborted" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false; return false;
} }
@ -166,7 +166,7 @@ bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file Segment struct error at line %d, aborted" ), aErrorMsg.Printf( wxT( "EESchema file Segment struct error at line %d, aborted" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false; return false;
} }

View File

@ -76,7 +76,7 @@ bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file No Connect load error at line %d" ), aErrorMsg.Printf( wxT( "EESchema file No Connect load error at line %d" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( ((char*)aLine) ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( ((char*)aLine) );
return false; return false;
} }

View File

@ -100,7 +100,7 @@ bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ), aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false; return false;
} }
@ -120,7 +120,7 @@ bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ), aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false; return false;
} }

View File

@ -308,12 +308,12 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
// Creates header // Creates header
if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP, if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP,
SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0 SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0
|| fprintf( aFile, " date %s\n", CONV_TO_UTF8( DateAndTime() ) ) < 0 ) || fprintf( aFile, " date %s\n", TO_UTF8( DateAndTime() ) ) < 0 )
return false; return false;
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() ) BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{ {
if( fprintf( aFile, "LIBS:%s\n", CONV_TO_UTF8( lib.GetName() ) ) < 0 ) if( fprintf( aFile, "LIBS:%s\n", TO_UTF8( lib.GetName() ) ) < 0 )
return false; return false;
} }
@ -328,17 +328,18 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
* sheet ( ScreenNumber = 1 ) within the files * sheet ( ScreenNumber = 1 ) within the files
*/ */
if( fprintf( aFile, "$Descr %s %d %d\n", CONV_TO_UTF8( m_CurrentSheetDesc->m_Name ), if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_CurrentSheetDesc->m_Name ),
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, "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", CONV_TO_UTF8( m_Title ) ) < 0 || fprintf( aFile, "Title \"%s\"\n", TO_UTF8( m_Title ) ) < 0
|| fprintf( aFile, "Date \"%s\"\n", CONV_TO_UTF8( m_Date ) ) < 0 || fprintf( aFile, "Date \"%s\"\n", TO_UTF8( m_Date ) ) < 0
|| fprintf( aFile, "Rev \"%s\"\n", CONV_TO_UTF8( m_Revision ) ) < 0 || fprintf( aFile, "Rev \"%s\"\n", TO_UTF8( m_Revision ) ) < 0
|| fprintf( aFile, "Comp \"%s\"\n", CONV_TO_UTF8( m_Company ) ) < 0 || fprintf( aFile, "Comp \"%s\"\n", TO_UTF8( m_Company ) ) < 0
|| fprintf( aFile, "Comment1 \"%s\"\n", CONV_TO_UTF8( m_Commentaire1 ) ) < 0 || fprintf( aFile, "Comment1 \"%s\"\n", TO_UTF8( m_Commentaire1 ) ) < 0
|| fprintf( aFile, "Comment2 \"%s\"\n", CONV_TO_UTF8( m_Commentaire2 ) ) < 0 || fprintf( aFile, "Comment2 \"%s\"\n", TO_UTF8( m_Commentaire2 ) ) < 0
|| fprintf( aFile, "Comment3 \"%s\"\n", CONV_TO_UTF8( m_Commentaire3 ) ) < 0 || fprintf( aFile, "Comment3 \"%s\"\n", TO_UTF8( m_Commentaire3 ) ) < 0
|| fprintf( aFile, "Comment4 \"%s\"\n", CONV_TO_UTF8( m_Commentaire4 ) ) < 0 || fprintf( aFile, "Comment4 \"%s\"\n", TO_UTF8( m_Commentaire4 ) ) < 0
|| fprintf( aFile, "$EndDescr\n" ) < 0 ) || fprintf( aFile, "$EndDescr\n" ) < 0 )
return false; return false;

View File

@ -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", CONV_TO_UTF8( m_SheetName ), if( fprintf( aFile, "F0 \"%s\" %d\n", TO_UTF8( m_SheetName ),
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", CONV_TO_UTF8( m_FileName ), if( fprintf( aFile, "F1 \"%s\" %d\n", TO_UTF8( m_FileName ),
m_FileNameSize ) == EOF ) m_FileNameSize ) == EOF )
return false; return false;
} }
@ -191,7 +191,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
aErrorMsg.Printf( wxT( " ** EESchema file sheet struct error at line %d, aborted\n" ), aErrorMsg.Printf( wxT( " ** EESchema file sheet struct error at line %d, aborted\n" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) ); aErrorMsg << FROM_UTF8( ((char*)aLine) );
return false; return false;
} }
@ -227,7 +227,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file sheet label F%d at line %d, aborted\n" ), aErrorMsg.Printf( wxT( "EESchema file sheet label F%d at line %d, aborted\n" ),
fieldNdx, aLine.LineNumber() ); fieldNdx, aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << FROM_UTF8( (char*) aLine );
return false; return false;
} }
@ -239,7 +239,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file sheet field F at line %d, aborted\n" ), aErrorMsg.Printf( wxT( "EESchema file sheet field F at line %d, aborted\n" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << FROM_UTF8( (char*) aLine );
return false; return false;
} }
@ -258,19 +258,19 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
aErrorMsg.Printf( wxT( "EESchema file sheet Label error line %d, aborted\n" ), aErrorMsg.Printf( wxT( "EESchema file sheet Label error line %d, aborted\n" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( (char*) aLine ); aErrorMsg << FROM_UTF8( (char*) aLine );
} }
if( size == 0 ) if( size == 0 )
size = DEFAULT_SIZE_TEXT; size = DEFAULT_SIZE_TEXT;
if( fieldNdx == 0 ) if( fieldNdx == 0 )
{ {
m_SheetName = CONV_FROM_UTF8( Name1 ); m_SheetName = FROM_UTF8( Name1 );
m_SheetNameSize = size; m_SheetNameSize = size;
} }
else else
{ {
SetFileName( CONV_FROM_UTF8( Name1 ) ); SetFileName( FROM_UTF8( Name1 ) );
//printf( "in ReadSheetDescr : m_FileName = %s \n", Name1 ); //printf( "in ReadSheetDescr : m_FileName = %s \n", Name1 );
m_FileNameSize = size; m_FileNameSize = size;
@ -296,7 +296,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "**EESchema file end_sheet struct error at line %d, aborted\n" ), aErrorMsg.Printf( wxT( "**EESchema file end_sheet struct error at line %d, aborted\n" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) ); aErrorMsg << FROM_UTF8( ((char*)aLine) );
return false; return false;
} }
@ -999,7 +999,7 @@ void SCH_SHEET::Show( int nestLevel, std::ostream& os )
wxString s = GetClass(); wxString s = GetClass();
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">" << " sheet_name=\"" NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">" << " sheet_name=\""
<< CONV_TO_UTF8( m_SheetName ) << '"' << ">\n"; << TO_UTF8( m_SheetName ) << '"' << ">\n";
// show all the pins, and check the linked list integrity // show all the pins, and check the linked list integrity
BOOST_FOREACH( SCH_SHEET_PIN& label, m_labels ) BOOST_FOREACH( SCH_SHEET_PIN& label, m_labels )

View File

@ -241,7 +241,7 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
} }
if( fprintf( aFile, "F%d \"%s\" %c %c %-3d %-3d %-3d\n", m_Number, if( fprintf( aFile, "F%d \"%s\" %c %c %-3d %-3d %-3d\n", m_Number,
CONV_TO_UTF8( m_Text ), type, side, m_Pos.x, m_Pos.y, TO_UTF8( m_Text ), type, side, m_Pos.x, m_Pos.y,
m_Size.x ) == EOF ) m_Size.x ) == EOF )
{ {
return false; return false;
@ -265,11 +265,11 @@ bool SCH_SHEET_PIN::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
aErrorMsg.Printf( wxT( "EESchema file sheet hierarchical label error at line %d.\n" ), aErrorMsg.Printf( wxT( "EESchema file sheet hierarchical label error at line %d.\n" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) ); aErrorMsg << FROM_UTF8( ((char*)aLine) );
return false; return false;
} }
m_Text = CONV_FROM_UTF8( name ); m_Text = FROM_UTF8( name );
m_Text = m_Text.AfterFirst( wxChar( '"' ) ); m_Text = m_Text.AfterFirst( wxChar( '"' ) );
m_Text = m_Text.BeforeLast( wxChar( '"' ) ); m_Text = m_Text.BeforeLast( wxChar( '"' ) );
@ -442,7 +442,7 @@ void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os )
wxString s = GetClass(); wxString s = GetClass();
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">" NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
<< " pin_name=\"" << CONV_TO_UTF8( m_Text ) << " pin_name=\"" << TO_UTF8( m_Text )
<< '"' << "/>\n" << std::flush; << '"' << "/>\n" << std::flush;
// NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n"; // NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n";

View File

@ -424,7 +424,7 @@ bool SCH_TEXT::Save( FILE* aFile ) const
if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n", if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x,
shape, m_Thickness, CONV_TO_UTF8( text ) ) == EOF ) shape, m_Thickness, TO_UTF8( text ) ) == EOF )
{ {
success = false; success = false;
} }
@ -477,7 +477,7 @@ bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg )
return false; return false;
} }
wxString val = CONV_FROM_UTF8( text ); wxString val = FROM_UTF8( text );
for( ;; ) for( ;; )
{ {
int i = val.find( wxT( "\\n" ) ); int i = val.find( wxT( "\\n" ) );
@ -646,7 +646,7 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os )
<< " shape=\"" << m_Shape << '"' << " shape=\"" << m_Shape << '"'
<< " dangling=\"" << m_IsDangling << '"' << " dangling=\"" << m_IsDangling << '"'
<< '>' << '>'
<< CONV_TO_UTF8( m_Text ) << TO_UTF8( m_Text )
<< "</" << s.Lower().mb_str() << ">\n"; << "</" << s.Lower().mb_str() << ">\n";
} }
@ -719,7 +719,7 @@ bool SCH_LABEL::Save( FILE* aFile ) const
if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n", if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, shape, m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, shape,
m_Thickness, CONV_TO_UTF8( m_Text ) ) == EOF ) m_Thickness, TO_UTF8( m_Text ) ) == EOF )
{ {
success = false; success = false;
} }
@ -772,7 +772,7 @@ bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
return false; return false;
} }
m_Text = CONV_FROM_UTF8( text ); m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y = size; m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient ); SetSchematicTextOrientation( orient );
@ -886,7 +886,7 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n", if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x,
SheetLabelType[m_Shape], shape, m_Thickness, CONV_TO_UTF8( m_Text ) ) == EOF ) SheetLabelType[m_Shape], shape, m_Thickness, TO_UTF8( m_Text ) ) == EOF )
{ {
success = false; success = false;
} }
@ -938,7 +938,7 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
return false; return false;
} }
m_Text = CONV_FROM_UTF8( text ); m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y = size; m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient ); SetSchematicTextOrientation( orient );
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
@ -1312,7 +1312,7 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n", if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x,
SheetLabelType[m_Shape], shape, m_Thickness, CONV_TO_UTF8( m_Text ) ) == EOF ) SheetLabelType[m_Shape], shape, m_Thickness, TO_UTF8( m_Text ) ) == EOF )
{ {
success = false; success = false;
} }
@ -1364,7 +1364,7 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
return false; return false;
} }
m_Text = CONV_FROM_UTF8( text ); m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y = size; m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient ); SetSchematicTextOrientation( orient );
m_Shape = NET_INPUT; m_Shape = NET_INPUT;

View File

@ -154,7 +154,7 @@ int TEMPLATES::AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
if( m_Fields[i].m_Name == aFieldName.m_Name ) if( m_Fields[i].m_Name == aFieldName.m_Name )
{ {
D( printf( "inserting template fieldname:'%s' at %d\n", D( printf( "inserting template fieldname:'%s' at %d\n",
CONV_TO_UTF8( aFieldName.m_Name ), i ); ) TO_UTF8( aFieldName.m_Name ), i ); )
m_Fields[i] = aFieldName; m_Fields[i] = aFieldName;
return i; // return the container index return i; // return the container index

View File

@ -718,7 +718,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
if( !pam ) if( !pam )
{ {
msg.Printf( wxT( "RS274X: aperture macro %s not found\n" ), msg.Printf( wxT( "RS274X: aperture macro %s not found\n" ),
CONV_TO_UTF8( am_lookup.name ) ); TO_UTF8( am_lookup.name ) );
ReportMessage( msg ); ReportMessage( msg );
ok = false; ok = false;
break; break;
@ -858,7 +858,7 @@ bool GERBER_IMAGE::ReadApertureMacro( char buff[GERBER_BUFZ],
else if( !isdigit(*text) ) // Ill. symbol else if( !isdigit(*text) ) // Ill. symbol
{ {
msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": ill. symbol, line: \"%s\"" ), msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": ill. symbol, line: \"%s\"" ),
GetChars( am.name ), GetChars( CONV_FROM_UTF8( buff ) ) ); GetChars( am.name ), GetChars( FROM_UTF8( buff ) ) );
ReportMessage( msg ); ReportMessage( msg );
primitive_type = AMP_COMMENT; primitive_type = AMP_COMMENT;
} }
@ -911,7 +911,7 @@ bool GERBER_IMAGE::ReadApertureMacro( char buff[GERBER_BUFZ],
default: default:
// @todo, there needs to be a way of reporting the line number // @todo, there needs to be a way of reporting the line number
msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": Invalid primitive id code %d, line: \"%s\"" ), msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": Invalid primitive id code %d, line: \"%s\"" ),
GetChars( am.name ), primitive_type, GetChars( CONV_FROM_UTF8( buff ) ) ); GetChars( am.name ), primitive_type, GetChars( FROM_UTF8( buff ) ) );
ReportMessage( msg ); ReportMessage( msg );
return false; return false;
} }

View File

@ -7,20 +7,6 @@
#include <wx/wx.h> #include <wx/wx.h>
// Note: we should use wxConvUTF8 insdeat of wxConvCurrent here,
// in order to use UTF8 in Kicad files.
// But this change break compatibility with older files under Windows,
// if some non ASCII characters are found in strings.
// So this is a TODO change. Simply switch to TO_UTF8() and FROM_UTF() then.
#if wxUSE_UNICODE
#define CONV_TO_UTF8( wxstring ) ( (const char*) wxConvCurrent->cWX2MB( wxstring ) )
#define CONV_FROM_UTF8( utf8string ) ( wxConvCurrent->cMB2WC( utf8string ) )
#else
// Should not used: Kicad uses Unicode verion on wxWidgets
#define CONV_TO_UTF8( wxstring ) ( (const char*) ( (wxstring).c_str() ) )
#define CONV_FROM_UTF8( utf8string ) (utf8string)
#endif
/** /**
* Macro TO_UTF8 * Macro TO_UTF8
* converts a wxString to a UTF8 encoded C string for all wxWidgets build modes. * converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.

View File

@ -389,7 +389,7 @@ public:
* The implementer only has to implement the write() function, but can * The implementer only has to implement the write() function, but can
* also optionally re-implement GetQuoteChar(). * also optionally re-implement GetQuoteChar().
* <p> * <p>
* If you want to output a wxString, then use CONV_TO_UTF8() on it * If you want to output a wxString, then use TO_UTF8() on it
* before passing it as an argument to Print(). * before passing it as an argument to Print().
* <p> * <p>
* Since this is an abstract interface, only classes derived from * Since this is an abstract interface, only classes derived from

View File

@ -90,7 +90,7 @@ void WinEDA_PcbFrame::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
msg << _("Quantity") << wxT("\";\""); msg << _("Quantity") << wxT("\";\"");
msg << _("Designation") << wxT("\";\""); msg << _("Designation") << wxT("\";\"");
msg << _("Supplier and ref") << wxT("\";\n" ); msg << _("Supplier and ref") << wxT("\";\n" );
fprintf( FichBom, "%s", CONV_TO_UTF8( msg ) ); fprintf( FichBom, "%s", TO_UTF8( msg ) );
// Build list // Build list
CmpList list; CmpList list;
@ -144,7 +144,7 @@ void WinEDA_PcbFrame::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
msg << current->m_Pkg << wxT( "\";" ); msg << current->m_Pkg << wxT( "\";" );
msg << current->m_CmpCount << wxT( ";\"" ); msg << current->m_CmpCount << wxT( ";\"" );
msg << current->m_Val << wxT( "\";;;\n" ); msg << current->m_Val << wxT( "\";;;\n" );
fprintf( FichBom, "%s", CONV_TO_UTF8( msg ) ); fprintf( FichBom, "%s", TO_UTF8( msg ) );
list.DeleteObject( current ); list.DeleteObject( current );
delete (current); delete (current);

View File

@ -1250,7 +1250,7 @@ NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const
if( aNetcode != net->GetNet() ) if( aNetcode != net->GetNet() )
{ {
printf( "FindNet() anetcode %d != GetNet() %d (net: %s)\n", printf( "FindNet() anetcode %d != GetNet() %d (net: %s)\n",
aNetcode, net->GetNet(), CONV_TO_UTF8( net->GetNetname() ) ); aNetcode, net->GetNet(), TO_UTF8( net->GetNetname() ) );
} }
} }
#endif #endif

View File

@ -137,7 +137,7 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
if( Line[0] == 'T' ) if( Line[0] == 'T' )
{ {
ReadDelimitedText( Text, Line + 2, sizeof(Text) ); ReadDelimitedText( Text, Line + 2, sizeof(Text) );
m_Text->m_Text = CONV_FROM_UTF8( Text ); m_Text->m_Text = FROM_UTF8( Text );
continue; continue;
} }
@ -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", CONV_TO_UTF8( m_Text->m_Text ) ); fprintf( aFile, "Te \"%s\"\n", TO_UTF8( m_Text->m_Text ) );
else else
fprintf( aFile, "Te \"?\"\n" ); fprintf( aFile, "Te \"?\"\n" );

View File

@ -620,7 +620,7 @@ void EDGE_MODULE::Show( int nestLevel, std::ostream& os )
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" type=\"" << CONV_TO_UTF8( shape ) << "\">"; " type=\"" << TO_UTF8( shape ) << "\">";
os << " <start" << m_Start0 << "/>"; os << " <start" << m_Start0 << "/>";
os << " <end" << m_End0 << "/>"; os << " <end" << m_End0 << "/>";

View File

@ -263,7 +263,7 @@ bool MODULE::Save( FILE* aFile ) const
bool rc = false; bool rc = false;
fprintf( aFile, "$MODULE %s\n", CONV_TO_UTF8( m_LibRef ) ); fprintf( aFile, "$MODULE %s\n", TO_UTF8( m_LibRef ) );
memset( statusTxt, 0, sizeof(statusTxt) ); memset( statusTxt, 0, sizeof(statusTxt) );
if( IsLocked() ) if( IsLocked() )
@ -281,20 +281,20 @@ bool MODULE::Save( FILE* aFile ) const
m_Orient, m_Layer, m_LastEdit_Time, m_Orient, m_Layer, m_LastEdit_Time,
m_TimeStamp, statusTxt ); m_TimeStamp, statusTxt );
fprintf( aFile, "Li %s\n", CONV_TO_UTF8( m_LibRef ) ); fprintf( aFile, "Li %s\n", TO_UTF8( m_LibRef ) );
if( !m_Doc.IsEmpty() ) if( !m_Doc.IsEmpty() )
{ {
fprintf( aFile, "Cd %s\n", CONV_TO_UTF8( m_Doc ) ); fprintf( aFile, "Cd %s\n", TO_UTF8( m_Doc ) );
} }
if( !m_KeyWord.IsEmpty() ) if( !m_KeyWord.IsEmpty() )
{ {
fprintf( aFile, "Kw %s\n", CONV_TO_UTF8( m_KeyWord ) ); fprintf( aFile, "Kw %s\n", TO_UTF8( m_KeyWord ) );
} }
fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp ); fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp );
fprintf( aFile, "AR %s\n", CONV_TO_UTF8( m_Path ) ); fprintf( aFile, "AR %s\n", TO_UTF8( m_Path ) );
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 ); fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
if( m_LocalSolderMaskMargin != 0 ) if( m_LocalSolderMaskMargin != 0 )
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin ); fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
@ -350,7 +350,7 @@ bool MODULE::Save( FILE* aFile ) const
Write_3D_Descr( aFile ); Write_3D_Descr( aFile );
fprintf( aFile, "$EndMODULE %s\n", CONV_TO_UTF8( m_LibRef ) ); fprintf( aFile, "$EndMODULE %s\n", TO_UTF8( m_LibRef ) );
rc = true; rc = true;
out: out:
@ -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", CONV_TO_UTF8( t3D->m_Shape3DName ) ); fprintf( File, "Na \"%s\"\n", TO_UTF8( t3D->m_Shape3DName ) );
sprintf( buf, "Sc %lf %lf %lf\n", sprintf( buf, "Sc %lf %lf %lf\n",
t3D->m_MatScale.x, t3D->m_MatScale.x,
@ -432,7 +432,7 @@ int MODULE::Read_3D_Descr( LINE_READER* aReader )
{ {
char buf[512]; char buf[512];
ReadDelimitedText( buf, text, 512 ); ReadDelimitedText( buf, text, 512 );
t3D->m_Shape3DName = CONV_FROM_UTF8( buf ); t3D->m_Shape3DName = FROM_UTF8( buf );
break; break;
} }
@ -525,7 +525,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
case 'L': /* Li = read the library name of the footprint */ case 'L': /* Li = read the library name of the footprint */
*BufLine = 0; *BufLine = 0;
sscanf( PtLine, " %s", BufLine ); sscanf( PtLine, " %s", BufLine );
m_LibRef = CONV_FROM_UTF8( BufLine ); m_LibRef = FROM_UTF8( BufLine );
break; break;
case 'S': case 'S':
@ -563,7 +563,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
{ {
// alternate reference, e.g. /478C2408/478AD1B6 // alternate reference, e.g. /478C2408/478AD1B6
sscanf( PtLine, " %s", BufLine ); sscanf( PtLine, " %s", BufLine );
m_Path = CONV_FROM_UTF8( BufLine ); m_Path = FROM_UTF8( BufLine );
} }
break; break;
@ -592,11 +592,11 @@ int MODULE::ReadDescr( LINE_READER* aReader )
break; break;
case 'C': /* read documentation data */ case 'C': /* read documentation data */
m_Doc = CONV_FROM_UTF8( StrPurge( PtLine ) ); m_Doc = FROM_UTF8( StrPurge( PtLine ) );
break; break;
case 'K': /* Read key words */ case 'K': /* Read key words */
m_KeyWord = CONV_FROM_UTF8( StrPurge( PtLine ) ); m_KeyWord = FROM_UTF8( StrPurge( PtLine ) );
break; break;
case '.': /* Read specific data */ case '.': /* Read specific data */
@ -811,7 +811,7 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
strcat( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, ", " ); strcat( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, ", " );
strtok( NULL, " \n\r" ); strtok( NULL, " \n\r" );
strcat( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, strtok( NULL, " \n\r" ) );
msg = CONV_FROM_UTF8( bufcar ); msg = FROM_UTF8( bufcar );
frame->AppendMsgPanel( _( "Last Change" ), msg, BROWN ); frame->AppendMsgPanel( _( "Last Change" ), msg, BROWN );
} }
else // display time stamp in schematic else // display time stamp in schematic

View File

@ -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", CONV_TO_UTF8( m_Name ) ); fprintf( aFile, "Name \"%s\"\n", TO_UTF8( m_Name ) );
fprintf( aFile, "Desc \"%s\"\n", CONV_TO_UTF8( GetDescription() ) ); fprintf( aFile, "Desc \"%s\"\n", TO_UTF8( GetDescription() ) );
// Write parameters // Write parameters
@ -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", CONV_TO_UTF8( *i ) ); fprintf( aFile, "AddNet \"%s\"\n", TO_UTF8( *i ) );
fprintf( aFile, "$End" BRD_NETCLASS "\n" ); fprintf( aFile, "$End" BRD_NETCLASS "\n" );
@ -322,7 +322,7 @@ void NETCLASS::Show( int nestLevel, std::ostream& os )
for( const_iterator i = begin(); i!=end(); ++i ) for( const_iterator i = begin(); i!=end(); ++i )
{ {
// NestedSpace( nestLevel+1, os ) << *i; // NestedSpace( nestLevel+1, os ) << *i;
os << CONV_TO_UTF8( *i ); os << TO_UTF8( *i );
} }
// NestedSpace( nestLevel, os ) // NestedSpace( nestLevel, os )
@ -346,7 +346,7 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader )
if( strnicmp( Line, "AddNet", 6 ) == 0 ) if( strnicmp( Line, "AddNet", 6 ) == 0 )
{ {
ReadDelimitedText( Buffer, Line + 6, sizeof(Buffer) ); ReadDelimitedText( Buffer, Line + 6, sizeof(Buffer) );
netname = CONV_FROM_UTF8( Buffer ); netname = FROM_UTF8( Buffer );
Add( netname ); Add( netname );
continue; continue;
} }
@ -392,13 +392,13 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader )
if( strnicmp( Line, "Name", 4 ) == 0 ) if( strnicmp( Line, "Name", 4 ) == 0 )
{ {
ReadDelimitedText( Buffer, Line + 4, sizeof(Buffer) ); ReadDelimitedText( Buffer, Line + 4, sizeof(Buffer) );
m_Name = CONV_FROM_UTF8( Buffer ); m_Name = FROM_UTF8( Buffer );
continue; continue;
} }
if( strnicmp( Line, "Desc", 4 ) == 0 ) if( strnicmp( Line, "Desc", 4 ) == 0 )
{ {
ReadDelimitedText( Buffer, Line + 4, sizeof(Buffer) ); ReadDelimitedText( Buffer, Line + 4, sizeof(Buffer) );
SetDescription( CONV_FROM_UTF8( Buffer ) ); SetDescription( FROM_UTF8( Buffer ) );
continue; continue;
} }
} }

View File

@ -60,7 +60,7 @@ int NETINFO_ITEM::ReadDescr( LINE_READER* aReader )
SetNet( tmp ); SetNet( tmp );
ReadDelimitedText( Ltmp, Line + 2, sizeof(Ltmp) ); ReadDelimitedText( Ltmp, Line + 2, sizeof(Ltmp) );
m_Netname = CONV_FROM_UTF8( Ltmp ); m_Netname = FROM_UTF8( Ltmp );
continue; continue;
} }
} }
@ -78,10 +78,10 @@ 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(), CONV_TO_UTF8( m_Netname ) ); fprintf( aFile, "Na %d \"%s\"\n", GetNet(), TO_UTF8( m_Netname ) );
fprintf( aFile, "St %s\n", "~" ); fprintf( aFile, "St %s\n", "~" );
// fprintf( aFile, "NetClass \"%s\"\n", CONV_TO_UTF8(m_NetClassName) ); // 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;

View File

@ -467,7 +467,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
/* read Netname */ /* read Netname */
ReadDelimitedText( BufLine, PtLine, sizeof(BufLine) ); ReadDelimitedText( BufLine, PtLine, sizeof(BufLine) );
SetNetname( CONV_FROM_UTF8( StrPurge( BufLine ) ) ); SetNetname( FROM_UTF8( StrPurge( BufLine ) ) );
break; break;
case 'P': case 'P':
@ -558,7 +558,7 @@ 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(), CONV_TO_UTF8( m_Netname ) ); fprintf( aFile, "Ne %d \"%s\"\n", GetNet(), TO_UTF8( m_Netname ) );
fprintf( aFile, "Po %d %d\n", m_Pos0.x, m_Pos0.y ); fprintf( aFile, "Po %d %d\n", m_Pos0.x, m_Pos0.y );

View File

@ -92,14 +92,14 @@ int TEXTE_PCB::ReadTextePcbDescr( LINE_READER* aReader )
if( strncmp( line, "Te", 2 ) == 0 ) /* Text line (first line for multi line texts */ if( strncmp( line, "Te", 2 ) == 0 ) /* Text line (first line for multi line texts */
{ {
ReadDelimitedText( text, line + 2, sizeof(text) ); ReadDelimitedText( text, line + 2, sizeof(text) );
m_Text = CONV_FROM_UTF8( text ); m_Text = FROM_UTF8( text );
continue; continue;
} }
if( strncmp( line, "nl", 2 ) == 0 ) /* next line of the current text */ if( strncmp( line, "nl", 2 ) == 0 ) /* next line of the current text */
{ {
ReadDelimitedText( text, line + 2, sizeof(text) ); ReadDelimitedText( text, line + 2, sizeof(text) );
m_Text.Append( '\n' ); m_Text.Append( '\n' );
m_Text += CONV_FROM_UTF8( text ); m_Text += FROM_UTF8( text );
continue; continue;
} }
if( strncmp( line, "Po", 2 ) == 0 ) if( strncmp( line, "Po", 2 ) == 0 )
@ -165,7 +165,7 @@ bool TEXTE_PCB::Save( FILE* aFile ) const
if ( ii == 0 ) if ( ii == 0 )
fprintf( aFile, "Te \"%s\"\n", EscapedUTF8( txt ).c_str() ); fprintf( aFile, "Te \"%s\"\n", EscapedUTF8( txt ).c_str() );
else else
fprintf( aFile, "nl \"%s\"\n", CONV_TO_UTF8( txt ) ); fprintf( aFile, "nl \"%s\"\n", TO_UTF8( txt ) );
} }
delete list; delete list;

View File

@ -87,7 +87,7 @@ 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',
CONV_TO_UTF8( m_Text ) ); TO_UTF8( m_Text ) );
return ret > 20; return ret > 20;
} }
@ -158,7 +158,7 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
SetDrawCoord(); SetDrawCoord();
/* Read the "text" string. */ /* Read the "text" string. */
ReadDelimitedText( BufLine, aLine, sizeof(BufLine) ); ReadDelimitedText( BufLine, aLine, sizeof(BufLine) );
m_Text = CONV_FROM_UTF8( BufLine ); m_Text = FROM_UTF8( BufLine );
// Test for a reasonable size: // Test for a reasonable size:
if( m_Size.x < TEXTS_MIN_SIZE ) if( m_Size.x < TEXTS_MIN_SIZE )

View File

@ -109,7 +109,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
// 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,
CONV_TO_UTF8( m_Netname ) ); TO_UTF8( m_Netname ) );
if( ret < 3 ) if( ret < 3 )
return false; return false;
@ -282,7 +282,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
m_TimeStamp = ts; m_TimeStamp = ts;
m_NetCode = netcode; m_NetCode = netcode;
ReadDelimitedText( netname_buffer, netname_buffer, 1024 ); ReadDelimitedText( netname_buffer, netname_buffer, 1024 );
m_Netname = CONV_FROM_UTF8( netname_buffer ); m_Netname = FROM_UTF8( netname_buffer );
} }
} }
else if( strnicmp( Line, "ZLayer", 6 ) == 0 ) // layer found else if( strnicmp( Line, "ZLayer", 6 ) == 0 ) // layer found

View File

@ -53,7 +53,7 @@ void RemoteCommand( const char* cmdline )
if( strcmp( idcmd, "$PART:" ) == 0 ) if( strcmp( idcmd, "$PART:" ) == 0 )
{ {
modName = CONV_FROM_UTF8( text ); modName = FROM_UTF8( text );
module = frame->GetBoard()->FindModuleByReference( modName ); module = frame->GetBoard()->FindModuleByReference( modName );
@ -73,13 +73,13 @@ void RemoteCommand( const char* cmdline )
D_PAD* pad = NULL; D_PAD* pad = NULL;
int netcode = -1; int netcode = -1;
pinName = CONV_FROM_UTF8( text ); pinName = FROM_UTF8( text );
text = strtok( NULL, " \n\r" ); text = strtok( NULL, " \n\r" );
if( text && strcmp( text, "$PART:" ) == 0 ) if( text && strcmp( text, "$PART:" ) == 0 )
text = strtok( NULL, "\n\r" ); text = strtok( NULL, "\n\r" );
modName = CONV_FROM_UTF8( text ); modName = FROM_UTF8( text );
module = frame->GetBoard()->FindModuleByReference( modName ); module = frame->GetBoard()->FindModuleByReference( modName );
@ -158,7 +158,7 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
case TYPE_MODULE: case TYPE_MODULE:
module = (MODULE*) objectToSync; module = (MODULE*) objectToSync;
sprintf( cmd, "$PART: \"%s\"", sprintf( cmd, "$PART: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ) ); TO_UTF8( module->m_Reference->m_Text ) );
break; break;
case TYPE_PAD: case TYPE_PAD:
@ -166,8 +166,8 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
pad = (D_PAD*) objectToSync; pad = (D_PAD*) objectToSync;
msg = pad->ReturnStringPadName(); msg = pad->ReturnStringPadName();
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"", sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ), TO_UTF8( module->m_Reference->m_Text ),
CONV_TO_UTF8( msg ) ); TO_UTF8( msg ) );
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
@ -183,9 +183,9 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
break; break;
sprintf( cmd, "$PART: \"%s\" %s \"%s\"", sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ), TO_UTF8( module->m_Reference->m_Text ),
text_key, text_key,
CONV_TO_UTF8( text_mod->m_Text ) ); TO_UTF8( text_mod->m_Text ) );
break; break;
default: default:

View File

@ -32,7 +32,7 @@ void CreateKeyFile()
datetimestr = datetime.FormatISODate( ) datetimestr = datetime.FormatISODate( )
+ wxT(" ") + wxT(" ")
+ datetime.FormatISOTime( ); + datetime.FormatISOTime( );
strcpy(sDate_Time, CONV_TO_UTF8(datetimestr) ); strcpy(sDate_Time, TO_UTF8(datetimestr) );
kdebugFile = fopen( KEYFILE_FILENAME, "wt" ); kdebugFile = fopen( KEYFILE_FILENAME, "wt" );
if( kdebugFile ) if( kdebugFile )

View File

@ -197,10 +197,10 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
tracksegment->SetState( BUSY, OFF ); tracksegment->SetState( BUSY, OFF );
//D( printf( "%s: track %p status=\"%s\"\n", __func__, tracksegment, //D( printf( "%s: track %p status=\"%s\"\n", __func__, tracksegment,
// CONV_TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) // TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) )
// ); ) // ); )
D( std::cout<<__func__<<": track "<<tracksegment<<" status=" \ D( std::cout<<__func__<<": track "<<tracksegment<<" status=" \
<<CONV_TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) \ <<TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) \
<<std::endl;) <<std::endl;)
GetBoard()->m_Track.Remove( tracksegment ); GetBoard()->m_Track.Remove( tracksegment );

View File

@ -424,7 +424,7 @@ void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl,
int r = 0; int r = 0;
for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++r ) for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++r )
{ {
printf( "[%d]: %s %s\n", r, CONV_TO_UTF8( (*i)->net ), CONV_TO_UTF8( (*i)->clazz ) ); printf( "[%d]: %s %s\n", r, TO_UTF8( (*i)->net ), TO_UTF8( (*i)->clazz ) );
} }
#endif #endif

View File

@ -555,25 +555,25 @@ void DIALOG_DRC_CONTROL::writeReport( FILE* fp )
int count; int count;
fprintf( fp, "** Drc report for %s **\n", fprintf( fp, "** Drc report for %s **\n",
CONV_TO_UTF8( m_Parent->GetScreen()->GetFileName() ) ); TO_UTF8( m_Parent->GetScreen()->GetFileName() ) );
wxDateTime now = wxDateTime::Now(); wxDateTime now = wxDateTime::Now();
fprintf( fp, "** Created on %s **\n", CONV_TO_UTF8( now.Format( wxT( "%F %T" ) ) ) ); fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
count = m_ClearanceListBox->GetItemCount(); count = m_ClearanceListBox->GetItemCount();
fprintf( fp, "\n** Found %d DRC errors **\n", count ); fprintf( fp, "\n** Found %d DRC errors **\n", count );
for( int i = 0; i<count; ++i ) for( int i = 0; i<count; ++i )
fprintf( fp, "%s", CONV_TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport()) ); fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport()) );
count = m_UnconnectedListBox->GetItemCount(); count = m_UnconnectedListBox->GetItemCount();
fprintf( fp, "\n** Found %d unconnected pads **\n", count ); fprintf( fp, "\n** Found %d unconnected pads **\n", count );
for( int i = 0; i<count; ++i ) for( int i = 0; i<count; ++i )
fprintf( fp, "%s", CONV_TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport() ) ); fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport() ) );
fprintf( fp, "\n** End of Report **\n" ); fprintf( fp, "\n** End of Report **\n" );
} }

View File

@ -67,7 +67,7 @@ void DIALOG_FREEROUTE::OnHelpButtonClick( wxCommandEvent& event )
DIALOG_DISPLAY_HTML_TEXT_BASE help_Dlg( this, wxID_ANY, DIALOG_DISPLAY_HTML_TEXT_BASE help_Dlg( this, wxID_ANY,
_("Freeroute Help"),wxDefaultPosition, wxSize( 650,550 ) ); _("Freeroute Help"),wxDefaultPosition, wxSize( 650,550 ) );
wxString msg = CONV_FROM_UTF8(s_FreeRouteHelpInfo); wxString msg = FROM_UTF8(s_FreeRouteHelpInfo);
help_Dlg.m_htmlWindow->AppendToPage( msg ); help_Dlg.m_htmlWindow->AppendToPage( msg );
help_Dlg.ShowModal(); help_Dlg.ShowModal();
} }

View File

@ -370,7 +370,7 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames()
{ {
wxString lname = m_Pcb->GetLayerName( layer ); wxString lname = m_Pcb->GetLayerName( layer );
//D(printf("layerName[%d]=%s\n", layer, CONV_TO_UTF8( lname ) );) //D(printf("layerName[%d]=%s\n", layer, TO_UTF8( lname ) );)
if( ctl->IsKindOf( CLASSINFO(wxTextCtrl) ) ) if( ctl->IsKindOf( CLASSINFO(wxTextCtrl) ) )
((wxTextCtrl*)ctl)->SetValue( lname ); // wxTextCtrl ((wxTextCtrl*)ctl)->SetValue( lname ); // wxTextCtrl
@ -647,7 +647,7 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
wxString name = getLayerName( layer ); wxString name = getLayerName( layer );
//D(printf("name[%d]=%s\n", layer, CONV_TO_UTF8(name) );) //D(printf("name[%d]=%s\n", layer, TO_UTF8(name) );)
ctl = (wxTextCtrl*) getName( layer ); ctl = (wxTextCtrl*) getName( layer );

View File

@ -375,7 +375,7 @@ void CreateShapesSection( FILE* file, BOARD* pcb )
orient = pad->m_Orient - module->m_Orient; orient = pad->m_Orient - module->m_Orient;
NORMALIZE_ANGLE_POS( orient ); NORMALIZE_ANGLE_POS( orient );
fprintf( file, "PIN %s PAD%d %d %d %s %d %s", fprintf( file, "PIN %s PAD%d %d %d %s %d %s",
CONV_TO_UTF8( pinname ), pad->GetSubRatsnest(), TO_UTF8( pinname ), pad->GetSubRatsnest(),
pad->m_Pos0.x, -pad->m_Pos0.y, pad->m_Pos0.x, -pad->m_Pos0.y,
layer, orient / 10, mirror ); layer, orient / 10, mirror );
if( orient % 10 ) if( orient % 10 )
@ -422,9 +422,9 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
} }
fprintf( file, "COMPONENT %s\n", fprintf( file, "COMPONENT %s\n",
CONV_TO_UTF8( module->m_Reference->m_Text ) ); TO_UTF8( module->m_Reference->m_Text ) );
fprintf( file, "DEVICE %s\n", fprintf( file, "DEVICE %s\n",
CONV_TO_UTF8( module->m_Reference->m_Text ) ); TO_UTF8( module->m_Reference->m_Text ) );
fprintf( file, "PLACE %d %d\n", mapXto( module->m_Pos.x ), fprintf( file, "PLACE %d %d\n", mapXto( module->m_Pos.x ),
mapYto( module->m_Pos.y ) ); mapYto( module->m_Pos.y ) );
fprintf( file, "LAYER %s\n", (module->flag) ? "BOTTOM" : "TOP" ); fprintf( file, "LAYER %s\n", (module->flag) ? "BOTTOM" : "TOP" );
@ -435,7 +435,7 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
fputs( "\n", file ); fputs( "\n", file );
fprintf( file, "SHAPE %s %s %s\n", fprintf( file, "SHAPE %s %s %s\n",
CONV_TO_UTF8( module->m_Reference->m_Text ), mirror, flip ); TO_UTF8( module->m_Reference->m_Text ), mirror, flip );
/* creates texts (ref and value) */ /* creates texts (ref and value) */
PtTexte = module->m_Reference; PtTexte = module->m_Reference;
@ -448,8 +448,8 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
PtTexte->m_Size.x, PtTexte->m_Size.x,
orient / 10, orient % 10, orient / 10, orient % 10,
mirror, mirror,
CONV_TO_UTF8( layer ), TO_UTF8( layer ),
CONV_TO_UTF8( PtTexte->m_Text ) TO_UTF8( PtTexte->m_Text )
); );
fprintf( file, " 0 0 %d %d\n", fprintf( file, " 0 0 %d %d\n",
@ -461,8 +461,8 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
//put a comment: //put a comment:
fprintf( file, "SHEET Part %s %s\n", fprintf( file, "SHEET Part %s %s\n",
CONV_TO_UTF8( module->m_Reference->m_Text ), TO_UTF8( module->m_Reference->m_Text ),
CONV_TO_UTF8( module->m_Value->m_Text ) ); TO_UTF8( module->m_Value->m_Text ) );
} }
fputs( "$ENDCOMPONENTS\n\n", file ); fputs( "$ENDCOMPONENTS\n\n", file );
@ -502,7 +502,7 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
msg = wxT( "SIGNAL " ) + net->GetNetname(); msg = wxT( "SIGNAL " ) + net->GetNetname();
fputs( CONV_TO_UTF8( msg ), file ); fputs( TO_UTF8( msg ), file );
fputs( "\n", file ); fputs( "\n", file );
for( module = pcb->m_Modules; module != NULL; module = module->Next() ) for( module = pcb->m_Modules; module != NULL; module = module->Next() )
@ -518,7 +518,7 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
GetChars( module->m_Reference->m_Text ), GetChars( module->m_Reference->m_Text ),
GetChars( padname ) ); GetChars( padname ) );
fputs( CONV_TO_UTF8( msg ), file ); fputs( TO_UTF8( msg ), file );
fputs( "\n", file ); fputs( "\n", file );
} }
} }
@ -539,18 +539,18 @@ bool CreateHeaderInfoData( FILE* file, WinEDA_PcbFrame* frame )
fputs( "GENCAD 1.4\n", file ); fputs( "GENCAD 1.4\n", file );
msg = wxT( "USER " ) + wxGetApp().GetAppName() + wxT( " " ) + msg = wxT( "USER " ) + wxGetApp().GetAppName() + wxT( " " ) +
GetBuildVersion(); GetBuildVersion();
fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file ); fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
msg = wxT( "DRAWING " ) + screen->GetFileName(); msg = wxT( "DRAWING " ) + screen->GetFileName();
fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file ); fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
msg = wxT( "REVISION " ) + screen->m_Revision + wxT( " " ) + msg = wxT( "REVISION " ) + screen->m_Revision + wxT( " " ) +
screen->m_Date; screen->m_Date;
fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file ); fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
msg.Printf( wxT( "UNITS USER %d" ), PCB_INTERNAL_UNIT ); msg.Printf( wxT( "UNITS USER %d" ), PCB_INTERNAL_UNIT );
fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file ); fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
msg.Printf( wxT( "ORIGIN %d %d" ), msg.Printf( wxT( "ORIGIN %d %d" ),
mapXto( frame->m_Auxiliary_Axis_Position.x ), mapXto( frame->m_Auxiliary_Axis_Position.x ),
mapYto( frame->m_Auxiliary_Axis_Position.y ) ); mapYto( frame->m_Auxiliary_Axis_Position.y ) );
fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file ); fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
fputs( "INTERTRACK 0\n", file ); fputs( "INTERTRACK 0\n", file );
fputs( "$ENDHEADER\n\n", file ); fputs( "$ENDHEADER\n\n", file );
@ -638,7 +638,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
netname = net->GetNetname(); netname = net->GetNetname();
else else
netname = wxT( "_noname_" ); netname = wxT( "_noname_" );
fprintf( file, "ROUTE %s\n", CONV_TO_UTF8( netname ) ); fprintf( file, "ROUTE %s\n", TO_UTF8( netname ) );
} }
if( old_width != track->m_Width ) if( old_width != track->m_Width )
@ -653,7 +653,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
{ {
old_layer = track->GetLayer(); old_layer = track->GetLayer();
fprintf( file, "LAYER %s\n", fprintf( file, "LAYER %s\n",
CONV_TO_UTF8( GenCAD_Layer_Name[track->GetLayer() & TO_UTF8( GenCAD_Layer_Name[track->GetLayer() &
0x1F] ) ); 0x1F] ) );
} }
@ -690,8 +690,8 @@ void CreateDevicesSection( FILE* file, BOARD* pcb )
for( module = pcb->m_Modules; module != NULL; module = module->Next() ) for( module = pcb->m_Modules; module != NULL; module = module->Next() )
{ {
fprintf( file, "DEVICE %s\n", fprintf( file, "DEVICE %s\n",
CONV_TO_UTF8( module->m_Reference->m_Text ) ); TO_UTF8( module->m_Reference->m_Text ) );
fprintf( file, "PART %s\n", CONV_TO_UTF8( module->m_LibRef ) ); fprintf( file, "PART %s\n", TO_UTF8( module->m_LibRef ) );
fprintf( file, "TYPE %s\n", "UNKNOWN" ); fprintf( file, "TYPE %s\n", "UNKNOWN" );
for( pad = module->m_Pads; pad != NULL; pad = pad->Next() ) for( pad = module->m_Pads; pad != NULL; pad = pad->Next() )
{ {
@ -703,7 +703,7 @@ void CreateDevicesSection( FILE* file, BOARD* pcb )
} }
fprintf( file, "ATTRIBUTE %s\n", fprintf( file, "ATTRIBUTE %s\n",
CONV_TO_UTF8( module->m_Value->m_Text ) ); TO_UTF8( module->m_Value->m_Text ) );
} }
fputs( "$ENDDEVICES\n\n", file ); fputs( "$ENDDEVICES\n\n", file );
@ -824,7 +824,7 @@ void FootprintWriteShape( FILE* file, MODULE* module )
// module / mirror axis and conventions) // module / mirror axis and conventions)
/* creates header: */ /* creates header: */
fprintf( file, "SHAPE %s\n", CONV_TO_UTF8( module->m_Reference->m_Text ) ); fprintf( file, "SHAPE %s\n", TO_UTF8( module->m_Reference->m_Text ) );
fprintf( file, "INSERT %s\n", fprintf( file, "INSERT %s\n",
(module->m_Attributs & MOD_CMS) ? "SMD" : "TH" ); (module->m_Attributs & MOD_CMS) ? "SMD" : "TH" );

View File

@ -1104,7 +1104,7 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
offsetz + layer_z[aModule->GetLayer()] ); offsetz + layer_z[aModule->GetLayer()] );
fprintf( aOutputFile, fprintf( aOutputFile,
" children [\n Inline {\n url \"%s\"\n } ]\n", " children [\n Inline {\n url \"%s\"\n } ]\n",
CONV_TO_UTF8( fname ) ); TO_UTF8( fname ) );
fprintf( aOutputFile, " }\n" ); fprintf( aOutputFile, " }\n" );
} }
@ -1194,7 +1194,7 @@ bool WinEDA_PcbFrame::ExportVRML_File( const wxString & aFullFileName,
fprintf( output_file, "#VRML V2.0 utf8\n" fprintf( output_file, "#VRML V2.0 utf8\n"
"WorldInfo {\n" "WorldInfo {\n"
" title \"%s - Generated by PCBNEW\"\n" " title \"%s - Generated by PCBNEW\"\n"
"}\n", CONV_TO_UTF8( aFullFileName ) ); "}\n", TO_UTF8( aFullFileName ) );
/* The would be in decimils and not in meters, as the standard wants. /* The would be in decimils and not in meters, as the standard wants.
* It is trivial to embed everything in a transform node to * It is trivial to embed everything in a transform node to

View File

@ -203,7 +203,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
sprintf( line, "%2.2fmm / %2.3f\" ", sprintf( line, "%2.2fmm / %2.3f\" ",
double (aToolListBuffer[ii].m_Diameter) * 0.00254, double (aToolListBuffer[ii].m_Diameter) * 0.00254,
double (aToolListBuffer[ii].m_Diameter) * 0.0001 ); double (aToolListBuffer[ii].m_Diameter) * 0.0001 );
msg = CONV_FROM_UTF8( line ); msg = FROM_UTF8( line );
// Now list how many holes and ovals are associated with each drill. // Now list how many holes and ovals are associated with each drill.
if( ( aToolListBuffer[ii].m_TotalCount == 1 ) if( ( aToolListBuffer[ii].m_TotalCount == 1 )
@ -222,7 +222,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
aToolListBuffer[ii].m_TotalCount - aToolListBuffer[ii].m_TotalCount -
aToolListBuffer[ii].m_OvalCount, aToolListBuffer[ii].m_OvalCount,
aToolListBuffer[ii].m_OvalCount ); aToolListBuffer[ii].m_OvalCount );
msg += CONV_FROM_UTF8( line ); msg += FROM_UTF8( line );
plotter->text( wxPoint( plotX, y ), BLACK, plotter->text( wxPoint( plotX, y ), BLACK,
msg, msg,
0, wxSize( (int) ( CharSize * CharScale ), (int) ( CharSize * CharScale ) ), 0, wxSize( (int) ( CharSize * CharScale ), (int) ( CharSize * CharScale ) ),
@ -301,7 +301,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
bool gen_through_holes = true; bool gen_through_holes = true;
fprintf( aFile, "Drill report for %s\n", CONV_TO_UTF8( aBoardFilename ) ); fprintf( aFile, "Drill report for %s\n", TO_UTF8( aBoardFilename ) );
fprintf( aFile, "Created on %s\n", DateAndTime( line ) ); fprintf( aFile, "Created on %s\n", DateAndTime( line ) );
// List which Drill Unit option had been selected for the associated // List which Drill Unit option had been selected for the associated
@ -340,8 +340,8 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
} }
sprintf( line, "Drill report for holes from layer %s to layer %s\n", sprintf( line, "Drill report for holes from layer %s to layer %s\n",
CONV_TO_UTF8( aPcb->GetLayerName( layer1 ) ), TO_UTF8( aPcb->GetLayerName( layer1 ) ),
CONV_TO_UTF8( aPcb->GetLayerName( layer2 ) ) ); TO_UTF8( aPcb->GetLayerName( layer2 ) ) );
} }
fputs( line, aFile ); fputs( line, aFile );

View File

@ -99,7 +99,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
if( module->m_Attributs & MOD_VIRTUAL ) if( module->m_Attributs & MOD_VIRTUAL )
{ {
D( printf( "skipping module %s because it's virtual\n", D( printf( "skipping module %s because it's virtual\n",
CONV_TO_UTF8( module->GetReference() ) );) TO_UTF8( module->GetReference() ) );)
continue; continue;
} }
@ -114,7 +114,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
else else
{ {
printf( "skipping %s because its attribute is not CMS and it has non SMD pins\n", printf( "skipping %s because its attribute is not CMS and it has non SMD pins\n",
CONV_TO_UTF8(module->GetReference()) ); TO_UTF8(module->GetReference()) );
continue; continue;
} }
#else #else
@ -217,7 +217,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
fputs( line, fpBack ); fputs( line, fpBack );
Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion(); Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
sprintf( line, "### Printed by PcbNew version %s\n", CONV_TO_UTF8( Title ) ); sprintf( line, "### Printed by PcbNew version %s\n", TO_UTF8( Title ) );
fputs( line, fpFront ); fputs( line, fpFront );
if( doBoardBack ) if( doBoardBack )
@ -229,12 +229,12 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
if( doBoardBack ) if( doBoardBack )
fputs( line, fpBack ); fputs( line, fpBack );
sprintf( line, "## Side : %s\n", CONV_TO_UTF8( frontLayerName ) ); sprintf( line, "## Side : %s\n", TO_UTF8( frontLayerName ) );
fputs( line, fpFront ); fputs( line, fpFront );
if( doBoardBack ) if( doBoardBack )
{ {
sprintf( line, "## Side : %s\n", CONV_TO_UTF8( backLayerName ) ); sprintf( line, "## Side : %s\n", TO_UTF8( backLayerName ) );
fputs( line, fpBack ); fputs( line, fpBack );
} }
@ -249,8 +249,8 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
wxPoint module_pos; wxPoint module_pos;
wxString ref = Liste[ii].m_Reference; wxString ref = Liste[ii].m_Reference;
wxString val = Liste[ii].m_Value; wxString val = Liste[ii].m_Value;
sprintf( line, "%-8.8s %-16.16s ", CONV_TO_UTF8( ref ), sprintf( line, "%-8.8s %-16.16s ", TO_UTF8( ref ),
CONV_TO_UTF8( val ) ); TO_UTF8( val ) );
module_pos = Liste[ii].m_Module->m_Pos; module_pos = Liste[ii].m_Module->m_Pos;
module_pos.x -= File_Place_Offset.x; module_pos.x -= File_Place_Offset.x;
@ -268,13 +268,13 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
if( layer == LAYER_N_FRONT ) if( layer == LAYER_N_FRONT )
{ {
strcat( line, CONV_TO_UTF8( frontLayerName ) ); strcat( line, TO_UTF8( frontLayerName ) );
strcat( line, "\n" ); strcat( line, "\n" );
fputs( line, fpFront ); fputs( line, fpFront );
} }
else if( layer == LAYER_N_BACK ) else if( layer == LAYER_N_BACK )
{ {
strcat( line, CONV_TO_UTF8( backLayerName ) ); strcat( line, TO_UTF8( backLayerName ) );
strcat( line, "\n" ); strcat( line, "\n" );
fputs( line, fpBack ); fputs( line, fpBack );
} }
@ -361,7 +361,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
fputs( line, rptfile ); fputs( line, rptfile );
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion(); wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
sprintf( line, "## Created by PcbNew version %s\n", CONV_TO_UTF8( Title ) ); sprintf( line, "## Created by PcbNew version %s\n", TO_UTF8( Title ) );
fputs( line, rptfile ); fputs( line, rptfile );
fputs( "## Unit = inches, Angle = deg.\n", rptfile ); fputs( "## Unit = inches, Angle = deg.\n", rptfile );
@ -387,16 +387,16 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
sprintf( line, "$MODULE \"%s\"\n", sprintf( line, "$MODULE \"%s\"\n",
CONV_TO_UTF8( Module->m_Reference->m_Text ) ); TO_UTF8( Module->m_Reference->m_Text ) );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "reference \"%s\"\n", sprintf( line, "reference \"%s\"\n",
CONV_TO_UTF8( Module->m_Reference->m_Text ) ); TO_UTF8( Module->m_Reference->m_Text ) );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "value \"%s\"\n", sprintf( line, "value \"%s\"\n",
CONV_TO_UTF8( Module->m_Value->m_Text ) ); TO_UTF8( Module->m_Value->m_Text ) );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "footprint \"%s\"\n", CONV_TO_UTF8( Module->m_LibRef ) ); sprintf( line, "footprint \"%s\"\n", TO_UTF8( Module->m_LibRef ) );
fputs( line, rptfile ); fputs( line, rptfile );
msg = wxT( "attribut" ); msg = wxT( "attribut" );
@ -407,7 +407,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
if( ( Module->m_Attributs & (MOD_VIRTUAL | MOD_CMS) ) == 0 ) if( ( Module->m_Attributs & (MOD_VIRTUAL | MOD_CMS) ) == 0 )
msg += wxT( " none" ); msg += wxT( " none" );
msg += wxT( "\n" ); msg += wxT( "\n" );
fputs( CONV_TO_UTF8( msg ), rptfile ); fputs( TO_UTF8( msg ), rptfile );
module_pos = Module->m_Pos; module_pos = Module->m_Pos;
module_pos.x -= File_Place_Offset.x; module_pos.x -= File_Place_Offset.x;
@ -468,7 +468,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
} }
fprintf( rptfile, "$EndMODULE %s\n\n", fprintf( rptfile, "$EndMODULE %s\n\n",
CONV_TO_UTF8(Module->m_Reference->m_Text ) ); TO_UTF8(Module->m_Reference->m_Text ) );
} }
/* Write board Edges */ /* Write board Edges */

View File

@ -442,7 +442,7 @@ void EXCELLON_WRITER::WriteCoordinates( char * aLine, double aCoordX, double aCo
while( ys[j] == '0' && j ) while( ys[j] == '0' && j )
ys.Truncate( j-- ); ys.Truncate( j-- );
sprintf( aLine, "X%sY%s\n", CONV_TO_UTF8( xs ), CONV_TO_UTF8( ys ) ); sprintf( aLine, "X%sY%s\n", TO_UTF8( xs ), TO_UTF8( ys ) );
break; break;
} }
@ -458,7 +458,7 @@ void EXCELLON_WRITER::WriteCoordinates( char * aLine, double aCoordX, double aCo
ypad++; ypad++;
xs.Printf( wxT( "%0*d" ), xpad, wxRound( aCoordX ) ); xs.Printf( wxT( "%0*d" ), xpad, wxRound( aCoordX ) );
ys.Printf( wxT( "%0*d" ), ypad, wxRound( aCoordY ) ); ys.Printf( wxT( "%0*d" ), ypad, wxRound( aCoordY ) );
sprintf( aLine, "X%sY%s\n", CONV_TO_UTF8( xs ), CONV_TO_UTF8( ys ) ); sprintf( aLine, "X%sY%s\n", TO_UTF8( xs ), TO_UTF8( ys ) );
break; break;
} }
} }
@ -483,7 +483,7 @@ void EXCELLON_WRITER::WriteHeader( )
// The next 2 lines in EXCELLON files are comments: // The next 2 lines in EXCELLON files are comments:
wxString msg = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion(); wxString msg = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
fprintf( m_file, ";DRILL file {%s} date %s\n", CONV_TO_UTF8( msg ), fprintf( m_file, ";DRILL file {%s} date %s\n", TO_UTF8( msg ),
Line ); Line );
msg = wxT( ";FORMAT={" ); msg = wxT( ";FORMAT={" );
@ -513,7 +513,7 @@ void EXCELLON_WRITER::WriteHeader( )
msg << zero_fmt[m_zeroFormat]; msg << zero_fmt[m_zeroFormat];
msg << wxT( "}\n" ); msg << wxT( "}\n" );
fputs( CONV_TO_UTF8( msg ), m_file ); fputs( TO_UTF8( msg ), m_file );
fputs( "FMAT,2\n", m_file ); // Use Format 2 commands (version used since 1979) fputs( "FMAT,2\n", m_file ); // Use Format 2 commands (version used since 1979)
} }

View File

@ -348,7 +348,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
// Read pad number: // Read pad number:
if( params.GetCount() > 10 ) if( params.GetCount() > 10 )
{ {
strncpy( Pad->m_Padname, CONV_TO_UTF8( params[10] ), 4 ); strncpy( Pad->m_Padname, TO_UTF8( params[10] ), 4 );
} }
Pad->m_Pos.x = (ibuf[0] + ibuf[2]) / 2; Pad->m_Pos.x = (ibuf[0] + ibuf[2]) / 2;
Pad->m_Pos.y = (ibuf[1] + ibuf[3]) / 2; Pad->m_Pos.y = (ibuf[1] + ibuf[3]) / 2;
@ -399,7 +399,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
// Read pad number: // Read pad number:
if( params.GetCount() > 9 ) if( params.GetCount() > 9 )
{ {
strncpy( Pad->m_Padname, CONV_TO_UTF8( params[9] ), 4 ); strncpy( Pad->m_Padname, TO_UTF8( params[9] ), 4 );
} }
Pad->m_Pos.x = ibuf[0]; Pad->m_Pos.x = ibuf[0];
Pad->m_Pos.y = ibuf[1]; Pad->m_Pos.y = ibuf[1];

View File

@ -394,7 +394,7 @@ int WinEDA_BasePcbFrame::ReadSetup( LINE_READER* aReader )
if( data ) if( data )
{ {
wxString layerName = CONV_FROM_UTF8( data ); wxString layerName = FROM_UTF8( data );
GetBoard()->SetLayerName( layer, layerName ); GetBoard()->SetLayerName( layer, layerName );
data = strtok( NULL, " \n\r" ); data = strtok( NULL, " \n\r" );
@ -660,7 +660,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
if( layerMask & 1 ) if( layerMask & 1 )
{ {
fprintf( aFile, "Layer[%d] %s %s\n", layer, fprintf( aFile, "Layer[%d] %s %s\n", layer,
CONV_TO_UTF8( aBoard->GetLayerName( layer ) ), TO_UTF8( aBoard->GetLayerName( layer ) ),
LAYER::ShowType( aBoard->GetLayerType( layer ) ) ); LAYER::ShowType( aBoard->GetLayerType( layer ) ) );
} }
} }
@ -754,10 +754,10 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
g_PcbPlotOptions.Format( &sf, 0 ); g_PcbPlotOptions.Format( &sf, 0 );
wxString record = CONV_FROM_UTF8( sf.GetString().c_str() ); wxString record = FROM_UTF8( sf.GetString().c_str() );
record.Replace( wxT("\n"), wxT(""), true ); record.Replace( wxT("\n"), wxT(""), true );
record.Replace( wxT(" "), wxT(" "), true); record.Replace( wxT(" "), wxT(" "), true);
fprintf( aFile, "PcbPlotParams %s\n", CONV_TO_UTF8( record ) ); fprintf( aFile, "PcbPlotParams %s\n", TO_UTF8( record ) );
fprintf( aFile, "$EndSETUP\n\n" ); fprintf( aFile, "$EndSETUP\n\n" );
return 1; return 1;
@ -775,6 +775,7 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
/* Write copper layer count */ /* Write copper layer count */
NbLayers = GetBoard()->GetCopperLayerCount(); NbLayers = GetBoard()->GetCopperLayerCount();
fprintf( File, "$GENERAL\n" ); fprintf( File, "$GENERAL\n" );
fprintf( File, "encoding utf-8\n");
fprintf( File, "LayerCount %d\n", NbLayers ); fprintf( File, "LayerCount %d\n", NbLayers );
// Write old format for Layer count (for compatibility with old versions of // Write old format for Layer count (for compatibility with old versions of
@ -829,15 +830,15 @@ 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",
CONV_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", CONV_TO_UTF8( screen->m_Title ) ); fprintf( File, "Title \"%s\"\n", TO_UTF8( screen->m_Title ) );
fprintf( File, "Date \"%s\"\n", CONV_TO_UTF8( screen->m_Date ) ); fprintf( File, "Date \"%s\"\n", TO_UTF8( screen->m_Date ) );
fprintf( File, "Rev \"%s\"\n", CONV_TO_UTF8( screen->m_Revision ) ); fprintf( File, "Rev \"%s\"\n", TO_UTF8( screen->m_Revision ) );
fprintf( File, "Comp \"%s\"\n", CONV_TO_UTF8( screen->m_Company ) ); fprintf( File, "Comp \"%s\"\n", TO_UTF8( screen->m_Company ) );
fprintf( File, "Comment1 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire1 ) ); fprintf( File, "Comment1 \"%s\"\n", TO_UTF8( screen->m_Commentaire1 ) );
fprintf( File, "Comment2 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire2 ) ); fprintf( File, "Comment2 \"%s\"\n", TO_UTF8( screen->m_Commentaire2 ) );
fprintf( File, "Comment3 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire3 ) ); fprintf( File, "Comment3 \"%s\"\n", TO_UTF8( screen->m_Commentaire3 ) );
fprintf( File, "Comment4 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire4 ) ); fprintf( File, "Comment4 \"%s\"\n", TO_UTF8( screen->m_Commentaire4 ) );
fprintf( File, "$EndSHEETDESCR\n\n" ); fprintf( File, "$EndSHEETDESCR\n\n" );
return TRUE; return TRUE;
@ -862,7 +863,7 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
int ii; int ii;
for( ii = 0; sheet != NULL; ii++, sheet = g_SheetSizeList[ii] ) for( ii = 0; sheet != NULL; ii++, sheet = g_SheetSizeList[ii] )
{ {
if( stricmp( CONV_TO_UTF8( sheet->m_Name ), text ) == 0 ) if( stricmp( TO_UTF8( sheet->m_Name ), text ) == 0 )
{ {
screen->m_CurrentSheetDesc = sheet; screen->m_CurrentSheetDesc = sheet;
if( sheet == &g_Sheet_user ) if( sheet == &g_Sheet_user )
@ -884,56 +885,56 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
if( strnicmp( Line, "Title", 2 ) == 0 ) if( strnicmp( Line, "Title", 2 ) == 0 )
{ {
ReadDelimitedText( buf, Line, 256 ); ReadDelimitedText( buf, Line, 256 );
screen->m_Title = CONV_FROM_UTF8( buf ); screen->m_Title = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( Line, "Date", 2 ) == 0 ) if( strnicmp( Line, "Date", 2 ) == 0 )
{ {
ReadDelimitedText( buf, Line, 256 ); ReadDelimitedText( buf, Line, 256 );
screen->m_Date = CONV_FROM_UTF8( buf ); screen->m_Date = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( Line, "Rev", 2 ) == 0 ) if( strnicmp( Line, "Rev", 2 ) == 0 )
{ {
ReadDelimitedText( buf, Line, 256 ); ReadDelimitedText( buf, Line, 256 );
screen->m_Revision = CONV_FROM_UTF8( buf ); screen->m_Revision = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( Line, "Comp", 4 ) == 0 ) if( strnicmp( Line, "Comp", 4 ) == 0 )
{ {
ReadDelimitedText( buf, Line, 256 ); ReadDelimitedText( buf, Line, 256 );
screen->m_Company = CONV_FROM_UTF8( buf ); screen->m_Company = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( Line, "Comment1", 8 ) == 0 ) if( strnicmp( Line, "Comment1", 8 ) == 0 )
{ {
ReadDelimitedText( buf, Line, 256 ); ReadDelimitedText( buf, Line, 256 );
screen->m_Commentaire1 = CONV_FROM_UTF8( buf ); screen->m_Commentaire1 = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( Line, "Comment2", 8 ) == 0 ) if( strnicmp( Line, "Comment2", 8 ) == 0 )
{ {
ReadDelimitedText( buf, Line, 256 ); ReadDelimitedText( buf, Line, 256 );
screen->m_Commentaire2 = CONV_FROM_UTF8( buf ); screen->m_Commentaire2 = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( Line, "Comment3", 8 ) == 0 ) if( strnicmp( Line, "Comment3", 8 ) == 0 )
{ {
ReadDelimitedText( buf, Line, 256 ); ReadDelimitedText( buf, Line, 256 );
screen->m_Commentaire3 = CONV_FROM_UTF8( buf ); screen->m_Commentaire3 = FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( Line, "Comment4", 8 ) == 0 ) if( strnicmp( Line, "Comment4", 8 ) == 0 )
{ {
ReadDelimitedText( buf, Line, 256 ); ReadDelimitedText( buf, Line, 256 );
screen->m_Commentaire4 = CONV_FROM_UTF8( buf ); screen->m_Commentaire4 = FROM_UTF8( buf );
continue; continue;
} }
} }
@ -1147,7 +1148,7 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB, fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
DateAndTime( line ) ); DateAndTime( line ) );
fprintf( aFile, "# Created by Pcbnew%s\n\n", fprintf( aFile, "# Created by Pcbnew%s\n\n",
CONV_TO_UTF8( GetBuildVersion() ) ); TO_UTF8( GetBuildVersion() ) );
GetBoard()->SynchronizeNetsAndNetClasses(); GetBoard()->SynchronizeNetsAndNetClasses();

View File

@ -217,7 +217,7 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& event )
wxString colorTxt = eventSource->GetName(); wxString colorTxt = eventSource->GetName();
int oldColor = strtoul( CONV_TO_UTF8(colorTxt), NULL, 0 ); int oldColor = strtoul( TO_UTF8(colorTxt), NULL, 0 );
int newColor = DisplayColorFrame( this, oldColor ); int newColor = DisplayColorFrame( this, oldColor );
if( newColor >= 0 ) if( newColor >= 0 )
@ -252,7 +252,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event )
wxString colorTxt = eventSource->GetName(); wxString colorTxt = eventSource->GetName();
int oldColor = strtoul( CONV_TO_UTF8(colorTxt), NULL, 0 ); int oldColor = strtoul( TO_UTF8(colorTxt), NULL, 0 );
int newColor = DisplayColorFrame( this, oldColor ); int newColor = DisplayColorFrame( this, oldColor );
if( newColor >= 0 ) if( newColor >= 0 )
@ -747,7 +747,7 @@ int LAYER_WIDGET::GetLayerColor( int aLayer )
wxASSERT( bmb ); wxASSERT( bmb );
wxString colorTxt = bmb->GetName(); wxString colorTxt = bmb->GetName();
int color = strtoul( CONV_TO_UTF8(colorTxt), NULL, 0 ); int color = strtoul( TO_UTF8(colorTxt), NULL, 0 );
return color; return color;
} }

View File

@ -198,9 +198,10 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* aModule, bool aCreateSysLib
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
fprintf( file, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) ); fprintf( file, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) );
fprintf( file, "# encoding utf-8\n");
fputs( "$INDEX\n", file ); fputs( "$INDEX\n", file );
fprintf( file, "%s\n", CONV_TO_UTF8( aModule->m_LibRef ) ); fprintf( file, "%s\n", TO_UTF8( aModule->m_LibRef ) );
fputs( "$EndINDEX\n", file ); fputs( "$EndINDEX\n", file );
GetBoard()->m_Modules->Save( file ); GetBoard()->m_Modules->Save( file );
@ -269,7 +270,7 @@ void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const wxString& aLibname
while( GetLine( lib_module, Line, &LineNum ) ) while( GetLine( lib_module, Line, &LineNum ) )
{ {
StrPurge( Line ); StrPurge( Line );
msg = CONV_FROM_UTF8( Line ); msg = FROM_UTF8( Line );
if( CmpName.CmpNoCase( msg ) == 0 ) /* New module? */ if( CmpName.CmpNoCase( msg ) == 0 ) /* New module? */
{ {
NoFound = 0; break; NoFound = 0; break;
@ -307,7 +308,9 @@ void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const wxString& aLibname
/* Create header with new date. */ /* Create header with new date. */
fprintf( dest, ENTETE_LIBRAIRIE ); fprintf( dest, ENTETE_LIBRAIRIE );
fprintf( dest, " %s\n$INDEX\n", DateAndTime( Line ) ); fprintf( dest, " %s\n$", DateAndTime( Line ) );
fprintf( dest, "# encoding utf-8\n");
fprintf( dest, "$INDEX\n" );
fseek( lib_module, 0, 0 ); fseek( lib_module, 0, 0 );
GetLine( lib_module, Line, &ii ); GetLine( lib_module, Line, &ii );
@ -323,7 +326,7 @@ void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const wxString& aLibname
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 ) if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
break; break;
StrPurge( Line ); StrPurge( Line );
msg = CONV_FROM_UTF8( Line ); msg = FROM_UTF8( Line );
if( CmpName.CmpNoCase( msg ) != 0 ) if( CmpName.CmpNoCase( msg ) != 0 )
fprintf( dest, "%s\n", Line ); fprintf( dest, "%s\n", Line );
} }
@ -341,7 +344,7 @@ void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const wxString& aLibname
if( strnicmp( Line, "$MODULE", 7 ) == 0 ) if( strnicmp( Line, "$MODULE", 7 ) == 0 )
{ {
sscanf( Line + 7, " %s", Name ); sscanf( Line + 7, " %s", Name );
msg = CONV_FROM_UTF8( Name ); msg = FROM_UTF8( Name );
if( msg.CmpNoCase( CmpName ) == 0 ) if( msg.CmpNoCase( CmpName ) == 0 )
{ {
/* Delete old module. */ /* Delete old module. */
@ -449,6 +452,7 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName,
} }
char Line[256]; char Line[256];
fprintf( lib_module, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) ); fprintf( lib_module, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) );
fprintf( lib_module, "# encoding utf-8\n");
fputs( "$INDEX\n", lib_module ); fputs( "$INDEX\n", lib_module );
fputs( "$EndINDEX\n", lib_module ); fputs( "$EndINDEX\n", lib_module );
fputs( "$EndLIBRARY\n", lib_module ); fputs( "$EndLIBRARY\n", lib_module );
@ -564,7 +568,7 @@ bool WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
} }
StrPurge( Line ); StrPurge( Line );
msg = CONV_FROM_UTF8( Line ); msg = FROM_UTF8( Line );
if( Name_Cmp.CmpNoCase( msg ) == 0 ) /* an existing footprint is if( Name_Cmp.CmpNoCase( msg ) == 0 ) /* an existing footprint is
* found */ * found */
{ {
@ -616,7 +620,9 @@ bool WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
/* Create the library header with a new date */ /* Create the library header with a new date */
fprintf( dest, ENTETE_LIBRAIRIE ); fprintf( dest, ENTETE_LIBRAIRIE );
fprintf( dest, " %s\n$INDEX\n", DateAndTime( Line ) ); fprintf( dest, " %s\n", DateAndTime( Line ) );
fprintf( dest, "# encoding utf-8\n");
fprintf( dest, "$INDEX\n" );
LineNum = 0; LineNum = 0;
GetLine( lib_module, Line, &LineNum ); GetLine( lib_module, Line, &LineNum );
@ -635,7 +641,7 @@ bool WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
} }
} }
if( newmodule ) if( newmodule )
fprintf( dest, "%s\n", CONV_TO_UTF8( Name_Cmp ) ); fprintf( dest, "%s\n", TO_UTF8( Name_Cmp ) );
if( strnicmp( Line, "$EndINDEX", 0 ) == 0 ) if( strnicmp( Line, "$EndINDEX", 0 ) == 0 )
break; break;
} }
@ -651,7 +657,7 @@ bool WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
if( strnicmp( Line, "$MODULE", 7 ) == 0 ) if( strnicmp( Line, "$MODULE", 7 ) == 0 )
{ {
sscanf( Line + 7, " %s", Name ); sscanf( Line + 7, " %s", Name );
msg = CONV_FROM_UTF8( Name ); msg = FROM_UTF8( Name );
if( msg.CmpNoCase( Name_Cmp ) == 0 ) if( msg.CmpNoCase( Name_Cmp ) == 0 )
{ {
/* skip old footprint descr (delete from the lib) */ /* skip old footprint descr (delete from the lib) */

View File

@ -277,7 +277,7 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module(
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 ) if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
break; break;
StrPurge( Line ); StrPurge( Line );
msg = CONV_FROM_UTF8( Line ); msg = FROM_UTF8( Line );
if( msg.CmpNoCase( aModuleName ) == 0 ) if( msg.CmpNoCase( aModuleName ) == 0 )
{ {
Found = 1; Found = 1;
@ -303,7 +303,7 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module(
StrPurge( Line + 8 ); StrPurge( Line + 8 );
// Read module name. // Read module name.
Name = CONV_FROM_UTF8( Line + 8 ); Name = FROM_UTF8( Line + 8 );
if( Name.CmpNoCase( aModuleName ) == 0 ) if( Name.CmpNoCase( aModuleName ) == 0 )
{ {

View File

@ -430,22 +430,22 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
if( ( text = strtok( Line, " ()\t\n" ) ) == NULL ) if( ( text = strtok( Line, " ()\t\n" ) ) == NULL )
Error = 1; Error = 1;
else else
TimeStampPath = CONV_FROM_UTF8( text ); TimeStampPath = FROM_UTF8( text );
if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL ) if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL )
Error = 1; Error = 1;
else else
TextNameLibMod = CONV_FROM_UTF8( text ); TextNameLibMod = FROM_UTF8( text );
if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL ) if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL )
Error = 1; Error = 1;
else else
TextCmpName = CONV_FROM_UTF8( text ); TextCmpName = FROM_UTF8( text );
if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL ) if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL )
Error = -1; Error = -1;
else else
TextValeur = CONV_FROM_UTF8( text ); TextValeur = FROM_UTF8( text );
if( Error > 0 ) if( Error > 0 )
return NULL; return NULL;
@ -612,7 +612,7 @@ int SetPadNetName( char* Text,
{ {
trouve = true; trouve = true;
if( *TextNetName != '?' ) if( *TextNetName != '?' )
pad->SetNetname( CONV_FROM_UTF8( TextNetName ) ); pad->SetNetname( FROM_UTF8( TextNetName ) );
else else
pad->SetNetname( wxEmptyString ); pad->SetNetname( wxEmptyString );
} }
@ -622,7 +622,7 @@ int SetPadNetName( char* Text,
{ {
if( aMessageWindow ) if( aMessageWindow )
{ {
wxString pin_name = CONV_FROM_UTF8( TextPinName ); wxString pin_name = FROM_UTF8( TextPinName );
Msg.Printf( _( "Module [%s]: Pad [%s] not found" ), Msg.Printf( _( "Module [%s]: Pad [%s] not found" ),
GetChars( Module->m_Reference->m_Text ), GetChars( Module->m_Reference->m_Text ),
GetChars( pin_name ) ); GetChars( pin_name ) );
@ -838,7 +838,7 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
if( ( Text = strtok( NULL, " ()\t\n" ) ) == NULL ) if( ( Text = strtok( NULL, " ()\t\n" ) ) == NULL )
Error = 1; Error = 1;
nb_modules_lus++; nb_modules_lus++;
aBufName.Add( CONV_FROM_UTF8( Text ) ); aBufName.Add( FROM_UTF8( Text ) );
continue; continue;
} }
@ -925,7 +925,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
ptcar = Line + 11; ptcar = Line + 11;
ptcar = strtok( ptcar, " =;\t\n" ); ptcar = strtok( ptcar, " =;\t\n" );
if( ptcar ) if( ptcar )
refcurrcmp = CONV_FROM_UTF8( ptcar ); refcurrcmp = FROM_UTF8( ptcar );
continue; continue;
} }
@ -934,7 +934,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
ptcar = Line + 11; ptcar = Line + 11;
ptcar = strtok( ptcar, " =;\t\n" ); ptcar = strtok( ptcar, " =;\t\n" );
if( ptcar ) if( ptcar )
idmod = CONV_FROM_UTF8( ptcar ); idmod = FROM_UTF8( ptcar );
continue; continue;
} }
if( strnicmp( Line, "TimeStamp =", 11 ) == 0 ) if( strnicmp( Line, "TimeStamp =", 11 ) == 0 )
@ -942,7 +942,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
ptcar = Line + 11; ptcar = Line + 11;
ptcar = strtok( ptcar, " =;\t\n" ); ptcar = strtok( ptcar, " =;\t\n" );
if( ptcar ) if( ptcar )
timestamp = CONV_FROM_UTF8( ptcar ); timestamp = FROM_UTF8( ptcar );
} }
} }

View File

@ -29,7 +29,7 @@
#include "plot_common.h" #include "plot_common.h"
#include "macros.h" #include "macros.h"
#define PLOT_LINEWIDTH_MIN 40 #define PLOT_LINEWIDTH_MIN 0
#define PLOT_LINEWIDTH_MAX 200 #define PLOT_LINEWIDTH_MAX 200
#define HPGL_PEN_DIAMETER_MIN 0 #define HPGL_PEN_DIAMETER_MIN 0
#define HPGL_PEN_DIAMETER_MAX 100 #define HPGL_PEN_DIAMETER_MAX 100
@ -377,7 +377,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
break; break;
case T_outputdirectory: case T_outputdirectory:
NeedSYMBOL(); NeedSYMBOL();
aPcbPlotParams->outputDirectory = CONV_FROM_UTF8( CurText() ); aPcbPlotParams->outputDirectory = FROM_UTF8( CurText() );
break; break;
default: default:
Unexpected( CurText() ); Unexpected( CurText() );

View File

@ -55,7 +55,7 @@ int main( int argc, char** argv )
if( argc == 2 ) if( argc == 2 )
{ {
filename = CONV_FROM_UTF8( argv[1] ); filename = FROM_UTF8( argv[1] );
} }
try try
@ -65,7 +65,7 @@ int main( int argc, char** argv )
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
fprintf( stderr, "%s\n", CONV_TO_UTF8(ioe.errorText) ); fprintf( stderr, "%s\n", TO_UTF8(ioe.errorText) );
failed = true; failed = true;
} }

View File

@ -194,7 +194,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
char buf[1024]; char buf[1024];
strcpy( buf, Line + 12 ); strcpy( buf, Line + 12 );
strtok( buf, ";\n\r" ); strtok( buf, ";\n\r" );
if( stricmp( buf, CONV_TO_UTF8( reference ) ) == 0 ) if( stricmp( buf, TO_UTF8( reference ) ) == 0 )
{ {
start_descr = true; start_descr = true;
} }
@ -208,7 +208,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
if( start_descr && strnicmp( Line, "IdModule", 8 ) == 0 ) if( start_descr && strnicmp( Line, "IdModule", 8 ) == 0 )
{ {
sprintf( Line + 8, " = %s;\n", CONV_TO_UTF8( new_name ) ); sprintf( Line + 8, " = %s;\n", TO_UTF8( new_name ) );
msg = wxT( " * in <" ) + fn.GetFullPath() + wxT( ">.\n" ); msg = wxT( " * in <" ) + fn.GetFullPath() + wxT( ">.\n" );
m_WinMessages->AppendText( msg ); m_WinMessages->AppendText( msg );
@ -606,15 +606,15 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
{ {
fprintf( FichCmp, "\nBeginCmp\n" ); fprintf( FichCmp, "\nBeginCmp\n" );
fprintf( FichCmp, "TimeStamp = %8.8lX\n", Module->m_TimeStamp ); fprintf( FichCmp, "TimeStamp = %8.8lX\n", Module->m_TimeStamp );
fprintf( FichCmp, "Path = %s\n", CONV_TO_UTF8( Module->m_Path ) ); fprintf( FichCmp, "Path = %s\n", TO_UTF8( Module->m_Path ) );
fprintf( FichCmp, "Reference = %s;\n", fprintf( FichCmp, "Reference = %s;\n",
!Module->m_Reference->m_Text.IsEmpty() ? !Module->m_Reference->m_Text.IsEmpty() ?
CONV_TO_UTF8( Module->m_Reference->m_Text ) : "[NoRef]" ); TO_UTF8( Module->m_Reference->m_Text ) : "[NoRef]" );
fprintf( FichCmp, "ValeurCmp = %s;\n", fprintf( FichCmp, "ValeurCmp = %s;\n",
!Module->m_Value->m_Text.IsEmpty() ? !Module->m_Value->m_Text.IsEmpty() ?
CONV_TO_UTF8( Module->m_Value->m_Text ) : "[NoVal]" ); TO_UTF8( Module->m_Value->m_Text ) : "[NoVal]" );
fprintf( FichCmp, "IdModule = %s;\n", fprintf( FichCmp, "IdModule = %s;\n",
CONV_TO_UTF8( Module->m_LibRef ) ); TO_UTF8( Module->m_LibRef ) );
fprintf( FichCmp, "EndCmp\n" ); fprintf( FichCmp, "EndCmp\n" );
} }