Commit 92952b70 authored by jean-pierre charras's avatar jean-pierre charras

Use UTF-8 encoding only in kicad files. Under Linux, this was already the...

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.
parent ffa9feda
......@@ -789,7 +789,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
default:
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;
}
}
......@@ -837,7 +837,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
default:
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;
}
}
......
......@@ -97,7 +97,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
command = 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 )
{
for( material = m_Materials; material; material = material->Next() )
......
......@@ -379,7 +379,7 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
tmp = wxT( "Application: " ) + wxGetApp().GetTitle() + wxT( "\n" );
tmp += wxT( "Version: " ) + GetBuildVersion() + wxT( "\n" );
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( ", " )
<< info.GetArchName() << wxT( ", " ) << info.GetEndiannessName() << wxT( ", " )
<< info.GetPortIdName();
......
......@@ -39,7 +39,7 @@ bool DXF_PLOTTER::start_plot( FILE* fout )
{
wxString cname = ColorRefs[i].m_Name;
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 */
......@@ -97,17 +97,17 @@ void DXF_PLOTTER::circle( wxPoint centre, int diameter, FILL_T fill, int width )
wxString cname = ColorRefs[current_color].m_Name;
if (!fill) {
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 );
}
if (fill == FILLED_SHAPE) {
int r = (int)(radius*0.5);
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, "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, "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, "0\nSEQEND\n");
}
......@@ -160,7 +160,7 @@ void DXF_PLOTTER::pen_to( wxPoint pos, char plume )
/* DXF LINE */
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",
CONV_TO_UTF8( cname ),
TO_UTF8( cname ),
pen_lastpos.x, pen_lastpos.y, pos.x, pos.y );
}
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;
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",
CONV_TO_UTF8( cname ),
TO_UTF8( cname ),
centre.x, centre.y, radius,
StAngle / 10, EndAngle / 10 );
}
......
......@@ -60,7 +60,7 @@ bool GERBER_PLOTTER::start_plot( FILE* aFile )
DateAndTime( Line );
wxString Title = creator + wxT( " " ) + GetBuildVersion();
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):
fputs( "G01*\nG70*\nG90*\n", output_file );
......
......@@ -293,12 +293,12 @@ bool PS_PLOTTER::start_plot( FILE* fout )
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,
// because it is provided by the ctime() function.
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, "%%%%PageOrder: Ascend\n" );
......@@ -333,7 +333,7 @@ bool PS_PLOTTER::start_plot( FILE* fout )
else // ( if sheet->m_Name does not equal "User" )
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.x * 10 * CONV_SCALE ) );
......
......@@ -411,7 +411,7 @@ bool WinEDA_App::SetBinDir()
native_str = new char[len];
CFStringGetCString( str, native_str, len, kCFStringEncodingUTF8 );
m_BinDir = CONV_FROM_UTF8( native_str );
m_BinDir = FROM_UTF8( native_str );
delete[] native_str;
/* Linux and Unix */
......@@ -431,7 +431,7 @@ bool WinEDA_App::SetBinDir()
str_arg0 = argv[0];
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 );
if( ( ftmp = fopen( TMP_FILE, "rt" ) ) != NULL )
......@@ -440,7 +440,7 @@ bool WinEDA_App::SetBinDir()
fclose( ftmp );
remove( TMP_FILE );
}
m_BinDir = CONV_FROM_UTF8( Line );
m_BinDir = FROM_UTF8( Line );
}
else
m_BinDir = argv[0];
......
......@@ -101,7 +101,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
line += 7;
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;
AddItem( ItemLib );
......@@ -117,12 +117,12 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
{
/* KeyWords */
case (('K'<<8) + 'w'):
ItemLib->m_KeyWord = CONV_FROM_UTF8( StrPurge( line + 3 ) );
ItemLib->m_KeyWord = FROM_UTF8( StrPurge( line + 3 ) );
break;
/* Doc */
case (('C'<<8) + 'd'):
ItemLib->m_Doc = CONV_FROM_UTF8( StrPurge( line + 3 ) );
ItemLib->m_Doc = FROM_UTF8( StrPurge( line + 3 ) );
break;
}
}
......
......@@ -265,10 +265,10 @@ wxString EDA_FileSelector( const wxString& Title,
#if 0 && defined (DEBUG)
printf( "defaultpath=\"%s\" defaultname=\"%s\" Ext=\"%s\" Mask=\"%s\" flag=%d keep_working_directory=%d\n",
CONV_TO_UTF8( defaultpath ),
CONV_TO_UTF8( defaultname ),
CONV_TO_UTF8( Ext ),
CONV_TO_UTF8( Mask ),
TO_UTF8( defaultpath ),
TO_UTF8( defaultname ),
TO_UTF8( Ext ),
TO_UTF8( Mask ),
flag,
keep_working_directory );
#endif
......
......@@ -422,7 +422,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD
{
FILE* file = wxFopen( *aFullFileName, wxT( "wt" ) );
if( file )
fputs( CONV_TO_UTF8( msg ), file );
fputs( TO_UTF8( msg ), file );
else
{
msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) );
......
......@@ -133,7 +133,7 @@ char* DateAndTime( char* aBuffer )
wxString datetime;
datetime = DateAndTime();
strcpy( aBuffer, CONV_TO_UTF8( datetime ) );
strcpy( aBuffer, TO_UTF8( datetime ) );
return aBuffer;
}
......
......@@ -44,8 +44,8 @@ void CVPCB_MAINFRAME::WriteStuffList( wxCommandEvent& event )
if( component.m_Module.empty() )
continue;
fprintf( FileEquiv, "comp = \"%s\" module = \"%s\"\n",
CONV_TO_UTF8( component.m_Reference ),
CONV_TO_UTF8( component.m_Module ) );
TO_UTF8( component.m_Reference ),
TO_UTF8( component.m_Module ) );
}
fclose( FileEquiv );
......
......@@ -96,7 +96,7 @@ found in the default search paths." ),
break;
StrPurge( Line );
if( stricmp( Line, CONV_TO_UTF8( CmpName ) ) == 0 )
if( stricmp( Line, TO_UTF8( CmpName ) ) == 0 )
{
Found = 1;
break;
......@@ -119,7 +119,7 @@ found in the default search paths." ),
/* Read component 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() );
// Switch the locale to standard C (needed to print floating
......
......@@ -134,7 +134,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
if( idx != 0 )
{
wxString msg, Lineconv = CONV_FROM_UTF8( Line );
wxString msg, Lineconv = FROM_UTF8( Line );
msg.Printf( _( "Unknown file format <%s>" ), Lineconv.GetData() );
DisplayError( this, msg );
return -3;
......@@ -185,7 +185,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
while( Line[idx] != ' ' && Line[idx] )
cbuffer[jj++] = Line[idx++];
cbuffer[jj] = 0;
Cmp->m_TimeStamp = CONV_FROM_UTF8(cbuffer);
Cmp->m_TimeStamp = FROM_UTF8(cbuffer);
/* search val/ref.lib */
while( Line[idx] == ' ' )
......@@ -197,7 +197,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
if( ptchar == 0 )
{
wxString msg = _( "Netlist error: " );
msg << CONV_FROM_UTF8( Line );
msg << FROM_UTF8( Line );
DisplayError( this, msg );
k = 0;
}
......@@ -213,7 +213,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
cbuffer[jj] = 0;
// Copy footprint name:
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] == ')' ) )
{
......@@ -240,7 +240,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
cbuffer[jj++] = Line[idx];
}
cbuffer[jj] = 0;
Cmp->m_Reference = CONV_FROM_UTF8(cbuffer);
Cmp->m_Reference = FROM_UTF8(cbuffer);
/* Search component value */
while( Line[idx] == ' ' && Line[idx] )
......@@ -255,7 +255,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
cbuffer[jj++] = Line[idx];
}
cbuffer[jj] = 0;
Cmp->m_Value = CONV_FROM_UTF8(cbuffer);
Cmp->m_Value = FROM_UTF8(cbuffer);
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
{
CmpRef = CONV_FROM_UTF8( Line + 11 );
CmpRef = FROM_UTF8( Line + 11 );
CmpRef.Trim( true );
CmpRef.Trim( false );
......@@ -302,7 +302,7 @@ int ReadFootprintFilterList( FILE_LINE_READER& aNetlistReader, COMPONENT_LIST&
}
else if( Cmp )
{
wxString fp = CONV_FROM_UTF8( Line + 1 );
wxString fp = FROM_UTF8( Line + 1 );
fp.Trim( false );
fp.Trim( true );
Cmp->m_FootprintFilter.Add( fp );
......@@ -355,7 +355,7 @@ int ReadPinConnection( FILE_LINE_READER& aNetlistReader, COMPONENT* Cmp )
cbuffer[jj++] = Line[i];
}
cbuffer[jj] = 0;
Pin->m_Number = CONV_FROM_UTF8(cbuffer);
Pin->m_Number = FROM_UTF8(cbuffer);
/* Read netname */
while( Line[i] == ' ' )
......@@ -368,7 +368,7 @@ int ReadPinConnection( FILE_LINE_READER& aNetlistReader, COMPONENT* Cmp )
cbuffer[jj++] = Line[i];
}
cbuffer[jj] = 0;
Pin->m_Net = CONV_FROM_UTF8(cbuffer);
Pin->m_Net = FROM_UTF8(cbuffer);
Cmp->m_Pins.push_back( Pin );
}
......
......@@ -43,20 +43,20 @@ int CVPCB_MAINFRAME::SaveComponentList( const wxString& NetlistFullFileName )
return 0;
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 ) );
BOOST_FOREACH( COMPONENT& component, m_components )
{
fprintf( dest, "\nBeginCmp\n" );
fprintf( dest, "TimeStamp = %s;\n",
CONV_TO_UTF8( component.m_TimeStamp ) );
TO_UTF8( component.m_TimeStamp ) );
fprintf( dest, "Reference = %s;\n",
CONV_TO_UTF8( component.m_Reference ) );
TO_UTF8( component.m_Reference ) );
fprintf( dest, "ValeurCmp = %s;\n",
CONV_TO_UTF8( component.m_Value ) );
TO_UTF8( component.m_Value ) );
fprintf( dest, "IdModule = %s;\n",
CONV_TO_UTF8( component.m_Module ) );
TO_UTF8( component.m_Module ) );
fprintf( dest, "EndCmp\n" );
}
......@@ -139,7 +139,7 @@ bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& fileName )
if( strnicmp( ident, "TimeStamp", 9 ) == 0 )
{
timestamp = CONV_FROM_UTF8( data );
timestamp = FROM_UTF8( data );
timestamp.Trim( TRUE );
timestamp.Trim( FALSE );
continue;
......@@ -147,7 +147,7 @@ bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& fileName )
if( strnicmp( ident, "Reference", 9 ) == 0 )
{
namecmp = CONV_FROM_UTF8( data );
namecmp = FROM_UTF8( data );
namecmp.Trim( TRUE );
namecmp.Trim( FALSE );
continue;
......@@ -155,7 +155,7 @@ bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& fileName )
if( strnicmp( ident, "ValeurCmp", 9 ) == 0 )
{
valeur = CONV_FROM_UTF8( data );
valeur = FROM_UTF8( data );
valeur.Trim( TRUE );
valeur.Trim( FALSE );
continue;
......@@ -163,7 +163,7 @@ bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& fileName )
if( strnicmp( ident, "IdModule", 8 ) == 0 )
{
ilib = CONV_FROM_UTF8( data );
ilib = FROM_UTF8( data );
ilib.Trim( TRUE );
ilib.Trim( FALSE );
continue;
......
......@@ -79,17 +79,17 @@ int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
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() )
fprintf( file, "%s", CONV_TO_UTF8( component.m_Module ) );
fprintf( file, "%s", TO_UTF8( component.m_Module ) );
else
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();
RemoveDuplicatePins( component );
......@@ -98,10 +98,10 @@ int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
{
if( !pin.m_Net.IsEmpty() )
fprintf( file, " ( %s %s )\n",
CONV_TO_UTF8( pin.m_Number ),
CONV_TO_UTF8( pin.m_Net ) );
TO_UTF8( pin.m_Number ),
TO_UTF8( pin.m_Net ) );
else
fprintf( file, " ( %s ? )\n", CONV_TO_UTF8( pin.m_Number ) );
fprintf( file, " ( %s ? )\n", TO_UTF8( pin.m_Number ) );
}
fprintf( file, " )\n" );
......@@ -136,12 +136,12 @@ void WriteFootprintFilterInfos( FILE* file, COMPONENT_LIST& list )
WriteHeader = TRUE;
}
fprintf( file, "$component %s\n",
CONV_TO_UTF8( component.m_Reference ) );
TO_UTF8( component.m_Reference ) );
/* Write the footprint list */
for( unsigned int jj = 0; jj < FilterCount; jj++ )
{
fprintf( file, " %s\n",
CONV_TO_UTF8( component.m_FootprintFilter[jj] ) );
TO_UTF8( component.m_FootprintFilter[jj] ) );
}
fprintf( file, "$endlist\n" );
......
......@@ -102,8 +102,8 @@ bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aFilename, bool aSetFieldAttributeT
if( *cp == '"' )
*cp = 0;
wxString reference = CONV_FROM_UTF8( Ref );
wxString Footprint = CONV_FROM_UTF8( FootPrint );
wxString reference = FROM_UTF8( Ref );
wxString Footprint = FROM_UTF8( FootPrint );
FillFootprintFieldForAllInstancesofComponent( reference,
Footprint,
aSetFieldAttributeToVisible );
......
......@@ -154,7 +154,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
(float) label->m_Pos.x / 1000,
(float) label->m_Pos.y / 1000 );
fputs( CONV_TO_UTF8( msg ), f );
fputs( TO_UTF8( msg ), f );
break;
case SCH_SHEET_LABEL_T:
......@@ -168,7 +168,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
if( jj > NET_TMAX )
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" ),
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.y / 1000 );
fputs( CONV_TO_UTF8( msg ), f );
fputs( TO_UTF8( msg ), f );
}
break;
......@@ -187,6 +187,6 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
}
msg = _( "#End labels\n" );
fputs( CONV_TO_UTF8( msg ), f );
fputs( TO_UTF8( msg ), f );
return 0;
}
......@@ -106,19 +106,19 @@ bool LIB_ALIAS::SaveDoc( FILE* aFile )
if( description.IsEmpty() && keyWords.IsEmpty() && docFileName.IsEmpty() )
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;
if( ! description.IsEmpty()
&& fprintf( aFile, "D %s\n", CONV_TO_UTF8( description ) ) < 0 )
&& fprintf( aFile, "D %s\n", TO_UTF8( description ) ) < 0 )
return false;
if( ! keyWords.IsEmpty()
&& fprintf( aFile, "K %s\n", CONV_TO_UTF8( keyWords ) ) < 0 )
&& fprintf( aFile, "K %s\n", TO_UTF8( keyWords ) ) < 0 )
return false;
if( ! docFileName.IsEmpty()
&& fprintf( aFile, "F %s\n", CONV_TO_UTF8( docFileName ) ) < 0 )
&& fprintf( aFile, "F %s\n", TO_UTF8( docFileName ) ) < 0 )
return false;
if( fprintf( aFile, "$ENDCMP\n" ) < 0 )
......@@ -539,7 +539,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
LIB_FIELD& value = GetValueField();
/* 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;
/* Save data */
......@@ -548,12 +548,12 @@ bool LIB_COMPONENT::Save( FILE* aFile )
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;
}
else
{
if( fprintf( aFile, " ~%s", CONV_TO_UTF8( value.m_Text ) ) < 0 )
if( fprintf( aFile, " ~%s", TO_UTF8( value.m_Text ) ) < 0 )
return false;
}
......@@ -561,7 +561,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
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;
}
else
......@@ -623,7 +623,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
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;
}
......@@ -639,7 +639,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
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;
}
......@@ -736,11 +736,11 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum, wxString& aEr
strupper( componentName );
if( componentName[0] != '~' )
{
m_name = value.m_Text = CONV_FROM_UTF8( componentName );
m_name = value.m_Text = FROM_UTF8( componentName );
}
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;
}
......@@ -756,7 +756,7 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum, wxString& aEr
}
else
{
reference.m_Text = CONV_FROM_UTF8( prefix );
reference.m_Text = FROM_UTF8( prefix );
}
// Copy optional infos
......@@ -896,7 +896,7 @@ bool LIB_COMPONENT::LoadAliases( char* aLine, wxString& aErrorMsg )
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" );
}
......@@ -953,7 +953,7 @@ bool LIB_COMPONENT::LoadFootprints( FILE* aFile, char* aLine,
if( stricmp( aLine, "$ENDFPLIST" ) == 0 )
break;
m_FootprintList.Add( CONV_FROM_UTF8( aLine + 1 ) );
m_FootprintList.Add( FROM_UTF8( aLine + 1 ) );
}
return true;
......
......@@ -431,7 +431,7 @@ bool CMP_LIBRARY::Load( wxString& aErrorMsg )
{
wxString tmp;
header = CONV_FROM_UTF8( line );
header = FROM_UTF8( line );
wxStringTokenizer tkn( header );
......@@ -628,7 +628,7 @@ bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg )
/* Read one $CMP/$ENDCMP part entry from library: */
name = strtok( line + 5, "\n\r" );
wxString cmpname = CONV_FROM_UTF8( name );
wxString cmpname = FROM_UTF8( name );
entry = FindEntry( cmpname );
......@@ -643,15 +643,15 @@ bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg )
switch( line[0] )
{
case 'D':
entry->SetDescription( CONV_FROM_UTF8( text ) );
entry->SetDescription( FROM_UTF8( text ) );
break;
case 'K':
entry->SetKeyWords( CONV_FROM_UTF8( text ) );
entry->SetKeyWords( FROM_UTF8( text ) );
break;
case 'F':
entry->SetDocFileName( CONV_FROM_UTF8( text ) );
entry->SetDocFileName( FROM_UTF8( text ) );
break;
}
}
......@@ -795,6 +795,10 @@ bool CMP_LIBRARY::SaveHeader( FILE* aFile )
if( fprintf( aFile, "%s %d.%d Date: %s\n", LIBFILE_IDENT,
LIB_VERSION_MAJOR, LIB_VERSION_MINOR, BufLine ) < 0 )
succes = false;
if( fprintf( aFile, "#encoding utf-8\n") < 0 )
succes = false;
#if 0
if( ( fprintf( aFile, "$HEADER\n" ) < 0 )
|| ( fprintf( aFile, "TimeStamp %8.8lX\n", m_TimeStamp ) < 0 )
......
......@@ -77,7 +77,7 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx )
out << "<netItem ndx=\"" << ndx << '"' <<
" type=\"" << ShowType( m_Type ) << '"' <<
" netCode=\"" << GetNet() << '"' <<
" sheet=\"" << CONV_TO_UTF8( path ) << '"' <<
" sheet=\"" << TO_UTF8( path ) << '"' <<
">\n";
out << " <start " << m_Start << "/> <end " << m_End << "/>\n";
......
This diff is collapsed.
......@@ -53,7 +53,7 @@ void RemoteCommand( const char* cmdline )
if( strcmp( idcmd, "$PART:" ) != 0 )
return;
part_ref = CONV_FROM_UTF8( text );
part_ref = FROM_UTF8( text );
/* look for a complement */
idcmd = strtok( NULL, " \n\r" );
......@@ -69,7 +69,7 @@ void RemoteCommand( const char* cmdline )
if( text == NULL )
return;
msg = CONV_FROM_UTF8( text );
msg = FROM_UTF8( text );
if( strcmp( idcmd, "$REF:" ) == 0 )
{
......@@ -112,14 +112,14 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT*
if( LibItem == NULL )
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 );
}
break;
case SCH_COMPONENT_T:
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 );
break;
......@@ -133,12 +133,12 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT*
{
wxString pinnum;
Pin->ReturnPinStringNum( pinnum );
sprintf( Line, "$PIN: %s $PART: %s", CONV_TO_UTF8( pinnum ),
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
sprintf( Line, "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
}
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 );
......
......@@ -486,7 +486,7 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
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
cmplist.SortByReferenceOnly();
......@@ -520,7 +520,7 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
( order = Sheet Number ) count = %d\n" ),
itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
fprintf( f, "%s", TO_UTF8( msg ) );
PrintListeGLabel( f, listOfLabels );
}
......@@ -532,13 +532,13 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
order = Alphab. ) count = %d\n\n" ),
itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
fprintf( f, "%s", TO_UTF8( msg ) );
PrintListeGLabel( f, listOfLabels );
}
}
msg = _( "\n#End List\n" );
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
fprintf( f, "%s", TO_UTF8( msg ) );
fclose( f );
}
......@@ -553,12 +553,12 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if( CompactForm )
{
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
}
else
{
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 )
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
else
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" );
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" );
......@@ -623,7 +623,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
if( aIncludeSubComponents )
msg << _( " (with SubCmp)" );
fprintf( f, "%s\n", CONV_TO_UTF8( msg ) );
fprintf( f, "%s\n", TO_UTF8( msg ) );
}
std::string CmpName;
......@@ -656,26 +656,26 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
CmpName = aList[ii].GetRefStr();
if( !CompactForm )
CmpName += CONV_TO_UTF8(subRef);
CmpName += TO_UTF8(subRef);
if( CompactForm )
#if defined(KICAD_GOST)
fprintf( f, "%s%c%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
TO_UTF8( comp->GetField( VALUE )->m_Text ), s_ExportSeparatorSymbol,
TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else
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
else
#if defined(KICAD_GOST)
fprintf( f, "| %-10s %-12s %-20s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ),
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
TO_UTF8( comp->GetField( VALUE )->m_Text ),
TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else
fprintf( f, "| %-10s %-12s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) );
TO_UTF8( comp->GetField( VALUE )->m_Text ) );
#endif
if( aIncludeSubComponents )
......@@ -687,16 +687,16 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{
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 );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
CONV_TO_UTF8( msg ) );
TO_UTF8( msg ) );
}
else
{
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
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 )
{
msg = _( "#End Cmp\n" );
fputs( CONV_TO_UTF8( msg ), f );
fputs( TO_UTF8( msg ), f );
}
return 0;
......@@ -816,22 +816,22 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL
continue;
// 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 ) )
fprintf( f, "%c%15s", s_ExportSeparatorSymbol,
#if defined(KICAD_GOST)
CONV_TO_UTF8( footName ) );
TO_UTF8( footName ) );
#else
CONV_TO_UTF8( currCmp->GetField( FOOTPRINT )->m_Text ) );
TO_UTF8( currCmp->GetField( FOOTPRINT )->m_Text ) );
#endif
#if defined(KICAD_GOST)
fprintf( f, "%c%20s", s_ExportSeparatorSymbol,CONV_TO_UTF8( datsName ) );
fprintf( f, "%c%20s", s_ExportSeparatorSymbol,TO_UTF8( datsName ) );
#endif
// 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
int last_nonempty_field_idx = 0;
......@@ -844,7 +844,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aL
{
if ( IsFieldChecked( jj ) )
fprintf( f, "%c%4s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( dummyCmp.GetField( jj )->m_Text ) );
TO_UTF8( dummyCmp.GetField( jj )->m_Text ) );
}
fprintf( f, "\n" );
......@@ -878,7 +878,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
msg << wxT( "\n" );
fputs( CONV_TO_UTF8( msg ), f );
fputs( TO_UTF8( msg ), f );
for( unsigned ii = 0; ii < aList.GetCount(); ii++ )
{
......@@ -906,10 +906,10 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
subRef.Empty();
CmpName = aList[ii].GetRefStr();
CmpName += CONV_TO_UTF8(subRef);
CmpName += TO_UTF8(subRef);
fprintf( f, "| %-12s %-10s",
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ),
TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ),
CmpName.c_str() );
// print the sheet path
......@@ -919,9 +919,9 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
if( screen )
{
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 );
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" );
fputs( CONV_TO_UTF8( msg ), f );
fputs( TO_UTF8( msg ), f );
return 0;
}
......@@ -342,7 +342,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::moveUpButtonHandler( wxCommandEvent& ev
SCH_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
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];
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 )
{
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
......
......@@ -263,8 +263,8 @@ An alias %s already exists!\nCannot update this component" ),
for( unsigned i=0; i<m_FieldsBuf.size(); ++i )
{
printf( "save[%d].name:'%s' value:'%s'\n", i,
CONV_TO_UTF8( m_FieldsBuf[i].GetName() ),
CONV_TO_UTF8( m_FieldsBuf[i].m_Text ) );
TO_UTF8( m_FieldsBuf[i].GetName() ),
TO_UTF8( m_FieldsBuf[i].m_Text ) );
}
#endif
......@@ -456,7 +456,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
#if defined(DEBUG)
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
......@@ -484,7 +484,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
// fixed fields:
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] );
}
......@@ -509,7 +509,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
// values from the component will be set.
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.m_Text = it->m_Value; // empty? ok too.
......@@ -521,7 +521,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
}
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
}
......@@ -537,7 +537,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
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 );
}
}
......
......@@ -203,7 +203,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
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 );
}
......@@ -629,7 +629,7 @@ void SCH_EDIT_FRAME::LoadSettings()
if( !templateFieldNames.IsEmpty() )
{
TEMPLATE_FIELDNAMES_LEXER lexer( CONV_TO_UTF8( templateFieldNames ) );
TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
try
{
m_TemplateFieldNames.Parse( &lexer );
......@@ -638,7 +638,7 @@ void SCH_EDIT_FRAME::LoadSettings()
{
// @todo show error msg
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 );
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(" "), wxT(" "), true ); // double space to single
......
......@@ -271,7 +271,7 @@ void Diagnose( EDA_DRAW_PANEL* aPanel,
char ascii_buf[5];
ascii_buf[4] = 0;
memcpy( ascii_buf, &aNetItemRef->m_PinNum, 4 );
string_pinnum = CONV_FROM_UTF8( ascii_buf );
string_pinnum = FROM_UTF8( ascii_buf );
cmp_ref = wxT( "?" );
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;
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( "?" );
if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link )
alt_cmp = ( (SCH_COMPONENT*) aNetItemTst->m_Link )->GetRef(
......@@ -511,7 +511,7 @@ bool WriteDiagnosticERC( const wxString& FullFileName )
DateAndTime( Line );
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;
......@@ -527,7 +527,7 @@ bool WriteDiagnosticERC( const wxString& FullFileName )
msg.Printf( _( "\n***** Sheet %s\n" ), GetChars( str ) );
}
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
fprintf( OutErc, "%s", TO_UTF8( msg ) );
DrawStruct = Sheet->LastDrawList();
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
......@@ -539,12 +539,12 @@ bool WriteDiagnosticERC( const wxString& FullFileName )
if( Marker->GetMarkerType() != MARK_ERC )
continue;
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 );
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
fprintf( OutErc, "%s", TO_UTF8( msg ) );
fclose( OutErc );
return TRUE;
......
......@@ -326,7 +326,7 @@ void SCH_EDIT_FRAME::SaveProject()
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 );
}
......
......@@ -114,7 +114,7 @@ bool LIB_FIELD::Save( FILE* ExportFile )
text = wxT( "~" );
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_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
hjustify, vjustify,
......@@ -131,7 +131,7 @@ bool LIB_FIELD::Save( FILE* ExportFile )
if( m_id >= FIELD1 && !m_name.IsEmpty()
&& m_name != defName
&& fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_name ) ) < 0 )
&& fprintf( ExportFile, " \"%s\"", TO_UTF8( m_name ) ) < 0 )
return false;
if( fprintf( ExportFile, "\n" ) < 0 )
......@@ -196,7 +196,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
return false;
}
m_Text = CONV_FROM_UTF8( text );
m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y;
if( textOrient == 'H' )
......@@ -271,7 +271,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
else
{
ReadDelimitedText( fieldUserName, line, sizeof( fieldUserName ) );
m_name = CONV_FROM_UTF8( fieldUserName );
m_name = FROM_UTF8( fieldUserName );
}
return true;
......
......@@ -600,7 +600,7 @@ bool LIB_PIN::Save( FILE* ExportFile )
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;
}
else
......@@ -610,7 +610,7 @@ bool LIB_PIN::Save( FILE* ExportFile )
}
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,
m_Unit, m_Convert, Etype ) < 0 )
return false;
......@@ -674,7 +674,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
m_orientation = pinOrient[0] & 255;
strncpy( (char*) &m_number, pinNum, 4 );
m_name = CONV_FROM_UTF8( pinName );
m_name = FROM_UTF8( pinName );
switch( *pinType & 255 )
{
......@@ -1562,7 +1562,7 @@ wxString LIB_PIN::ReturnPinStringNum( long aPinNum )
memcpy( ascii_buf, &aPinNum, 4 );
ascii_buf[4] = 0;
wxString buffer = CONV_FROM_UTF8( ascii_buf );
wxString buffer = FROM_UTF8( ascii_buf );
return buffer;
}
......
......@@ -44,7 +44,7 @@ bool LIB_TEXT::Save( FILE* ExportFile )
text.Replace( wxT( " " ), wxT( "~" ) );
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;
if( fprintf( ExportFile, " %s %d", m_Italic ? "Italic" : "Normal",
( m_Bold > 0 ) ? 1 : 0 ) < 0 )
......@@ -130,7 +130,7 @@ bool LIB_TEXT::Load( char* line, wxString& errorMsg )
}
/* Convert '~' to spaces. */
m_Text = CONV_FROM_UTF8( buf );
m_Text = FROM_UTF8( buf );
m_Text.Replace( wxT( "~" ), wxT( " " ) );
return true;
......
......@@ -50,7 +50,7 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFile
screen->SetCurItem( NULL );
screen->SetFileName( FullFileName );
// D(printf("LoadOneEEFile:%s\n", CONV_TO_UTF8( FullFileName ) ); )
// D(printf("LoadOneEEFile:%s\n", TO_UTF8( FullFileName ) ); )
FILE* f;
if( ( f = wxFopen( FullFileName, wxT( "rt" ) ) ) == NULL )
......@@ -184,7 +184,7 @@ again." );
itemLoaded = false;
MsgDiag.Printf( wxT( "EESchema file undefined object at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
MsgDiag << wxT( "\n" ) << FROM_UTF8( line );
}
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 );
wxString pagename = CONV_FROM_UTF8( Text );
wxString pagename = FROM_UTF8( Text );
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 \
line %d, \aAbort reading file.\n" ),
aLine->LineNumber() );
aMsgDiag << CONV_FROM_UTF8( line );
aMsgDiag << FROM_UTF8( line );
}
aScreen->m_CurrentSheetDesc = wsheet;
......@@ -332,56 +332,56 @@ line %d, \aAbort reading file.\n" ),
if( strnicmp( line, "Title", 2 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Title = CONV_FROM_UTF8( buf );
aScreen->m_Title = FROM_UTF8( buf );
continue;
}
if( strnicmp( line, "Date", 2 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Date = CONV_FROM_UTF8( buf );
aScreen->m_Date = FROM_UTF8( buf );
continue;
}
if( strnicmp( line, "Rev", 2 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Revision = CONV_FROM_UTF8( buf );
aScreen->m_Revision = FROM_UTF8( buf );
continue;
}
if( strnicmp( line, "Comp", 4 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Company = CONV_FROM_UTF8( buf );
aScreen->m_Company = FROM_UTF8( buf );
continue;
}
if( strnicmp( line, "Comment1", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire1 = CONV_FROM_UTF8( buf );
aScreen->m_Commentaire1 = FROM_UTF8( buf );
continue;
}
if( strnicmp( line, "Comment2", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire2 = CONV_FROM_UTF8( buf );
aScreen->m_Commentaire2 = FROM_UTF8( buf );
continue;
}
if( strnicmp( line, "Comment3", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire3 = CONV_FROM_UTF8( buf );
aScreen->m_Commentaire3 = FROM_UTF8( buf );
continue;
}
if( strnicmp( line, "Comment4", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire4 = CONV_FROM_UTF8( buf );
aScreen->m_Commentaire4 = FROM_UTF8( buf );
continue;
}
}
......
This diff is collapsed.
......@@ -128,12 +128,12 @@ public:
void SetRef( const wxString& aReference )
{
m_Ref = CONV_TO_UTF8( aReference );
m_Ref = TO_UTF8( aReference );
}
wxString GetRef() const
{
return CONV_FROM_UTF8( m_Ref.c_str() );
return FROM_UTF8( m_Ref.c_str() );
}
void SetRefStr( const std::string& aReference )
{
......
This diff is collapsed.
......@@ -368,7 +368,7 @@ const wxString SCH_COMPONENT::GetRef( SCH_SHEET_PATH* sheet )
h_ref = tokenizer.GetNextToken();
/* printf( "GetRef hpath: %s\n",
* CONV_TO_UTF8( m_PathsAndReferences[ii] ) ); */
* TO_UTF8( m_PathsAndReferences[ii] ) ); */
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 )
{
wxString defRef = m_prefix;
bool KeepMulti = false;
bool keepMulti = false;
LIB_COMPONENT* Entry;
wxString separators( wxT( " " ) );
wxArrayString reference_fields;
......@@ -631,7 +631,7 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
if( Entry && Entry->UnitsLocked() )
KeepMulti = true;
keepMulti = true;
while( defRef.Last() == '?' )
defRef.RemoveLast();
......@@ -641,7 +641,7 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
wxString multi = wxT( "1" );
// We cannot remove all annotations: part selection must be kept
if( KeepMulti )
if( keepMulti )
{
wxString NewHref;
wxString path;
......@@ -656,7 +656,7 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
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];
NewHref = reference_fields[0];
......@@ -862,9 +862,9 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
{
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
<< " ref=\"" << CONV_TO_UTF8( ReturnFieldName( 0 ) )
<< " ref=\"" << TO_UTF8( ReturnFieldName( 0 ) )
<< '"' << " chipName=\""
<< CONV_TO_UTF8( m_ChipName ) << '"' << m_Pos
<< TO_UTF8( m_ChipName ) << '"' << m_Pos
<< " layer=\"" << m_Layer
<< '"' << ">\n";
......@@ -876,13 +876,13 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
if( !value.IsEmpty() )
{
NestedSpace( nestLevel + 1, os ) << "<field" << " name=\""
<< CONV_TO_UTF8( ReturnFieldName( i ) )
<< TO_UTF8( ReturnFieldName( i ) )
<< '"' << " 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
......@@ -902,14 +902,14 @@ bool SCH_COMPONENT::Save( FILE* f ) const
{
reference_fields = wxStringTokenize( m_PathsAndReferences[0],
delimiters );
strncpy( Name1, CONV_TO_UTF8( reference_fields[1] ), sizeof( Name1 ) );
strncpy( Name1, TO_UTF8( reference_fields[1] ), sizeof( Name1 ) );
}
else
{
if( GetField( REFERENCE )->m_Text.IsEmpty() )
strncpy( Name1, CONV_TO_UTF8( m_prefix ), sizeof( Name1 ) );
strncpy( Name1, TO_UTF8( m_prefix ), sizeof( Name1 ) );
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++ )
......@@ -925,7 +925,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const
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++ )
#if defined(KICAD_GOST)
......@@ -974,9 +974,9 @@ bool SCH_COMPONENT::Save( FILE* f ) const
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], delimiters );
if( fprintf( f, "AR Path=\"%s\" Ref=\"%s\" Part=\"%s\" \n",
CONV_TO_UTF8( reference_fields[0] ),
CONV_TO_UTF8( reference_fields[1] ),
CONV_TO_UTF8( reference_fields[2] ) ) == EOF )
TO_UTF8( reference_fields[0] ),
TO_UTF8( reference_fields[1] ),
TO_UTF8( reference_fields[2] ) ) == EOF )
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" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( line );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( line );
return false;
}
......@@ -1065,10 +1065,10 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( Name1[ii] == '~' )
Name1[ii] = ' ';
m_ChipName = CONV_FROM_UTF8( Name1 );
m_ChipName = FROM_UTF8( Name1 );
if( !newfmt )
GetField( VALUE )->m_Text = CONV_FROM_UTF8( Name1 );
GetField( VALUE )->m_Text = FROM_UTF8( Name1 );
}
else
{
......@@ -1112,13 +1112,13 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
}
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 )
GetField( REFERENCE )->m_Text = CONV_FROM_UTF8( Name2 );
GetField( REFERENCE )->m_Text = FROM_UTF8( Name2 );
}
else
{
......@@ -1171,12 +1171,12 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
//copy the path.
ii = ReadDelimitedText( Name1, ptcar, 255 );
ptcar += ii + 1;
wxString path = CONV_FROM_UTF8( Name1 );
wxString path = FROM_UTF8( Name1 );
// copy the reference
ii = ReadDelimitedText( Name1, ptcar, 255 );
ptcar += ii + 1;
wxString ref = CONV_FROM_UTF8( Name1 );
wxString ref = FROM_UTF8( Name1 );
// copy the multi, if exists
ii = ReadDelimitedText( Name1, ptcar, 255 );
......@@ -1235,7 +1235,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( !FieldUserName[0] )
fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx );
else
fieldName = CONV_FROM_UTF8( FieldUserName );
fieldName = FROM_UTF8( FieldUserName );
if( fieldNdx >= GetFieldCount() )
{
......@@ -1261,7 +1261,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
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) );
if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1,
&GetField( fieldNdx )->m_Pos.x,
......
......@@ -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",
m_FieldId,
CONV_TO_UTF8( m_Text ),
TO_UTF8( m_Text ),
m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V',
m_Pos.x, m_Pos.y,
m_Size.x,
......@@ -346,7 +346,7 @@ bool SCH_FIELD::Save( FILE* aFile ) const
// Save field name, if the name is user definable
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;
}
......
......@@ -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" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false;
}
......
This diff is collapsed.
/************************/
/* Class SCH_NO_CONNECT */
/************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "macros.h"
#include "class_drawpanel.h"
#include "common.h"
#include "trigo.h"
#include "richio.h"
#include "general.h"
#include "protos.h"
#include "sch_no_connect.h"
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_NO_CONNECT_T )
{
#define DRAWNOCONNECT_SIZE 48 /* No symbol connection range. */
m_Pos = pos;
m_Size.x = m_Size.y = DRAWNOCONNECT_SIZE;
#undef DRAWNOCONNECT_SIZE
}
SCH_NO_CONNECT::SCH_NO_CONNECT( const SCH_NO_CONNECT& aNoConnect ) :
SCH_ITEM( aNoConnect )
{
m_Pos = aNoConnect.m_Pos;
m_Size = aNoConnect.m_Size;
}
EDA_ITEM* SCH_NO_CONNECT::doClone() const
{
return new SCH_NO_CONNECT( *this );
}
EDA_Rect SCH_NO_CONNECT::GetBoundingBox() const
{
int delta = ( GetPenSize() + m_Size.x ) / 2;
EDA_Rect box;
box.SetOrigin( m_Pos );
box.Inflate( delta );
return box;
}
bool SCH_NO_CONNECT::Save( FILE* aFile ) const
{
bool success = true;
if( fprintf( aFile, "NoConn ~ %-4d %-4d\n", m_Pos.x, m_Pos.y ) == EOF )
{
success = false;
}
return success;
}
bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char name[256];
char* line = (char*) aLine;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %d %d", name, &m_Pos.x, &m_Pos.y ) != 3 )
{
aErrorMsg.Printf( wxT( "EESchema file No Connect load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( ((char*)aLine) );
return false;
}
return true;
}
int SCH_NO_CONNECT::GetPenSize() const
{
return g_DrawDefaultLineThickness;
}
void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor )
{
int pX, pY, color;
int delta = m_Size.x / 2;
int width = g_DrawDefaultLineThickness;
pX = m_Pos.x + aOffset.x;
pY = m_Pos.y + aOffset.y;
if( aColor >= 0 )
color = aColor;
else
color = ReturnLayerColor( LAYER_NOCONNECT );
GRSetDrawMode( aDC, aDrawMode );
GRLine( &aPanel->m_ClipBox, aDC, pX - delta, pY - delta, pX + delta, pY + delta, width, color );
GRLine( &aPanel->m_ClipBox, aDC, pX + delta, pY - delta, pX - delta, pY + delta, width, color );
}
void SCH_NO_CONNECT::Mirror_X( int aXaxis_position )
{
m_Pos.y -= aXaxis_position;
NEGATE( m_Pos.y );
m_Pos.y += aXaxis_position;
}
void SCH_NO_CONNECT::Mirror_Y( int aYaxis_position )
{
m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position;
}
void SCH_NO_CONNECT::Rotate( wxPoint rotationPoint )
{
RotatePoint( &m_Pos, rotationPoint, 900 );
}
bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect )
{
bool previousState = IsSelected();
if( aRect.Contains( m_Pos ) )
m_Flags |= SELECTED;
else
m_Flags &= ~SELECTED;
return previousState != IsSelected();
}
void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
{
aPoints.push_back( m_Pos );
}
bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
{
return m_Pos == aPosition;
}
bool SCH_NO_CONNECT::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
{
if( !( aFilter & NO_CONNECT_T ) )
return false;
int delta = ( ( m_Size.x + g_DrawDefaultLineThickness ) / 2 ) + aAccuracy;
wxPoint dist = aPoint - m_Pos;
if( ( ABS( dist.x ) <= delta ) && ( ABS( dist.y ) <= delta ) )
return true;
return false;
}
bool SCH_NO_CONNECT::doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
{
EDA_Rect rect = aRect;
rect.Inflate( aAccuracy );
if( aContained )
return rect.Contains( GetBoundingBox() );
return rect.Intersects( GetBoundingBox() );
}
/************************/
/* Class SCH_NO_CONNECT */
/************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "macros.h"
#include "class_drawpanel.h"
#include "common.h"
#include "trigo.h"
#include "richio.h"
#include "general.h"
#include "protos.h"
#include "sch_no_connect.h"
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_NO_CONNECT_T )
{
#define DRAWNOCONNECT_SIZE 48 /* No symbol connection range. */
m_Pos = pos;
m_Size.x = m_Size.y = DRAWNOCONNECT_SIZE;
#undef DRAWNOCONNECT_SIZE
}
SCH_NO_CONNECT::SCH_NO_CONNECT( const SCH_NO_CONNECT& aNoConnect ) :
SCH_ITEM( aNoConnect )
{
m_Pos = aNoConnect.m_Pos;
m_Size = aNoConnect.m_Size;
}
EDA_ITEM* SCH_NO_CONNECT::doClone() const
{
return new SCH_NO_CONNECT( *this );
}
EDA_Rect SCH_NO_CONNECT::GetBoundingBox() const
{
int delta = ( GetPenSize() + m_Size.x ) / 2;
EDA_Rect box;
box.SetOrigin( m_Pos );
box.Inflate( delta );
return box;
}
bool SCH_NO_CONNECT::Save( FILE* aFile ) const
{
bool success = true;
if( fprintf( aFile, "NoConn ~ %-4d %-4d\n", m_Pos.x, m_Pos.y ) == EOF )
{
success = false;
}
return success;
}
bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char name[256];
char* line = (char*) aLine;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %d %d", name, &m_Pos.x, &m_Pos.y ) != 3 )
{
aErrorMsg.Printf( wxT( "EESchema file No Connect load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( ((char*)aLine) );
return false;
}
return true;
}
int SCH_NO_CONNECT::GetPenSize() const
{
return g_DrawDefaultLineThickness;
}
void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor )
{
int pX, pY, color;
int delta = m_Size.x / 2;
int width = g_DrawDefaultLineThickness;
pX = m_Pos.x + aOffset.x;
pY = m_Pos.y + aOffset.y;
if( aColor >= 0 )
color = aColor;
else
color = ReturnLayerColor( LAYER_NOCONNECT );
GRSetDrawMode( aDC, aDrawMode );
GRLine( &aPanel->m_ClipBox, aDC, pX - delta, pY - delta, pX + delta, pY + delta, width, color );
GRLine( &aPanel->m_ClipBox, aDC, pX + delta, pY - delta, pX - delta, pY + delta, width, color );
}
void SCH_NO_CONNECT::Mirror_X( int aXaxis_position )
{
m_Pos.y -= aXaxis_position;
NEGATE( m_Pos.y );
m_Pos.y += aXaxis_position;
}
void SCH_NO_CONNECT::Mirror_Y( int aYaxis_position )
{
m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position;
}
void SCH_NO_CONNECT::Rotate( wxPoint rotationPoint )
{
RotatePoint( &m_Pos, rotationPoint, 900 );
}
bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect )
{
bool previousState = IsSelected();
if( aRect.Contains( m_Pos ) )
m_Flags |= SELECTED;
else
m_Flags &= ~SELECTED;
return previousState != IsSelected();
}
void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
{
aPoints.push_back( m_Pos );
}
bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
{
return m_Pos == aPosition;
}
bool SCH_NO_CONNECT::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
{
if( !( aFilter & NO_CONNECT_T ) )
return false;
int delta = ( ( m_Size.x + g_DrawDefaultLineThickness ) / 2 ) + aAccuracy;
wxPoint dist = aPoint - m_Pos;
if( ( ABS( dist.x ) <= delta ) && ( ABS( dist.y ) <= delta ) )
return true;
return false;
}
bool SCH_NO_CONNECT::doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
{
EDA_Rect rect = aRect;
rect.Inflate( aAccuracy );
if( aContained )
return rect.Contains( GetBoundingBox() );
return rect.Intersects( GetBoundingBox() );
}
This diff is collapsed.
......@@ -308,12 +308,12 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
// Creates header
if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP,
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;
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;
}
......@@ -328,17 +328,18 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
* 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
|| fprintf( aFile, "encoding utf-8\n") < 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, "Date \"%s\"\n", CONV_TO_UTF8( m_Date ) ) < 0
|| fprintf( aFile, "Rev \"%s\"\n", CONV_TO_UTF8( m_Revision ) ) < 0
|| fprintf( aFile, "Comp \"%s\"\n", CONV_TO_UTF8( m_Company ) ) < 0
|| fprintf( aFile, "Comment1 \"%s\"\n", CONV_TO_UTF8( m_Commentaire1 ) ) < 0
|| fprintf( aFile, "Comment2 \"%s\"\n", CONV_TO_UTF8( m_Commentaire2 ) ) < 0
|| fprintf( aFile, "Comment3 \"%s\"\n", CONV_TO_UTF8( m_Commentaire3 ) ) < 0
|| fprintf( aFile, "Comment4 \"%s\"\n", CONV_TO_UTF8( m_Commentaire4 ) ) < 0
|| fprintf( aFile, "Title \"%s\"\n", TO_UTF8( m_Title ) ) < 0
|| fprintf( aFile, "Date \"%s\"\n", TO_UTF8( m_Date ) ) < 0
|| fprintf( aFile, "Rev \"%s\"\n", TO_UTF8( m_Revision ) ) < 0
|| fprintf( aFile, "Comp \"%s\"\n", TO_UTF8( m_Company ) ) < 0
|| fprintf( aFile, "Comment1 \"%s\"\n", TO_UTF8( m_Commentaire1 ) ) < 0
|| fprintf( aFile, "Comment2 \"%s\"\n", TO_UTF8( m_Commentaire2 ) ) < 0
|| fprintf( aFile, "Comment3 \"%s\"\n", TO_UTF8( m_Commentaire3 ) ) < 0
|| fprintf( aFile, "Comment4 \"%s\"\n", TO_UTF8( m_Commentaire4 ) ) < 0
|| fprintf( aFile, "$EndDescr\n" ) < 0 )
return false;
......
This diff is collapsed.
......@@ -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,
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 )
{
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" ),
aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) );
aErrorMsg << FROM_UTF8( ((char*)aLine) );
return false;
}
m_Text = CONV_FROM_UTF8( name );
m_Text = FROM_UTF8( name );
m_Text = m_Text.AfterFirst( wxChar( '"' ) );
m_Text = m_Text.BeforeLast( wxChar( '"' ) );
......@@ -442,7 +442,7 @@ void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os )
wxString s = GetClass();
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
<< " pin_name=\"" << CONV_TO_UTF8( m_Text )
<< " pin_name=\"" << TO_UTF8( m_Text )
<< '"' << "/>\n" << std::flush;
// NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n";
......
This diff is collapsed.
......@@ -154,7 +154,7 @@ int TEMPLATES::AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
if( m_Fields[i].m_Name == aFieldName.m_Name )
{
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;
return i; // return the container index
......
......@@ -718,7 +718,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
if( !pam )
{
msg.Printf( wxT( "RS274X: aperture macro %s not found\n" ),
CONV_TO_UTF8( am_lookup.name ) );
TO_UTF8( am_lookup.name ) );
ReportMessage( msg );
ok = false;
break;
......@@ -858,7 +858,7 @@ bool GERBER_IMAGE::ReadApertureMacro( char buff[GERBER_BUFZ],
else if( !isdigit(*text) ) // Ill. symbol
{
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 );
primitive_type = AMP_COMMENT;
}
......@@ -911,7 +911,7 @@ bool GERBER_IMAGE::ReadApertureMacro( char buff[GERBER_BUFZ],
default:
// @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\"" ),
GetChars( am.name ), primitive_type, GetChars( CONV_FROM_UTF8( buff ) ) );
GetChars( am.name ), primitive_type, GetChars( FROM_UTF8( buff ) ) );
ReportMessage( msg );
return false;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment