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:
parent
ffa9feda69
commit
92952b70aa
|
@ -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";
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -407,7 +407,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
|
|||
wxFileName tmpFile = aFullFileName;
|
||||
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() );
|
||||
if( !ret )
|
||||
|
@ -426,7 +426,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
|
|||
tmpFile.GetFullPath(),
|
||||
aFullFileName );
|
||||
|
||||
D(printf("commandLine:'%s'\n", CONV_TO_UTF8( commandLine ) );)
|
||||
D(printf("commandLine:'%s'\n", TO_UTF8( commandLine ) );)
|
||||
|
||||
ProcessExecute( commandLine, wxEXEC_SYNC );
|
||||
|
||||
|
@ -650,7 +650,7 @@ XNODE* EXPORT_HELP::makeGenericDesignHeader()
|
|||
// the root sheet is a special sheet, call it source
|
||||
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
|
||||
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, "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.Replace( wxT( " " ), wxT( "_" ) );
|
||||
ret |= fputs( CONV_TO_UTF8( field ), out );
|
||||
ret |= fputs( TO_UTF8( field ), out );
|
||||
|
||||
field = comp->GetField( VALUE )->m_Text;
|
||||
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.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:
|
||||
ret |= fprintf( out, "$BeginPinList\n" );
|
||||
|
@ -1161,7 +1161,7 @@ bool EXPORT_HELP::WriteGENERICNetList( const wxString& aOutFileName )
|
|||
if( netname.IsEmpty() )
|
||||
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" );
|
||||
|
@ -1269,7 +1269,7 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames )
|
|||
spiceCommandAtBeginFile[ii].Remove( 0, BUFYPOS_LEN );
|
||||
spiceCommandAtBeginFile[ii].Trim( true );
|
||||
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" );
|
||||
|
@ -1288,7 +1288,7 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames )
|
|||
|
||||
item = comp;
|
||||
|
||||
ret |= fprintf( f, "%s ", CONV_TO_UTF8( comp->GetRef( sheet ) ) );
|
||||
ret |= fprintf( f, "%s ", TO_UTF8( comp->GetRef( sheet ) ) );
|
||||
|
||||
// Write pin list:
|
||||
for( unsigned ii = 0; ii < m_SortedComponentPinList.size(); ii++ )
|
||||
|
@ -1303,7 +1303,7 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames )
|
|||
netName = wxT( "?" );
|
||||
|
||||
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")
|
||||
{
|
||||
|
@ -1316,7 +1316,7 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames )
|
|||
}
|
||||
|
||||
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].Trim( true );
|
||||
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 );
|
||||
|
||||
ret |= fprintf( f, " ( %s %s",
|
||||
CONV_TO_UTF8( comp->GetPath( path ) ),
|
||||
CONV_TO_UTF8( footprint ) );
|
||||
TO_UTF8( comp->GetPath( path ) ),
|
||||
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.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
|
||||
{
|
||||
field = comp->GetLibName();
|
||||
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" );
|
||||
|
||||
|
@ -1434,7 +1434,7 @@ bool EXPORT_HELP::WriteNetListPCBNEW( FILE* f, bool with_pcbnew )
|
|||
netName.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
||||
ret |= fprintf( f, " ( %4.4s %s )\n", (char*) &pin->m_PinNum,
|
||||
CONV_TO_UTF8( netName ) );
|
||||
TO_UTF8( netName ) );
|
||||
}
|
||||
|
||||
ret |= fprintf( f, " )\n" );
|
||||
|
@ -1460,12 +1460,12 @@ bool EXPORT_HELP::WriteNetListPCBNEW( FILE* f, bool with_pcbnew )
|
|||
|
||||
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
|
||||
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" );
|
||||
|
@ -1693,7 +1693,7 @@ bool EXPORT_HELP::writeGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjects
|
|||
if( ++sameNetcodeCount == 1 )
|
||||
{
|
||||
snprintf( firstItemInNet, sizeof(firstItemInNet), " %s %.4s\n",
|
||||
CONV_TO_UTF8( ref ),
|
||||
TO_UTF8( ref ),
|
||||
(const char*) &aObjectsList[ii]->m_PinNum );
|
||||
}
|
||||
|
||||
|
@ -1701,12 +1701,12 @@ bool EXPORT_HELP::writeGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjects
|
|||
// first item
|
||||
if( sameNetcodeCount == 2 )
|
||||
{
|
||||
ret |= fprintf( f, "%s\n", CONV_TO_UTF8( netcodeName ) );
|
||||
ret |= fprintf( f, "%s\n", TO_UTF8( netcodeName ) );
|
||||
ret |= fputs( firstItemInNet, f );
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -1729,11 +1729,11 @@ void EXPORT_HELP::WriteNetListCADSTAR( FILE* f )
|
|||
SCH_COMPONENT* Component;
|
||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||
|
||||
fprintf( f, "%sHEA\n", CONV_TO_UTF8( StartLine ) );
|
||||
fprintf( f, "%sHEA\n", TO_UTF8( StartLine ) );
|
||||
DateAndTime( Line );
|
||||
fprintf( f, "%sTIM %s\n", CONV_TO_UTF8( StartLine ), Line );
|
||||
fprintf( f, "%sAPP ", CONV_TO_UTF8( StartLine ) );
|
||||
fprintf( f, "\"%s\"\n", CONV_TO_UTF8( Title ) );
|
||||
fprintf( f, "%sTIM %s\n", TO_UTF8( StartLine ), Line );
|
||||
fprintf( f, "%sAPP ", TO_UTF8( StartLine ) );
|
||||
fprintf( f, "\"%s\"\n", TO_UTF8( Title ) );
|
||||
fprintf( f, "\n" );
|
||||
|
||||
// Prepare list of nets generation
|
||||
|
@ -1765,12 +1765,12 @@ void EXPORT_HELP::WriteNetListCADSTAR( FILE* f )
|
|||
*/
|
||||
|
||||
msg = Component->GetRef( sheet );
|
||||
fprintf( f, "%s ", CONV_TO_UTF8( StartCmpDesc ) );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
|
||||
fprintf( f, "%s", TO_UTF8( msg ) );
|
||||
|
||||
msg = Component->GetField( VALUE )->m_Text;
|
||||
msg.Replace( wxT( " " ), wxT( "_" ) );
|
||||
fprintf( f, " \"%s\"", CONV_TO_UTF8( msg ) );
|
||||
fprintf( f, " \"%s\"", TO_UTF8( msg ) );
|
||||
fprintf( f, "\n" );
|
||||
}
|
||||
}
|
||||
|
@ -1781,7 +1781,7 @@ void EXPORT_HELP::WriteNetListCADSTAR( FILE* f )
|
|||
|
||||
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;
|
||||
strncpy( buf, (char*) &aObjectsList[ii]->m_PinNum, 4 );
|
||||
buf[4] = 0;
|
||||
str_pinnum = CONV_FROM_UTF8( buf );
|
||||
str_pinnum = FROM_UTF8( buf );
|
||||
InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ),
|
||||
GetChars( InitNetDesc ),
|
||||
GetChars( refstr ),
|
||||
|
@ -1858,17 +1858,17 @@ void EXPORT_HELP::writeListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjects
|
|||
break;
|
||||
|
||||
case 1:
|
||||
fprintf( f, "%s\n", CONV_TO_UTF8( InitNetDescLine ) );
|
||||
fprintf( f, "%s\n", TO_UTF8( InitNetDescLine ) );
|
||||
fprintf( f, "%s %s %.4s\n",
|
||||
CONV_TO_UTF8( StartNetDesc ),
|
||||
CONV_TO_UTF8( refstr ),
|
||||
TO_UTF8( StartNetDesc ),
|
||||
TO_UTF8( refstr ),
|
||||
(char*) &aObjectsList[ii]->m_PinNum );
|
||||
print_ter++;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf( f, " %s %.4s\n",
|
||||
CONV_TO_UTF8( refstr ),
|
||||
TO_UTF8( refstr ),
|
||||
(char*) &aObjectsList[ii]->m_PinNum );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -1,246 +1,246 @@
|
|||
/***********************/
|
||||
/* class SCH_BUS_ENTRY */
|
||||
/***********************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "macros.h"
|
||||
#include "class_drawpanel.h"
|
||||
#include "trigo.h"
|
||||
#include "common.h"
|
||||
#include "richio.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "protos.h"
|
||||
#include "sch_bus_entry.h"
|
||||
|
||||
|
||||
SCH_BUS_ENTRY::SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ) :
|
||||
SCH_ITEM( NULL, SCH_BUS_ENTRY_T )
|
||||
{
|
||||
m_Pos = pos;
|
||||
m_Size.x = 100;
|
||||
m_Size.y = 100;
|
||||
m_Layer = LAYER_WIRE;
|
||||
m_Width = 0;
|
||||
|
||||
if( id == BUS_TO_BUS )
|
||||
{
|
||||
m_Layer = LAYER_BUS;
|
||||
}
|
||||
|
||||
if( shape == '/' )
|
||||
m_Size.y = -100;
|
||||
}
|
||||
|
||||
|
||||
SCH_BUS_ENTRY::SCH_BUS_ENTRY( const SCH_BUS_ENTRY& aBusEntry ) :
|
||||
SCH_ITEM( aBusEntry )
|
||||
{
|
||||
m_Pos = aBusEntry.m_Pos;
|
||||
m_Size = aBusEntry.m_Size;
|
||||
m_Width = aBusEntry.m_Width;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* SCH_BUS_ENTRY::doClone() const
|
||||
{
|
||||
return new SCH_BUS_ENTRY( *this );
|
||||
}
|
||||
|
||||
|
||||
wxPoint SCH_BUS_ENTRY::m_End() const
|
||||
{
|
||||
return wxPoint( m_Pos.x + m_Size.x, m_Pos.y + m_Size.y );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
const char* layer = "Wire";
|
||||
const char* width = "Line";
|
||||
|
||||
if( GetLayer() == LAYER_BUS )
|
||||
{
|
||||
layer = "Bus"; width = "Bus";
|
||||
}
|
||||
|
||||
if( fprintf( aFile, "Entry %s %s\n", layer, width ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n",
|
||||
m_Pos.x, m_Pos.y, m_End().x, m_End().y ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
||||
{
|
||||
char Name1[256];
|
||||
char Name2[256];
|
||||
char* line = (char*) aLine;
|
||||
|
||||
while( (*line != ' ' ) && *line )
|
||||
line++;
|
||||
|
||||
if( sscanf( line, "%s %s", Name1, Name2 ) != 2 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Layer = LAYER_WIRE;
|
||||
|
||||
if( Name1[0] == 'B' )
|
||||
m_Layer = LAYER_BUS;
|
||||
|
||||
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", &m_Pos.x, &m_Pos.y,
|
||||
&m_Size.x, &m_Size.y ) != 4 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Size.x -= m_Pos.x;
|
||||
m_Size.y -= m_Pos.y;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
EDA_Rect SCH_BUS_ENTRY::GetBoundingBox() const
|
||||
{
|
||||
EDA_Rect box;
|
||||
|
||||
box.SetOrigin( m_Pos );
|
||||
box.SetEnd( m_End() );
|
||||
|
||||
box.Normalize();
|
||||
int width = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||
box.Inflate( width / 2 );
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
int SCH_BUS_ENTRY::GetPenSize() const
|
||||
{
|
||||
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||
|
||||
if( m_Layer == LAYER_BUS && m_Width == 0 )
|
||||
{
|
||||
pensize = wxRound( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
|
||||
pensize = MAX( pensize, 3 );
|
||||
}
|
||||
|
||||
return pensize;
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
||||
int aDrawMode, int aColor )
|
||||
{
|
||||
int color;
|
||||
|
||||
if( aColor >= 0 )
|
||||
color = aColor;
|
||||
else
|
||||
color = ReturnLayerColor( m_Layer );
|
||||
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
GRLine( &aPanel->m_ClipBox, aDC, m_Pos.x + aOffset.x, m_Pos.y + aOffset.y,
|
||||
m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::Mirror_X( int aXaxis_position )
|
||||
{
|
||||
m_Pos.y -= aXaxis_position;
|
||||
NEGATE( m_Pos.y );
|
||||
m_Pos.y += aXaxis_position;
|
||||
NEGATE( m_Size.y );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
m_Pos.x -= aYaxis_position;
|
||||
NEGATE( m_Pos.x );
|
||||
m_Pos.x += aYaxis_position;
|
||||
NEGATE( m_Size.x );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::Rotate( wxPoint rotationPoint )
|
||||
{
|
||||
RotatePoint( &m_Pos, rotationPoint, 900 );
|
||||
RotatePoint( &m_Size.x, &m_Size.y, 900 );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
|
||||
{
|
||||
DANGLING_END_ITEM item( ENTRY_END, this );
|
||||
item.m_Pos = m_Pos;
|
||||
|
||||
DANGLING_END_ITEM item1( ENTRY_END, this );
|
||||
item1.m_Pos = m_End();
|
||||
aItemList.push_back( item );
|
||||
aItemList.push_back( item1 );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
// If either end of the bus entry is inside the selection rectangle, the entire
|
||||
// bus entry is selected. Bus entries have a fixed length and angle.
|
||||
if( aRect.Contains( m_Pos ) || aRect.Contains( m_End() ) )
|
||||
m_Flags |= SELECTED;
|
||||
else
|
||||
m_Flags &= ~SELECTED;
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::GetConnectionPoints( vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
aPoints.push_back( m_Pos );
|
||||
aPoints.push_back( m_End() );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
|
||||
{
|
||||
if( !( aFilter & BUS_ENTRY_T ) )
|
||||
return false;
|
||||
|
||||
return TestSegmentHit( aPoint, m_Pos, m_End(), aAccuracy );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::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_BUS_ENTRY */
|
||||
/***********************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "macros.h"
|
||||
#include "class_drawpanel.h"
|
||||
#include "trigo.h"
|
||||
#include "common.h"
|
||||
#include "richio.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "protos.h"
|
||||
#include "sch_bus_entry.h"
|
||||
|
||||
|
||||
SCH_BUS_ENTRY::SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ) :
|
||||
SCH_ITEM( NULL, SCH_BUS_ENTRY_T )
|
||||
{
|
||||
m_Pos = pos;
|
||||
m_Size.x = 100;
|
||||
m_Size.y = 100;
|
||||
m_Layer = LAYER_WIRE;
|
||||
m_Width = 0;
|
||||
|
||||
if( id == BUS_TO_BUS )
|
||||
{
|
||||
m_Layer = LAYER_BUS;
|
||||
}
|
||||
|
||||
if( shape == '/' )
|
||||
m_Size.y = -100;
|
||||
}
|
||||
|
||||
|
||||
SCH_BUS_ENTRY::SCH_BUS_ENTRY( const SCH_BUS_ENTRY& aBusEntry ) :
|
||||
SCH_ITEM( aBusEntry )
|
||||
{
|
||||
m_Pos = aBusEntry.m_Pos;
|
||||
m_Size = aBusEntry.m_Size;
|
||||
m_Width = aBusEntry.m_Width;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* SCH_BUS_ENTRY::doClone() const
|
||||
{
|
||||
return new SCH_BUS_ENTRY( *this );
|
||||
}
|
||||
|
||||
|
||||
wxPoint SCH_BUS_ENTRY::m_End() const
|
||||
{
|
||||
return wxPoint( m_Pos.x + m_Size.x, m_Pos.y + m_Size.y );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
const char* layer = "Wire";
|
||||
const char* width = "Line";
|
||||
|
||||
if( GetLayer() == LAYER_BUS )
|
||||
{
|
||||
layer = "Bus"; width = "Bus";
|
||||
}
|
||||
|
||||
if( fprintf( aFile, "Entry %s %s\n", layer, width ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n",
|
||||
m_Pos.x, m_Pos.y, m_End().x, m_End().y ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
||||
{
|
||||
char Name1[256];
|
||||
char Name2[256];
|
||||
char* line = (char*) aLine;
|
||||
|
||||
while( (*line != ' ' ) && *line )
|
||||
line++;
|
||||
|
||||
if( sscanf( line, "%s %s", Name1, Name2 ) != 2 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Layer = LAYER_WIRE;
|
||||
|
||||
if( Name1[0] == 'B' )
|
||||
m_Layer = LAYER_BUS;
|
||||
|
||||
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", &m_Pos.x, &m_Pos.y,
|
||||
&m_Size.x, &m_Size.y ) != 4 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Size.x -= m_Pos.x;
|
||||
m_Size.y -= m_Pos.y;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
EDA_Rect SCH_BUS_ENTRY::GetBoundingBox() const
|
||||
{
|
||||
EDA_Rect box;
|
||||
|
||||
box.SetOrigin( m_Pos );
|
||||
box.SetEnd( m_End() );
|
||||
|
||||
box.Normalize();
|
||||
int width = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||
box.Inflate( width / 2 );
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
int SCH_BUS_ENTRY::GetPenSize() const
|
||||
{
|
||||
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||
|
||||
if( m_Layer == LAYER_BUS && m_Width == 0 )
|
||||
{
|
||||
pensize = wxRound( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
|
||||
pensize = MAX( pensize, 3 );
|
||||
}
|
||||
|
||||
return pensize;
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
||||
int aDrawMode, int aColor )
|
||||
{
|
||||
int color;
|
||||
|
||||
if( aColor >= 0 )
|
||||
color = aColor;
|
||||
else
|
||||
color = ReturnLayerColor( m_Layer );
|
||||
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
GRLine( &aPanel->m_ClipBox, aDC, m_Pos.x + aOffset.x, m_Pos.y + aOffset.y,
|
||||
m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::Mirror_X( int aXaxis_position )
|
||||
{
|
||||
m_Pos.y -= aXaxis_position;
|
||||
NEGATE( m_Pos.y );
|
||||
m_Pos.y += aXaxis_position;
|
||||
NEGATE( m_Size.y );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
m_Pos.x -= aYaxis_position;
|
||||
NEGATE( m_Pos.x );
|
||||
m_Pos.x += aYaxis_position;
|
||||
NEGATE( m_Size.x );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::Rotate( wxPoint rotationPoint )
|
||||
{
|
||||
RotatePoint( &m_Pos, rotationPoint, 900 );
|
||||
RotatePoint( &m_Size.x, &m_Size.y, 900 );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
|
||||
{
|
||||
DANGLING_END_ITEM item( ENTRY_END, this );
|
||||
item.m_Pos = m_Pos;
|
||||
|
||||
DANGLING_END_ITEM item1( ENTRY_END, this );
|
||||
item1.m_Pos = m_End();
|
||||
aItemList.push_back( item );
|
||||
aItemList.push_back( item1 );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
// If either end of the bus entry is inside the selection rectangle, the entire
|
||||
// bus entry is selected. Bus entries have a fixed length and angle.
|
||||
if( aRect.Contains( m_Pos ) || aRect.Contains( m_End() ) )
|
||||
m_Flags |= SELECTED;
|
||||
else
|
||||
m_Flags &= ~SELECTED;
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY::GetConnectionPoints( vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
aPoints.push_back( m_Pos );
|
||||
aPoints.push_back( m_End() );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
|
||||
{
|
||||
if( !( aFilter & BUS_ENTRY_T ) )
|
||||
return false;
|
||||
|
||||
return TestSegmentHit( aPoint, m_Pos, m_End(), aAccuracy );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY::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() );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,458 +1,458 @@
|
|||
/******************/
|
||||
/* Class SCH_LINE */
|
||||
/******************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "macros.h"
|
||||
#include "class_drawpanel.h"
|
||||
#include "trigo.h"
|
||||
#include "richio.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "protos.h"
|
||||
#include "sch_line.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
|
||||
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
|
||||
SCH_ITEM( NULL, SCH_LINE_T )
|
||||
{
|
||||
m_Start = pos;
|
||||
m_End = pos;
|
||||
m_Width = 0; // Default thickness used
|
||||
m_StartIsDangling = m_EndIsDangling = FALSE;
|
||||
|
||||
switch( layer )
|
||||
{
|
||||
default:
|
||||
m_Layer = LAYER_NOTES;
|
||||
break;
|
||||
|
||||
case LAYER_WIRE:
|
||||
m_Layer = LAYER_WIRE;
|
||||
break;
|
||||
|
||||
case LAYER_BUS:
|
||||
m_Layer = LAYER_BUS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_LINE::SCH_LINE( const SCH_LINE& aLine ) :
|
||||
SCH_ITEM( aLine )
|
||||
{
|
||||
m_Start = aLine.m_Start;
|
||||
m_End = aLine.m_End;
|
||||
m_Width = aLine.m_Width;
|
||||
m_StartIsDangling = m_EndIsDangling = false;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* SCH_LINE::doClone() const
|
||||
{
|
||||
return new SCH_LINE( *this );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Move( const wxPoint& aOffset )
|
||||
{
|
||||
if( (m_Flags & STARTPOINT) == 0 && aOffset != wxPoint( 0, 0 ) )
|
||||
{
|
||||
m_Start += aOffset;
|
||||
SetModified();
|
||||
}
|
||||
|
||||
if( (m_Flags & ENDPOINT) == 0 && aOffset != wxPoint( 0, 0 ) )
|
||||
{
|
||||
m_End += aOffset;
|
||||
SetModified();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void SCH_LINE::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
|
||||
<< " layer=\"" << m_Layer << '"'
|
||||
<< " width=\"" << m_Width << '"'
|
||||
<< " startIsDangling=\"" << m_StartIsDangling
|
||||
<< '"' << " endIsDangling=\""
|
||||
<< m_EndIsDangling << '"' << ">"
|
||||
<< " <start" << m_Start << "/>"
|
||||
<< " <end" << m_End << "/>" << "</"
|
||||
<< GetClass().Lower().mb_str() << ">\n";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
EDA_Rect SCH_LINE::GetBoundingBox() const
|
||||
{
|
||||
int width = 25;
|
||||
|
||||
int xmin = MIN( m_Start.x, m_End.x ) - width;
|
||||
int ymin = MIN( m_Start.y, m_End.y ) - width;
|
||||
|
||||
int xmax = MAX( m_Start.x, m_End.x ) + width;
|
||||
int ymax = MAX( m_Start.y, m_End.y ) + width;
|
||||
|
||||
// return a rectangle which is [pos,dim) in nature. therefore the +1
|
||||
EDA_Rect ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
const char* layer = "Notes";
|
||||
const char* width = "Line";
|
||||
|
||||
if( GetLayer() == LAYER_WIRE )
|
||||
layer = "Wire";
|
||||
|
||||
if( GetLayer() == LAYER_BUS )
|
||||
layer = "Bus";
|
||||
|
||||
if( fprintf( aFile, "Wire %s %s\n", layer, width ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
|
||||
if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", m_Start.x, m_Start.y,
|
||||
m_End.x, m_End.y ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
||||
{
|
||||
char Name1[256];
|
||||
char Name2[256];
|
||||
char* line = (char*) aLine;
|
||||
|
||||
while( (*line != ' ' ) && *line )
|
||||
line++;
|
||||
|
||||
if( sscanf( line, "%s %s", Name1, Name2 ) != 2 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file segment error at line %d, aborted" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Layer = LAYER_NOTES;
|
||||
|
||||
if( Name1[0] == 'W' )
|
||||
m_Layer = LAYER_WIRE;
|
||||
|
||||
if( Name1[0] == 'B' )
|
||||
m_Layer = LAYER_BUS;
|
||||
|
||||
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ",
|
||||
&m_Start.x, &m_Start.y, &m_End.x, &m_End.y ) != 4 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file Segment struct error at line %d, aborted" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int SCH_LINE::GetPenSize() const
|
||||
{
|
||||
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||
|
||||
if( m_Layer == LAYER_BUS && m_Width == 0 )
|
||||
{
|
||||
pensize = wxRound( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
|
||||
pensize = MAX( pensize, 3 );
|
||||
}
|
||||
|
||||
return pensize;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
|
||||
int DrawMode, int Color )
|
||||
{
|
||||
int color;
|
||||
int width = GetPenSize();
|
||||
|
||||
if( Color >= 0 )
|
||||
color = Color;
|
||||
else
|
||||
color = ReturnLayerColor( m_Layer );
|
||||
|
||||
GRSetDrawMode( DC, DrawMode );
|
||||
|
||||
wxPoint start = m_Start;
|
||||
wxPoint end = m_End;
|
||||
|
||||
if( ( m_Flags & STARTPOINT ) == 0 )
|
||||
start += offset;
|
||||
if( ( m_Flags & ENDPOINT ) == 0 )
|
||||
end += offset;
|
||||
|
||||
if( m_Layer == LAYER_NOTES )
|
||||
GRDashedLine( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y, width, color );
|
||||
else
|
||||
GRLine( &panel->m_ClipBox, DC, start, end, width, color );
|
||||
|
||||
if( m_StartIsDangling )
|
||||
DrawDanglingSymbol( panel, DC, start, color );
|
||||
|
||||
if( m_EndIsDangling )
|
||||
DrawDanglingSymbol( panel, DC, end, color );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Mirror_X( int aXaxis_position )
|
||||
{
|
||||
m_Start.y -= aXaxis_position;
|
||||
NEGATE( m_Start.y );
|
||||
m_Start.y += aXaxis_position;
|
||||
m_End.y -= aXaxis_position;
|
||||
NEGATE( m_End.y );
|
||||
m_End.y += aXaxis_position;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
m_Start.x -= aYaxis_position;
|
||||
NEGATE( m_Start.x );
|
||||
m_Start.x += aYaxis_position;
|
||||
m_End.x -= aYaxis_position;
|
||||
NEGATE( m_End.x );
|
||||
m_End.x += aYaxis_position;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Rotate( wxPoint rotationPoint )
|
||||
{
|
||||
RotatePoint( &m_Start, rotationPoint, 900 );
|
||||
RotatePoint( &m_End, rotationPoint, 900 );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::MergeOverlap( SCH_LINE* aLine )
|
||||
{
|
||||
wxCHECK_MSG( aLine != NULL && aLine->Type() == SCH_LINE_T, false,
|
||||
wxT( "Cannot test line segment for overlap." ) );
|
||||
|
||||
if( this == aLine || GetLayer() != aLine->GetLayer() )
|
||||
return false;
|
||||
|
||||
// Search for a common end, and modify coordinates to ensure RefSegm->m_End
|
||||
// == TstSegm->m_Start
|
||||
if( m_Start == aLine->m_Start )
|
||||
{
|
||||
if( m_End == aLine->m_End )
|
||||
return true;
|
||||
|
||||
EXCHG( m_Start, m_End );
|
||||
}
|
||||
else if( m_Start == aLine->m_End )
|
||||
{
|
||||
EXCHG( m_Start, m_End );
|
||||
EXCHG( aLine->m_Start, aLine->m_End );
|
||||
}
|
||||
else if( m_End == aLine->m_End )
|
||||
{
|
||||
EXCHG( aLine->m_Start, aLine->m_End );
|
||||
}
|
||||
else if( m_End != aLine->m_Start )
|
||||
{
|
||||
// No common end point, segments cannot be merged.
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Test alignment: */
|
||||
if( m_Start.y == m_End.y ) // Horizontal segment
|
||||
{
|
||||
if( aLine->m_Start.y == aLine->m_End.y )
|
||||
{
|
||||
m_End = aLine->m_End;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if( m_Start.x == m_End.x ) // Vertical segment
|
||||
{
|
||||
if( aLine->m_Start.x == aLine->m_End.x )
|
||||
{
|
||||
m_End = aLine->m_End;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( atan2( (double) ( m_Start.x - m_End.x ), (double) ( m_Start.y - m_End.y ) )
|
||||
== atan2( (double) ( aLine->m_Start.x - aLine->m_End.x ),
|
||||
(double) ( aLine->m_Start.y - aLine->m_End.y ) ) )
|
||||
{
|
||||
m_End = aLine->m_End;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
if( GetLayer() == LAYER_NOTES )
|
||||
return;
|
||||
|
||||
if( ( GetLayer() == LAYER_BUS ) || ( GetLayer() == LAYER_WIRE ) )
|
||||
{
|
||||
DANGLING_END_ITEM item( (GetLayer() == LAYER_BUS) ? BUS_START_END : WIRE_START_END, this );
|
||||
item.m_Pos = m_Start;
|
||||
DANGLING_END_ITEM item1( (GetLayer() == LAYER_BUS) ? BUS_END_END : WIRE_END_END, this );
|
||||
item1.m_Pos = m_End;
|
||||
|
||||
aItemList.push_back( item );
|
||||
aItemList.push_back( item1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList )
|
||||
{
|
||||
bool previousStartState = m_StartIsDangling;
|
||||
bool previousEndState = m_EndIsDangling;
|
||||
|
||||
m_StartIsDangling = m_EndIsDangling = true;
|
||||
|
||||
if( GetLayer() == LAYER_WIRE )
|
||||
{
|
||||
BOOST_FOREACH( DANGLING_END_ITEM item, aItemList )
|
||||
{
|
||||
if( item.m_Item == this )
|
||||
continue;
|
||||
|
||||
if( m_Start == item.m_Pos )
|
||||
m_StartIsDangling = false;
|
||||
|
||||
if( m_End == item.m_Pos )
|
||||
m_EndIsDangling = false;
|
||||
|
||||
if( (m_StartIsDangling == false) && (m_EndIsDangling == false) )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( GetLayer() == LAYER_BUS || GetLayer() == LAYER_NOTES )
|
||||
{
|
||||
// Lines on the notes layer and the bus layer cannot be tested for dangling ends.
|
||||
previousStartState = previousEndState = m_StartIsDangling = m_EndIsDangling = false;
|
||||
}
|
||||
|
||||
return ( previousStartState != m_StartIsDangling ) || ( previousEndState != m_EndIsDangling );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
if( aRect.Contains( m_Start ) && aRect.Contains( m_End ) )
|
||||
{
|
||||
m_Flags |= SELECTED;
|
||||
m_Flags &= ~(STARTPOINT | ENDPOINT);
|
||||
}
|
||||
else if( aRect.Contains( m_Start ) )
|
||||
{
|
||||
m_Flags &= ~STARTPOINT;
|
||||
m_Flags |= ( SELECTED | ENDPOINT );
|
||||
}
|
||||
else if( aRect.Contains( m_End ) )
|
||||
{
|
||||
m_Flags &= ~ENDPOINT;
|
||||
m_Flags |= ( SELECTED | STARTPOINT );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Flags &= ~( SELECTED | STARTPOINT | ENDPOINT );
|
||||
}
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::IsConnectable() const
|
||||
{
|
||||
if( m_Layer == LAYER_WIRE || m_Layer == LAYER_BUS )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::GetConnectionPoints( vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
aPoints.push_back( m_Start );
|
||||
aPoints.push_back( m_End );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
|
||||
{
|
||||
if( !( aFilter & ( DRAW_ITEM_T | WIRE_T | BUS_T ) ) )
|
||||
return false;
|
||||
|
||||
if( ( ( aFilter & DRAW_ITEM_T ) && ( m_Layer == LAYER_NOTES ) )
|
||||
|| ( ( aFilter & WIRE_T ) && ( m_Layer == LAYER_WIRE ) )
|
||||
|| ( ( aFilter & BUS_T ) && ( m_Layer == LAYER_BUS ) ) )
|
||||
{
|
||||
if( !TestSegmentHit( aPoint, m_Start, m_End, aAccuracy ) )
|
||||
return false;
|
||||
|
||||
if( ( aFilter & EXCLUDE_ENDPOINTS_T ) && IsEndPoint( aPoint ) )
|
||||
return false;
|
||||
|
||||
if( ( aFilter & ENDPOINTS_ONLY_T ) && !IsEndPoint( aPoint ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::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() );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const
|
||||
{
|
||||
if( m_Layer != LAYER_WIRE && m_Layer != LAYER_BUS )
|
||||
return false;
|
||||
|
||||
return IsEndPoint( aPosition );
|
||||
}
|
||||
/******************/
|
||||
/* Class SCH_LINE */
|
||||
/******************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "macros.h"
|
||||
#include "class_drawpanel.h"
|
||||
#include "trigo.h"
|
||||
#include "richio.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "protos.h"
|
||||
#include "sch_line.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
|
||||
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
|
||||
SCH_ITEM( NULL, SCH_LINE_T )
|
||||
{
|
||||
m_Start = pos;
|
||||
m_End = pos;
|
||||
m_Width = 0; // Default thickness used
|
||||
m_StartIsDangling = m_EndIsDangling = FALSE;
|
||||
|
||||
switch( layer )
|
||||
{
|
||||
default:
|
||||
m_Layer = LAYER_NOTES;
|
||||
break;
|
||||
|
||||
case LAYER_WIRE:
|
||||
m_Layer = LAYER_WIRE;
|
||||
break;
|
||||
|
||||
case LAYER_BUS:
|
||||
m_Layer = LAYER_BUS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_LINE::SCH_LINE( const SCH_LINE& aLine ) :
|
||||
SCH_ITEM( aLine )
|
||||
{
|
||||
m_Start = aLine.m_Start;
|
||||
m_End = aLine.m_End;
|
||||
m_Width = aLine.m_Width;
|
||||
m_StartIsDangling = m_EndIsDangling = false;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* SCH_LINE::doClone() const
|
||||
{
|
||||
return new SCH_LINE( *this );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Move( const wxPoint& aOffset )
|
||||
{
|
||||
if( (m_Flags & STARTPOINT) == 0 && aOffset != wxPoint( 0, 0 ) )
|
||||
{
|
||||
m_Start += aOffset;
|
||||
SetModified();
|
||||
}
|
||||
|
||||
if( (m_Flags & ENDPOINT) == 0 && aOffset != wxPoint( 0, 0 ) )
|
||||
{
|
||||
m_End += aOffset;
|
||||
SetModified();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void SCH_LINE::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
|
||||
<< " layer=\"" << m_Layer << '"'
|
||||
<< " width=\"" << m_Width << '"'
|
||||
<< " startIsDangling=\"" << m_StartIsDangling
|
||||
<< '"' << " endIsDangling=\""
|
||||
<< m_EndIsDangling << '"' << ">"
|
||||
<< " <start" << m_Start << "/>"
|
||||
<< " <end" << m_End << "/>" << "</"
|
||||
<< GetClass().Lower().mb_str() << ">\n";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
EDA_Rect SCH_LINE::GetBoundingBox() const
|
||||
{
|
||||
int width = 25;
|
||||
|
||||
int xmin = MIN( m_Start.x, m_End.x ) - width;
|
||||
int ymin = MIN( m_Start.y, m_End.y ) - width;
|
||||
|
||||
int xmax = MAX( m_Start.x, m_End.x ) + width;
|
||||
int ymax = MAX( m_Start.y, m_End.y ) + width;
|
||||
|
||||
// return a rectangle which is [pos,dim) in nature. therefore the +1
|
||||
EDA_Rect ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
const char* layer = "Notes";
|
||||
const char* width = "Line";
|
||||
|
||||
if( GetLayer() == LAYER_WIRE )
|
||||
layer = "Wire";
|
||||
|
||||
if( GetLayer() == LAYER_BUS )
|
||||
layer = "Bus";
|
||||
|
||||
if( fprintf( aFile, "Wire %s %s\n", layer, width ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
|
||||
if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", m_Start.x, m_Start.y,
|
||||
m_End.x, m_End.y ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
||||
{
|
||||
char Name1[256];
|
||||
char Name2[256];
|
||||
char* line = (char*) aLine;
|
||||
|
||||
while( (*line != ' ' ) && *line )
|
||||
line++;
|
||||
|
||||
if( sscanf( line, "%s %s", Name1, Name2 ) != 2 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file segment error at line %d, aborted" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Layer = LAYER_NOTES;
|
||||
|
||||
if( Name1[0] == 'W' )
|
||||
m_Layer = LAYER_WIRE;
|
||||
|
||||
if( Name1[0] == 'B' )
|
||||
m_Layer = LAYER_BUS;
|
||||
|
||||
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ",
|
||||
&m_Start.x, &m_Start.y, &m_End.x, &m_End.y ) != 4 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file Segment struct error at line %d, aborted" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int SCH_LINE::GetPenSize() const
|
||||
{
|
||||
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||
|
||||
if( m_Layer == LAYER_BUS && m_Width == 0 )
|
||||
{
|
||||
pensize = wxRound( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
|
||||
pensize = MAX( pensize, 3 );
|
||||
}
|
||||
|
||||
return pensize;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
|
||||
int DrawMode, int Color )
|
||||
{
|
||||
int color;
|
||||
int width = GetPenSize();
|
||||
|
||||
if( Color >= 0 )
|
||||
color = Color;
|
||||
else
|
||||
color = ReturnLayerColor( m_Layer );
|
||||
|
||||
GRSetDrawMode( DC, DrawMode );
|
||||
|
||||
wxPoint start = m_Start;
|
||||
wxPoint end = m_End;
|
||||
|
||||
if( ( m_Flags & STARTPOINT ) == 0 )
|
||||
start += offset;
|
||||
if( ( m_Flags & ENDPOINT ) == 0 )
|
||||
end += offset;
|
||||
|
||||
if( m_Layer == LAYER_NOTES )
|
||||
GRDashedLine( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y, width, color );
|
||||
else
|
||||
GRLine( &panel->m_ClipBox, DC, start, end, width, color );
|
||||
|
||||
if( m_StartIsDangling )
|
||||
DrawDanglingSymbol( panel, DC, start, color );
|
||||
|
||||
if( m_EndIsDangling )
|
||||
DrawDanglingSymbol( panel, DC, end, color );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Mirror_X( int aXaxis_position )
|
||||
{
|
||||
m_Start.y -= aXaxis_position;
|
||||
NEGATE( m_Start.y );
|
||||
m_Start.y += aXaxis_position;
|
||||
m_End.y -= aXaxis_position;
|
||||
NEGATE( m_End.y );
|
||||
m_End.y += aXaxis_position;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
m_Start.x -= aYaxis_position;
|
||||
NEGATE( m_Start.x );
|
||||
m_Start.x += aYaxis_position;
|
||||
m_End.x -= aYaxis_position;
|
||||
NEGATE( m_End.x );
|
||||
m_End.x += aYaxis_position;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Rotate( wxPoint rotationPoint )
|
||||
{
|
||||
RotatePoint( &m_Start, rotationPoint, 900 );
|
||||
RotatePoint( &m_End, rotationPoint, 900 );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::MergeOverlap( SCH_LINE* aLine )
|
||||
{
|
||||
wxCHECK_MSG( aLine != NULL && aLine->Type() == SCH_LINE_T, false,
|
||||
wxT( "Cannot test line segment for overlap." ) );
|
||||
|
||||
if( this == aLine || GetLayer() != aLine->GetLayer() )
|
||||
return false;
|
||||
|
||||
// Search for a common end, and modify coordinates to ensure RefSegm->m_End
|
||||
// == TstSegm->m_Start
|
||||
if( m_Start == aLine->m_Start )
|
||||
{
|
||||
if( m_End == aLine->m_End )
|
||||
return true;
|
||||
|
||||
EXCHG( m_Start, m_End );
|
||||
}
|
||||
else if( m_Start == aLine->m_End )
|
||||
{
|
||||
EXCHG( m_Start, m_End );
|
||||
EXCHG( aLine->m_Start, aLine->m_End );
|
||||
}
|
||||
else if( m_End == aLine->m_End )
|
||||
{
|
||||
EXCHG( aLine->m_Start, aLine->m_End );
|
||||
}
|
||||
else if( m_End != aLine->m_Start )
|
||||
{
|
||||
// No common end point, segments cannot be merged.
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Test alignment: */
|
||||
if( m_Start.y == m_End.y ) // Horizontal segment
|
||||
{
|
||||
if( aLine->m_Start.y == aLine->m_End.y )
|
||||
{
|
||||
m_End = aLine->m_End;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if( m_Start.x == m_End.x ) // Vertical segment
|
||||
{
|
||||
if( aLine->m_Start.x == aLine->m_End.x )
|
||||
{
|
||||
m_End = aLine->m_End;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( atan2( (double) ( m_Start.x - m_End.x ), (double) ( m_Start.y - m_End.y ) )
|
||||
== atan2( (double) ( aLine->m_Start.x - aLine->m_End.x ),
|
||||
(double) ( aLine->m_Start.y - aLine->m_End.y ) ) )
|
||||
{
|
||||
m_End = aLine->m_End;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
if( GetLayer() == LAYER_NOTES )
|
||||
return;
|
||||
|
||||
if( ( GetLayer() == LAYER_BUS ) || ( GetLayer() == LAYER_WIRE ) )
|
||||
{
|
||||
DANGLING_END_ITEM item( (GetLayer() == LAYER_BUS) ? BUS_START_END : WIRE_START_END, this );
|
||||
item.m_Pos = m_Start;
|
||||
DANGLING_END_ITEM item1( (GetLayer() == LAYER_BUS) ? BUS_END_END : WIRE_END_END, this );
|
||||
item1.m_Pos = m_End;
|
||||
|
||||
aItemList.push_back( item );
|
||||
aItemList.push_back( item1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList )
|
||||
{
|
||||
bool previousStartState = m_StartIsDangling;
|
||||
bool previousEndState = m_EndIsDangling;
|
||||
|
||||
m_StartIsDangling = m_EndIsDangling = true;
|
||||
|
||||
if( GetLayer() == LAYER_WIRE )
|
||||
{
|
||||
BOOST_FOREACH( DANGLING_END_ITEM item, aItemList )
|
||||
{
|
||||
if( item.m_Item == this )
|
||||
continue;
|
||||
|
||||
if( m_Start == item.m_Pos )
|
||||
m_StartIsDangling = false;
|
||||
|
||||
if( m_End == item.m_Pos )
|
||||
m_EndIsDangling = false;
|
||||
|
||||
if( (m_StartIsDangling == false) && (m_EndIsDangling == false) )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( GetLayer() == LAYER_BUS || GetLayer() == LAYER_NOTES )
|
||||
{
|
||||
// Lines on the notes layer and the bus layer cannot be tested for dangling ends.
|
||||
previousStartState = previousEndState = m_StartIsDangling = m_EndIsDangling = false;
|
||||
}
|
||||
|
||||
return ( previousStartState != m_StartIsDangling ) || ( previousEndState != m_EndIsDangling );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
if( aRect.Contains( m_Start ) && aRect.Contains( m_End ) )
|
||||
{
|
||||
m_Flags |= SELECTED;
|
||||
m_Flags &= ~(STARTPOINT | ENDPOINT);
|
||||
}
|
||||
else if( aRect.Contains( m_Start ) )
|
||||
{
|
||||
m_Flags &= ~STARTPOINT;
|
||||
m_Flags |= ( SELECTED | ENDPOINT );
|
||||
}
|
||||
else if( aRect.Contains( m_End ) )
|
||||
{
|
||||
m_Flags &= ~ENDPOINT;
|
||||
m_Flags |= ( SELECTED | STARTPOINT );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Flags &= ~( SELECTED | STARTPOINT | ENDPOINT );
|
||||
}
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::IsConnectable() const
|
||||
{
|
||||
if( m_Layer == LAYER_WIRE || m_Layer == LAYER_BUS )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::GetConnectionPoints( vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
aPoints.push_back( m_Start );
|
||||
aPoints.push_back( m_End );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
|
||||
{
|
||||
if( !( aFilter & ( DRAW_ITEM_T | WIRE_T | BUS_T ) ) )
|
||||
return false;
|
||||
|
||||
if( ( ( aFilter & DRAW_ITEM_T ) && ( m_Layer == LAYER_NOTES ) )
|
||||
|| ( ( aFilter & WIRE_T ) && ( m_Layer == LAYER_WIRE ) )
|
||||
|| ( ( aFilter & BUS_T ) && ( m_Layer == LAYER_BUS ) ) )
|
||||
{
|
||||
if( !TestSegmentHit( aPoint, m_Start, m_End, aAccuracy ) )
|
||||
return false;
|
||||
|
||||
if( ( aFilter & EXCLUDE_ENDPOINTS_T ) && IsEndPoint( aPoint ) )
|
||||
return false;
|
||||
|
||||
if( ( aFilter & ENDPOINTS_ONLY_T ) && !IsEndPoint( aPoint ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::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() );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const
|
||||
{
|
||||
if( m_Layer != LAYER_WIRE && m_Layer != LAYER_BUS )
|
||||
return false;
|
||||
|
||||
return IsEndPoint( aPosition );
|
||||
}
|
||||
|
|
|
@ -1,186 +1,186 @@
|
|||
/************************/
|
||||
/* 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() );
|
||||
}
|
||||
|
|
|
@ -1,233 +1,233 @@
|
|||
/**********************/
|
||||
/* Class SCH_POLYLINE */
|
||||
/**********************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "macros.h"
|
||||
#include "class_drawpanel.h"
|
||||
#include "trigo.h"
|
||||
#include "common.h"
|
||||
#include "richio.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "protos.h"
|
||||
#include "sch_polyline.h"
|
||||
|
||||
|
||||
SCH_POLYLINE::SCH_POLYLINE( int layer ) :
|
||||
SCH_ITEM( NULL, SCH_POLYLINE_T )
|
||||
{
|
||||
m_Width = 0;
|
||||
|
||||
switch( layer )
|
||||
{
|
||||
default:
|
||||
m_Layer = LAYER_NOTES;
|
||||
break;
|
||||
|
||||
case LAYER_WIRE:
|
||||
case LAYER_NOTES:
|
||||
case LAYER_BUS:
|
||||
m_Layer = layer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_POLYLINE::SCH_POLYLINE( const SCH_POLYLINE& aPolyLine ) :
|
||||
SCH_ITEM( aPolyLine )
|
||||
{
|
||||
m_Width = aPolyLine.m_Width;
|
||||
m_PolyPoints = aPolyLine.m_PolyPoints;
|
||||
}
|
||||
|
||||
|
||||
SCH_POLYLINE::~SCH_POLYLINE()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* SCH_POLYLINE::doClone() const
|
||||
{
|
||||
return new SCH_POLYLINE( *this );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_POLYLINE::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
const char* layer = "Notes";
|
||||
const char* width = "Line";
|
||||
|
||||
if( GetLayer() == LAYER_WIRE )
|
||||
layer = "Wire";
|
||||
|
||||
if( GetLayer() == LAYER_BUS )
|
||||
layer = "Bus";
|
||||
|
||||
if( fprintf( aFile, "Poly %s %s %d\n", width, layer, GetCornerCount() ) == EOF )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
if( fprintf( aFile, "\t%-4d %-4d\n", m_PolyPoints[ii ].x, m_PolyPoints[ii].y ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
||||
{
|
||||
char Name1[256];
|
||||
char Name2[256];
|
||||
wxPoint pt;
|
||||
int ii;
|
||||
char* line = (char*) aLine;
|
||||
|
||||
while( (*line != ' ' ) && *line )
|
||||
line++;
|
||||
|
||||
if( sscanf( line, "%s %s %d", Name1, Name2, &ii ) != 3 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Layer = LAYER_NOTES;
|
||||
|
||||
if( Name2[0] == 'W' )
|
||||
m_Layer = LAYER_WIRE;
|
||||
|
||||
if( Name2[0] == 'B' )
|
||||
m_Layer = LAYER_BUS;
|
||||
|
||||
for( unsigned jj = 0; jj < (unsigned)ii; jj++ )
|
||||
{
|
||||
wxPoint point;
|
||||
|
||||
if( !aLine.ReadLine() || sscanf( ((char*) aLine), "%d %d", &pt.x, &pt.y ) != 2 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
AddPoint( pt );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int SCH_POLYLINE::GetPenSize() const
|
||||
{
|
||||
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||
|
||||
return pensize;
|
||||
}
|
||||
|
||||
|
||||
void SCH_POLYLINE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
||||
int aDrawMode, int aColor )
|
||||
{
|
||||
int color;
|
||||
int width = GetPenSize();
|
||||
|
||||
if( aColor >= 0 )
|
||||
color = aColor;
|
||||
else
|
||||
color = ReturnLayerColor( m_Layer );
|
||||
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
if( m_Layer == LAYER_BUS )
|
||||
{
|
||||
width *= 3;
|
||||
}
|
||||
|
||||
GRMoveTo( m_PolyPoints[0].x, m_PolyPoints[0].y );
|
||||
|
||||
if( m_Layer == LAYER_NOTES )
|
||||
{
|
||||
for( unsigned i = 1; i < GetCornerCount(); i++ )
|
||||
GRDashedLineTo( &aPanel->m_ClipBox, aDC, m_PolyPoints[i].x + aOffset.x,
|
||||
m_PolyPoints[i].y + aOffset.y, width, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( unsigned i = 1; i < GetCornerCount(); i++ )
|
||||
GRLineTo( &aPanel->m_ClipBox, aDC, m_PolyPoints[i].x + aOffset.x,
|
||||
m_PolyPoints[i].y + aOffset.y, width, color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_POLYLINE::Mirror_X( int aXaxis_position )
|
||||
{
|
||||
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
m_PolyPoints[ii].y -= aXaxis_position;
|
||||
NEGATE( m_PolyPoints[ii].y );
|
||||
m_PolyPoints[ii].y = aXaxis_position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_POLYLINE::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
m_PolyPoints[ii].x -= aYaxis_position;
|
||||
NEGATE( m_PolyPoints[ii].x );
|
||||
m_PolyPoints[ii].x = aYaxis_position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_POLYLINE::Rotate( wxPoint rotationPoint )
|
||||
{
|
||||
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
RotatePoint( &m_PolyPoints[ii], rotationPoint, 900 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SCH_POLYLINE::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
|
||||
{
|
||||
if( !( aFilter & ( DRAW_ITEM_T | WIRE_T | BUS_T ) ) )
|
||||
return false;
|
||||
|
||||
for( size_t i = 0; i < m_PolyPoints.size() - 1; i++ )
|
||||
{
|
||||
if( TestSegmentHit( aPoint, m_PolyPoints[i], m_PolyPoints[i + 1], aAccuracy ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_POLYLINE::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_POLYLINE */
|
||||
/**********************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "macros.h"
|
||||
#include "class_drawpanel.h"
|
||||
#include "trigo.h"
|
||||
#include "common.h"
|
||||
#include "richio.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "protos.h"
|
||||
#include "sch_polyline.h"
|
||||
|
||||
|
||||
SCH_POLYLINE::SCH_POLYLINE( int layer ) :
|
||||
SCH_ITEM( NULL, SCH_POLYLINE_T )
|
||||
{
|
||||
m_Width = 0;
|
||||
|
||||
switch( layer )
|
||||
{
|
||||
default:
|
||||
m_Layer = LAYER_NOTES;
|
||||
break;
|
||||
|
||||
case LAYER_WIRE:
|
||||
case LAYER_NOTES:
|
||||
case LAYER_BUS:
|
||||
m_Layer = layer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_POLYLINE::SCH_POLYLINE( const SCH_POLYLINE& aPolyLine ) :
|
||||
SCH_ITEM( aPolyLine )
|
||||
{
|
||||
m_Width = aPolyLine.m_Width;
|
||||
m_PolyPoints = aPolyLine.m_PolyPoints;
|
||||
}
|
||||
|
||||
|
||||
SCH_POLYLINE::~SCH_POLYLINE()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* SCH_POLYLINE::doClone() const
|
||||
{
|
||||
return new SCH_POLYLINE( *this );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_POLYLINE::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
const char* layer = "Notes";
|
||||
const char* width = "Line";
|
||||
|
||||
if( GetLayer() == LAYER_WIRE )
|
||||
layer = "Wire";
|
||||
|
||||
if( GetLayer() == LAYER_BUS )
|
||||
layer = "Bus";
|
||||
|
||||
if( fprintf( aFile, "Poly %s %s %d\n", width, layer, GetCornerCount() ) == EOF )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
if( fprintf( aFile, "\t%-4d %-4d\n", m_PolyPoints[ii ].x, m_PolyPoints[ii].y ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
||||
{
|
||||
char Name1[256];
|
||||
char Name2[256];
|
||||
wxPoint pt;
|
||||
int ii;
|
||||
char* line = (char*) aLine;
|
||||
|
||||
while( (*line != ' ' ) && *line )
|
||||
line++;
|
||||
|
||||
if( sscanf( line, "%s %s %d", Name1, Name2, &ii ) != 3 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Layer = LAYER_NOTES;
|
||||
|
||||
if( Name2[0] == 'W' )
|
||||
m_Layer = LAYER_WIRE;
|
||||
|
||||
if( Name2[0] == 'B' )
|
||||
m_Layer = LAYER_BUS;
|
||||
|
||||
for( unsigned jj = 0; jj < (unsigned)ii; jj++ )
|
||||
{
|
||||
wxPoint point;
|
||||
|
||||
if( !aLine.ReadLine() || sscanf( ((char*) aLine), "%d %d", &pt.x, &pt.y ) != 2 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
|
||||
return false;
|
||||
}
|
||||
|
||||
AddPoint( pt );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int SCH_POLYLINE::GetPenSize() const
|
||||
{
|
||||
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||
|
||||
return pensize;
|
||||
}
|
||||
|
||||
|
||||
void SCH_POLYLINE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
||||
int aDrawMode, int aColor )
|
||||
{
|
||||
int color;
|
||||
int width = GetPenSize();
|
||||
|
||||
if( aColor >= 0 )
|
||||
color = aColor;
|
||||
else
|
||||
color = ReturnLayerColor( m_Layer );
|
||||
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
if( m_Layer == LAYER_BUS )
|
||||
{
|
||||
width *= 3;
|
||||
}
|
||||
|
||||
GRMoveTo( m_PolyPoints[0].x, m_PolyPoints[0].y );
|
||||
|
||||
if( m_Layer == LAYER_NOTES )
|
||||
{
|
||||
for( unsigned i = 1; i < GetCornerCount(); i++ )
|
||||
GRDashedLineTo( &aPanel->m_ClipBox, aDC, m_PolyPoints[i].x + aOffset.x,
|
||||
m_PolyPoints[i].y + aOffset.y, width, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( unsigned i = 1; i < GetCornerCount(); i++ )
|
||||
GRLineTo( &aPanel->m_ClipBox, aDC, m_PolyPoints[i].x + aOffset.x,
|
||||
m_PolyPoints[i].y + aOffset.y, width, color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_POLYLINE::Mirror_X( int aXaxis_position )
|
||||
{
|
||||
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
m_PolyPoints[ii].y -= aXaxis_position;
|
||||
NEGATE( m_PolyPoints[ii].y );
|
||||
m_PolyPoints[ii].y = aXaxis_position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_POLYLINE::Mirror_Y( int aYaxis_position )
|
||||
{
|
||||
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
m_PolyPoints[ii].x -= aYaxis_position;
|
||||
NEGATE( m_PolyPoints[ii].x );
|
||||
m_PolyPoints[ii].x = aYaxis_position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_POLYLINE::Rotate( wxPoint rotationPoint )
|
||||
{
|
||||
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
||||
{
|
||||
RotatePoint( &m_PolyPoints[ii], rotationPoint, 900 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SCH_POLYLINE::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
|
||||
{
|
||||
if( !( aFilter & ( DRAW_ITEM_T | WIRE_T | BUS_T ) ) )
|
||||
return false;
|
||||
|
||||
for( size_t i = 0; i < m_PolyPoints.size() - 1; i++ )
|
||||
{
|
||||
if( TestSegmentHit( aPoint, m_PolyPoints[i], m_PolyPoints[i + 1], aAccuracy ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_POLYLINE::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() );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -131,14 +131,14 @@ bool SCH_SHEET::Save( FILE* aFile ) const
|
|||
/* Save schematic sheetname and filename. */
|
||||
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 )
|
||||
return false;
|
||||
}
|
||||
|
||||
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 )
|
||||
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" ),
|
||||
aLine.LineNumber() );
|
||||
|
||||
aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) );
|
||||
aErrorMsg << FROM_UTF8( ((char*)aLine) );
|
||||
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" ),
|
||||
fieldNdx, aLine.LineNumber() );
|
||||
aErrorMsg << CONV_FROM_UTF8( (char*) aLine );
|
||||
aErrorMsg << FROM_UTF8( (char*) aLine );
|
||||
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" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << CONV_FROM_UTF8( (char*) aLine );
|
||||
aErrorMsg << FROM_UTF8( (char*) aLine );
|
||||
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" ),
|
||||
aLine.LineNumber() );
|
||||
|
||||
aErrorMsg << CONV_FROM_UTF8( (char*) aLine );
|
||||
aErrorMsg << FROM_UTF8( (char*) aLine );
|
||||
}
|
||||
if( size == 0 )
|
||||
size = DEFAULT_SIZE_TEXT;
|
||||
|
||||
if( fieldNdx == 0 )
|
||||
{
|
||||
m_SheetName = CONV_FROM_UTF8( Name1 );
|
||||
m_SheetName = FROM_UTF8( Name1 );
|
||||
m_SheetNameSize = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFileName( CONV_FROM_UTF8( Name1 ) );
|
||||
SetFileName( FROM_UTF8( Name1 ) );
|
||||
|
||||
//printf( "in ReadSheetDescr : m_FileName = %s \n", Name1 );
|
||||
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" ),
|
||||
aLine.LineNumber() );
|
||||
aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) );
|
||||
aErrorMsg << FROM_UTF8( ((char*)aLine) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -999,7 +999,7 @@ void SCH_SHEET::Show( int nestLevel, std::ostream& os )
|
|||
wxString s = GetClass();
|
||||
|
||||
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
|
||||
BOOST_FOREACH( SCH_SHEET_PIN& label, m_labels )
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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",
|
||||
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;
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
|||
return false;
|
||||
}
|
||||
|
||||
wxString val = CONV_FROM_UTF8( text );
|
||||
wxString val = FROM_UTF8( text );
|
||||
for( ;; )
|
||||
{
|
||||
int i = val.find( wxT( "\\n" ) );
|
||||
|
@ -646,7 +646,7 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os )
|
|||
<< " shape=\"" << m_Shape << '"'
|
||||
<< " dangling=\"" << m_IsDangling << '"'
|
||||
<< '>'
|
||||
<< CONV_TO_UTF8( m_Text )
|
||||
<< TO_UTF8( m_Text )
|
||||
<< "</" << 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",
|
||||
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;
|
||||
}
|
||||
|
@ -772,7 +772,7 @@ bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
|||
return false;
|
||||
}
|
||||
|
||||
m_Text = CONV_FROM_UTF8( text );
|
||||
m_Text = FROM_UTF8( text );
|
||||
m_Size.x = m_Size.y = size;
|
||||
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",
|
||||
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;
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
|||
return false;
|
||||
}
|
||||
|
||||
m_Text = CONV_FROM_UTF8( text );
|
||||
m_Text = FROM_UTF8( text );
|
||||
m_Size.x = m_Size.y = size;
|
||||
SetSchematicTextOrientation( orient );
|
||||
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",
|
||||
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;
|
||||
}
|
||||
|
@ -1364,7 +1364,7 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
|||
return false;
|
||||
}
|
||||
|
||||
m_Text = CONV_FROM_UTF8( text );
|
||||
m_Text = FROM_UTF8( text );
|
||||
m_Size.x = m_Size.y = size;
|
||||
SetSchematicTextOrientation( orient );
|
||||
m_Shape = NET_INPUT;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -7,20 +7,6 @@
|
|||
|
||||
#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
|
||||
* converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
|
||||
|
|
|
@ -389,7 +389,7 @@ public:
|
|||
* The implementer only has to implement the write() function, but can
|
||||
* also optionally re-implement GetQuoteChar().
|
||||
* <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().
|
||||
* <p>
|
||||
* Since this is an abstract interface, only classes derived from
|
||||
|
|
|
@ -90,7 +90,7 @@ void WinEDA_PcbFrame::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
|
|||
msg << _("Quantity") << wxT("\";\"");
|
||||
msg << _("Designation") << wxT("\";\"");
|
||||
msg << _("Supplier and ref") << wxT("\";\n" );
|
||||
fprintf( FichBom, "%s", CONV_TO_UTF8( msg ) );
|
||||
fprintf( FichBom, "%s", TO_UTF8( msg ) );
|
||||
|
||||
// Build list
|
||||
CmpList list;
|
||||
|
@ -127,7 +127,7 @@ void WinEDA_PcbFrame::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
|
|||
comp->m_CmpCount = 1;
|
||||
list.Append( comp );
|
||||
}
|
||||
|
||||
|
||||
// increment module
|
||||
Module = Module->Next();
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ void WinEDA_PcbFrame::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
|
|||
msg << current->m_Pkg << wxT( "\";" );
|
||||
msg << current->m_CmpCount << wxT( ";\"" );
|
||||
msg << current->m_Val << wxT( "\";;;\n" );
|
||||
fprintf( FichBom, "%s", CONV_TO_UTF8( msg ) );
|
||||
fprintf( FichBom, "%s", TO_UTF8( msg ) );
|
||||
|
||||
list.DeleteObject( current );
|
||||
delete (current);
|
||||
|
|
|
@ -1250,7 +1250,7 @@ NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const
|
|||
if( aNetcode != net->GetNet() )
|
||||
{
|
||||
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
|
||||
|
|
|
@ -137,7 +137,7 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
|
|||
if( Line[0] == 'T' )
|
||||
{
|
||||
ReadDelimitedText( Text, Line + 2, sizeof(Text) );
|
||||
m_Text->m_Text = CONV_FROM_UTF8( Text );
|
||||
m_Text->m_Text = FROM_UTF8( Text );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ bool DIMENSION::Save( FILE* aFile ) const
|
|||
fprintf( aFile, "Va %d\n", m_Value );
|
||||
|
||||
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
|
||||
fprintf( aFile, "Te \"?\"\n" );
|
||||
|
||||
|
|
|
@ -620,7 +620,7 @@ void EDGE_MODULE::Show( int nestLevel, std::ostream& os )
|
|||
|
||||
// for now, make it look like XML:
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||
" type=\"" << CONV_TO_UTF8( shape ) << "\">";
|
||||
" type=\"" << TO_UTF8( shape ) << "\">";
|
||||
|
||||
os << " <start" << m_Start0 << "/>";
|
||||
os << " <end" << m_End0 << "/>";
|
||||
|
|
|
@ -263,7 +263,7 @@ bool MODULE::Save( FILE* aFile ) const
|
|||
|
||||
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) );
|
||||
if( IsLocked() )
|
||||
|
@ -281,20 +281,20 @@ bool MODULE::Save( FILE* aFile ) const
|
|||
m_Orient, m_Layer, m_LastEdit_Time,
|
||||
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() )
|
||||
{
|
||||
fprintf( aFile, "Cd %s\n", CONV_TO_UTF8( m_Doc ) );
|
||||
fprintf( aFile, "Cd %s\n", TO_UTF8( m_Doc ) );
|
||||
}
|
||||
|
||||
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, "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 );
|
||||
if( m_LocalSolderMaskMargin != 0 )
|
||||
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
|
||||
|
@ -350,7 +350,7 @@ bool MODULE::Save( FILE* aFile ) const
|
|||
|
||||
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;
|
||||
out:
|
||||
|
@ -370,7 +370,7 @@ int MODULE::Write_3D_Descr( FILE* File ) const
|
|||
{
|
||||
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",
|
||||
t3D->m_MatScale.x,
|
||||
|
@ -432,7 +432,7 @@ int MODULE::Read_3D_Descr( LINE_READER* aReader )
|
|||
{
|
||||
char buf[512];
|
||||
ReadDelimitedText( buf, text, 512 );
|
||||
t3D->m_Shape3DName = CONV_FROM_UTF8( buf );
|
||||
t3D->m_Shape3DName = FROM_UTF8( buf );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -525,7 +525,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
case 'L': /* Li = read the library name of the footprint */
|
||||
*BufLine = 0;
|
||||
sscanf( PtLine, " %s", BufLine );
|
||||
m_LibRef = CONV_FROM_UTF8( BufLine );
|
||||
m_LibRef = FROM_UTF8( BufLine );
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
|
@ -563,7 +563,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
{
|
||||
// alternate reference, e.g. /478C2408/478AD1B6
|
||||
sscanf( PtLine, " %s", BufLine );
|
||||
m_Path = CONV_FROM_UTF8( BufLine );
|
||||
m_Path = FROM_UTF8( BufLine );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -592,11 +592,11 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
break;
|
||||
|
||||
case 'C': /* read documentation data */
|
||||
m_Doc = CONV_FROM_UTF8( StrPurge( PtLine ) );
|
||||
m_Doc = FROM_UTF8( StrPurge( PtLine ) );
|
||||
break;
|
||||
|
||||
case 'K': /* Read key words */
|
||||
m_KeyWord = CONV_FROM_UTF8( StrPurge( PtLine ) );
|
||||
m_KeyWord = FROM_UTF8( StrPurge( PtLine ) );
|
||||
break;
|
||||
|
||||
case '.': /* Read specific data */
|
||||
|
@ -811,7 +811,7 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
|
|||
strcat( bufcar, 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 );
|
||||
}
|
||||
else // display time stamp in schematic
|
||||
|
|
|
@ -286,8 +286,8 @@ bool NETCLASS::Save( FILE* aFile ) const
|
|||
bool result = true;
|
||||
|
||||
fprintf( aFile, "$" BRD_NETCLASS "\n" );
|
||||
fprintf( aFile, "Name \"%s\"\n", CONV_TO_UTF8( m_Name ) );
|
||||
fprintf( aFile, "Desc \"%s\"\n", CONV_TO_UTF8( GetDescription() ) );
|
||||
fprintf( aFile, "Name \"%s\"\n", TO_UTF8( m_Name ) );
|
||||
fprintf( aFile, "Desc \"%s\"\n", TO_UTF8( GetDescription() ) );
|
||||
|
||||
// Write parameters
|
||||
|
||||
|
@ -302,7 +302,7 @@ bool NETCLASS::Save( FILE* aFile ) const
|
|||
|
||||
// Write members:
|
||||
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" );
|
||||
|
||||
|
@ -322,7 +322,7 @@ void NETCLASS::Show( int nestLevel, std::ostream& os )
|
|||
for( const_iterator i = begin(); i!=end(); ++i )
|
||||
{
|
||||
// NestedSpace( nestLevel+1, os ) << *i;
|
||||
os << CONV_TO_UTF8( *i );
|
||||
os << TO_UTF8( *i );
|
||||
}
|
||||
|
||||
// NestedSpace( nestLevel, os )
|
||||
|
@ -346,7 +346,7 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader )
|
|||
if( strnicmp( Line, "AddNet", 6 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( Buffer, Line + 6, sizeof(Buffer) );
|
||||
netname = CONV_FROM_UTF8( Buffer );
|
||||
netname = FROM_UTF8( Buffer );
|
||||
Add( netname );
|
||||
continue;
|
||||
}
|
||||
|
@ -392,13 +392,13 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader )
|
|||
if( strnicmp( Line, "Name", 4 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( Buffer, Line + 4, sizeof(Buffer) );
|
||||
m_Name = CONV_FROM_UTF8( Buffer );
|
||||
m_Name = FROM_UTF8( Buffer );
|
||||
continue;
|
||||
}
|
||||
if( strnicmp( Line, "Desc", 4 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( Buffer, Line + 4, sizeof(Buffer) );
|
||||
SetDescription( CONV_FROM_UTF8( Buffer ) );
|
||||
SetDescription( FROM_UTF8( Buffer ) );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ int NETINFO_ITEM::ReadDescr( LINE_READER* aReader )
|
|||
SetNet( tmp );
|
||||
|
||||
ReadDelimitedText( Ltmp, Line + 2, sizeof(Ltmp) );
|
||||
m_Netname = CONV_FROM_UTF8( Ltmp );
|
||||
m_Netname = FROM_UTF8( Ltmp );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -78,10 +78,10 @@ bool NETINFO_ITEM::Save( FILE* aFile ) const
|
|||
bool success = false;
|
||||
|
||||
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, "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 )
|
||||
goto out;
|
||||
|
|
|
@ -467,7 +467,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
|||
|
||||
/* read Netname */
|
||||
ReadDelimitedText( BufLine, PtLine, sizeof(BufLine) );
|
||||
SetNetname( CONV_FROM_UTF8( StrPurge( BufLine ) ) );
|
||||
SetNetname( FROM_UTF8( StrPurge( BufLine ) ) );
|
||||
break;
|
||||
|
||||
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, "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 );
|
||||
|
||||
|
|
|
@ -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 */
|
||||
{
|
||||
ReadDelimitedText( text, line + 2, sizeof(text) );
|
||||
m_Text = CONV_FROM_UTF8( text );
|
||||
m_Text = FROM_UTF8( text );
|
||||
continue;
|
||||
}
|
||||
if( strncmp( line, "nl", 2 ) == 0 ) /* next line of the current text */
|
||||
{
|
||||
ReadDelimitedText( text, line + 2, sizeof(text) );
|
||||
m_Text.Append( '\n' );
|
||||
m_Text += CONV_FROM_UTF8( text );
|
||||
m_Text += FROM_UTF8( text );
|
||||
continue;
|
||||
}
|
||||
if( strncmp( line, "Po", 2 ) == 0 )
|
||||
|
@ -165,7 +165,7 @@ bool TEXTE_PCB::Save( FILE* aFile ) const
|
|||
if ( ii == 0 )
|
||||
fprintf( aFile, "Te \"%s\"\n", EscapedUTF8( txt ).c_str() );
|
||||
else
|
||||
fprintf( aFile, "nl \"%s\"\n", CONV_TO_UTF8( txt ) );
|
||||
fprintf( aFile, "nl \"%s\"\n", TO_UTF8( txt ) );
|
||||
}
|
||||
|
||||
delete list;
|
||||
|
|
|
@ -87,7 +87,7 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const
|
|||
m_Mirror ? 'M' : 'N', m_NoShow ? 'I' : 'V',
|
||||
GetLayer(),
|
||||
m_Italic ? 'I' : 'N',
|
||||
CONV_TO_UTF8( m_Text ) );
|
||||
TO_UTF8( m_Text ) );
|
||||
|
||||
return ret > 20;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
|
|||
SetDrawCoord();
|
||||
/* Read the "text" string. */
|
||||
ReadDelimitedText( BufLine, aLine, sizeof(BufLine) );
|
||||
m_Text = CONV_FROM_UTF8( BufLine );
|
||||
m_Text = FROM_UTF8( BufLine );
|
||||
|
||||
// Test for a reasonable size:
|
||||
if( m_Size.x < TEXTS_MIN_SIZE )
|
||||
|
|
|
@ -109,7 +109,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
|||
// Save the outline main info
|
||||
ret = fprintf( aFile, "ZInfo %8.8lX %d \"%s\"\n",
|
||||
m_TimeStamp, m_NetCode,
|
||||
CONV_TO_UTF8( m_Netname ) );
|
||||
TO_UTF8( m_Netname ) );
|
||||
if( ret < 3 )
|
||||
return false;
|
||||
|
||||
|
@ -282,7 +282,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
|||
m_TimeStamp = ts;
|
||||
m_NetCode = netcode;
|
||||
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
|
||||
|
|
|
@ -53,7 +53,7 @@ void RemoteCommand( const char* cmdline )
|
|||
|
||||
if( strcmp( idcmd, "$PART:" ) == 0 )
|
||||
{
|
||||
modName = CONV_FROM_UTF8( text );
|
||||
modName = FROM_UTF8( text );
|
||||
|
||||
module = frame->GetBoard()->FindModuleByReference( modName );
|
||||
|
||||
|
@ -73,13 +73,13 @@ void RemoteCommand( const char* cmdline )
|
|||
D_PAD* pad = NULL;
|
||||
int netcode = -1;
|
||||
|
||||
pinName = CONV_FROM_UTF8( text );
|
||||
pinName = FROM_UTF8( text );
|
||||
|
||||
text = strtok( NULL, " \n\r" );
|
||||
if( text && strcmp( text, "$PART:" ) == 0 )
|
||||
text = strtok( NULL, "\n\r" );
|
||||
|
||||
modName = CONV_FROM_UTF8( text );
|
||||
modName = FROM_UTF8( text );
|
||||
|
||||
module = frame->GetBoard()->FindModuleByReference( modName );
|
||||
|
||||
|
@ -158,7 +158,7 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
|
|||
case TYPE_MODULE:
|
||||
module = (MODULE*) objectToSync;
|
||||
sprintf( cmd, "$PART: \"%s\"",
|
||||
CONV_TO_UTF8( module->m_Reference->m_Text ) );
|
||||
TO_UTF8( module->m_Reference->m_Text ) );
|
||||
break;
|
||||
|
||||
case TYPE_PAD:
|
||||
|
@ -166,8 +166,8 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
|
|||
pad = (D_PAD*) objectToSync;
|
||||
msg = pad->ReturnStringPadName();
|
||||
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
|
||||
CONV_TO_UTF8( module->m_Reference->m_Text ),
|
||||
CONV_TO_UTF8( msg ) );
|
||||
TO_UTF8( module->m_Reference->m_Text ),
|
||||
TO_UTF8( msg ) );
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE_MODULE:
|
||||
|
@ -183,9 +183,9 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
|
|||
break;
|
||||
|
||||
sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
|
||||
CONV_TO_UTF8( module->m_Reference->m_Text ),
|
||||
TO_UTF8( module->m_Reference->m_Text ),
|
||||
text_key,
|
||||
CONV_TO_UTF8( text_mod->m_Text ) );
|
||||
TO_UTF8( text_mod->m_Text ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -32,7 +32,7 @@ void CreateKeyFile()
|
|||
datetimestr = datetime.FormatISODate( )
|
||||
+ wxT(" ")
|
||||
+ datetime.FormatISOTime( );
|
||||
strcpy(sDate_Time, CONV_TO_UTF8(datetimestr) );
|
||||
strcpy(sDate_Time, TO_UTF8(datetimestr) );
|
||||
|
||||
kdebugFile = fopen( KEYFILE_FILENAME, "wt" );
|
||||
if( kdebugFile )
|
||||
|
|
|
@ -197,10 +197,10 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
|
|||
tracksegment->SetState( BUSY, OFF );
|
||||
|
||||
//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=" \
|
||||
<<CONV_TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) \
|
||||
<<TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) \
|
||||
<<std::endl;)
|
||||
|
||||
GetBoard()->m_Track.Remove( tracksegment );
|
||||
|
|
|
@ -424,7 +424,7 @@ void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl,
|
|||
int r = 0;
|
||||
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
|
||||
|
|
|
@ -555,25 +555,25 @@ void DIALOG_DRC_CONTROL::writeReport( FILE* fp )
|
|||
int count;
|
||||
|
||||
fprintf( fp, "** Drc report for %s **\n",
|
||||
CONV_TO_UTF8( m_Parent->GetScreen()->GetFileName() ) );
|
||||
TO_UTF8( m_Parent->GetScreen()->GetFileName() ) );
|
||||
|
||||
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();
|
||||
|
||||
fprintf( fp, "\n** Found %d DRC errors **\n", count );
|
||||
|
||||
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();
|
||||
|
||||
fprintf( fp, "\n** Found %d unconnected pads **\n", count );
|
||||
|
||||
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" );
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ void DIALOG_FREEROUTE::OnHelpButtonClick( wxCommandEvent& event )
|
|||
DIALOG_DISPLAY_HTML_TEXT_BASE help_Dlg( this, wxID_ANY,
|
||||
_("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.ShowModal();
|
||||
}
|
||||
|
|
|
@ -370,7 +370,7 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames()
|
|||
{
|
||||
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) ) )
|
||||
((wxTextCtrl*)ctl)->SetValue( lname ); // wxTextCtrl
|
||||
|
@ -647,7 +647,7 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
|
|||
|
||||
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 );
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ void CreateShapesSection( FILE* file, BOARD* pcb )
|
|||
orient = pad->m_Orient - module->m_Orient;
|
||||
NORMALIZE_ANGLE_POS( orient );
|
||||
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,
|
||||
layer, orient / 10, mirror );
|
||||
if( orient % 10 )
|
||||
|
@ -422,9 +422,9 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
|
|||
}
|
||||
|
||||
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",
|
||||
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 ),
|
||||
mapYto( module->m_Pos.y ) );
|
||||
fprintf( file, "LAYER %s\n", (module->flag) ? "BOTTOM" : "TOP" );
|
||||
|
@ -435,7 +435,7 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
|
|||
fputs( "\n", file );
|
||||
|
||||
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) */
|
||||
PtTexte = module->m_Reference;
|
||||
|
@ -448,8 +448,8 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
|
|||
PtTexte->m_Size.x,
|
||||
orient / 10, orient % 10,
|
||||
mirror,
|
||||
CONV_TO_UTF8( layer ),
|
||||
CONV_TO_UTF8( PtTexte->m_Text )
|
||||
TO_UTF8( layer ),
|
||||
TO_UTF8( PtTexte->m_Text )
|
||||
);
|
||||
|
||||
fprintf( file, " 0 0 %d %d\n",
|
||||
|
@ -461,8 +461,8 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
|
|||
|
||||
//put a comment:
|
||||
fprintf( file, "SHEET Part %s %s\n",
|
||||
CONV_TO_UTF8( module->m_Reference->m_Text ),
|
||||
CONV_TO_UTF8( module->m_Value->m_Text ) );
|
||||
TO_UTF8( module->m_Reference->m_Text ),
|
||||
TO_UTF8( module->m_Value->m_Text ) );
|
||||
}
|
||||
|
||||
fputs( "$ENDCOMPONENTS\n\n", file );
|
||||
|
@ -502,7 +502,7 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
|
|||
|
||||
msg = wxT( "SIGNAL " ) + net->GetNetname();
|
||||
|
||||
fputs( CONV_TO_UTF8( msg ), file );
|
||||
fputs( TO_UTF8( msg ), file );
|
||||
fputs( "\n", file );
|
||||
|
||||
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( padname ) );
|
||||
|
||||
fputs( CONV_TO_UTF8( msg ), file );
|
||||
fputs( TO_UTF8( msg ), file );
|
||||
fputs( "\n", file );
|
||||
}
|
||||
}
|
||||
|
@ -539,18 +539,18 @@ bool CreateHeaderInfoData( FILE* file, WinEDA_PcbFrame* frame )
|
|||
fputs( "GENCAD 1.4\n", file );
|
||||
msg = wxT( "USER " ) + wxGetApp().GetAppName() + wxT( " " ) +
|
||||
GetBuildVersion();
|
||||
fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file );
|
||||
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
||||
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( " " ) +
|
||||
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 );
|
||||
fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file );
|
||||
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
||||
msg.Printf( wxT( "ORIGIN %d %d" ),
|
||||
mapXto( frame->m_Auxiliary_Axis_Position.x ),
|
||||
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( "$ENDHEADER\n\n", file );
|
||||
|
||||
|
@ -638,7 +638,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
|
|||
netname = net->GetNetname();
|
||||
else
|
||||
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 )
|
||||
|
@ -653,7 +653,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
|
|||
{
|
||||
old_layer = track->GetLayer();
|
||||
fprintf( file, "LAYER %s\n",
|
||||
CONV_TO_UTF8( GenCAD_Layer_Name[track->GetLayer() &
|
||||
TO_UTF8( GenCAD_Layer_Name[track->GetLayer() &
|
||||
0x1F] ) );
|
||||
}
|
||||
|
||||
|
@ -690,8 +690,8 @@ void CreateDevicesSection( FILE* file, BOARD* pcb )
|
|||
for( module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||
{
|
||||
fprintf( file, "DEVICE %s\n",
|
||||
CONV_TO_UTF8( module->m_Reference->m_Text ) );
|
||||
fprintf( file, "PART %s\n", CONV_TO_UTF8( module->m_LibRef ) );
|
||||
TO_UTF8( module->m_Reference->m_Text ) );
|
||||
fprintf( file, "PART %s\n", TO_UTF8( module->m_LibRef ) );
|
||||
fprintf( file, "TYPE %s\n", "UNKNOWN" );
|
||||
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",
|
||||
CONV_TO_UTF8( module->m_Value->m_Text ) );
|
||||
TO_UTF8( module->m_Value->m_Text ) );
|
||||
}
|
||||
|
||||
fputs( "$ENDDEVICES\n\n", file );
|
||||
|
@ -824,7 +824,7 @@ void FootprintWriteShape( FILE* file, MODULE* module )
|
|||
// module / mirror axis and conventions)
|
||||
|
||||
/* 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",
|
||||
(module->m_Attributs & MOD_CMS) ? "SMD" : "TH" );
|
||||
|
||||
|
|
|
@ -1104,7 +1104,7 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
|||
offsetz + layer_z[aModule->GetLayer()] );
|
||||
fprintf( aOutputFile,
|
||||
" children [\n Inline {\n url \"%s\"\n } ]\n",
|
||||
CONV_TO_UTF8( fname ) );
|
||||
TO_UTF8( fname ) );
|
||||
fprintf( aOutputFile, " }\n" );
|
||||
|
||||
}
|
||||
|
@ -1194,7 +1194,7 @@ bool WinEDA_PcbFrame::ExportVRML_File( const wxString & aFullFileName,
|
|||
fprintf( output_file, "#VRML V2.0 utf8\n"
|
||||
"WorldInfo {\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.
|
||||
* It is trivial to embed everything in a transform node to
|
||||
|
|
|
@ -203,7 +203,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
|||
sprintf( line, "%2.2fmm / %2.3f\" ",
|
||||
double (aToolListBuffer[ii].m_Diameter) * 0.00254,
|
||||
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.
|
||||
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_OvalCount,
|
||||
aToolListBuffer[ii].m_OvalCount );
|
||||
msg += CONV_FROM_UTF8( line );
|
||||
msg += FROM_UTF8( line );
|
||||
plotter->text( wxPoint( plotX, y ), BLACK,
|
||||
msg,
|
||||
0, wxSize( (int) ( CharSize * CharScale ), (int) ( CharSize * CharScale ) ),
|
||||
|
@ -301,7 +301,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
|
|||
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 ) );
|
||||
|
||||
// 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",
|
||||
CONV_TO_UTF8( aPcb->GetLayerName( layer1 ) ),
|
||||
CONV_TO_UTF8( aPcb->GetLayerName( layer2 ) ) );
|
||||
TO_UTF8( aPcb->GetLayerName( layer1 ) ),
|
||||
TO_UTF8( aPcb->GetLayerName( layer2 ) ) );
|
||||
}
|
||||
|
||||
fputs( line, aFile );
|
||||
|
|
|
@ -99,7 +99,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
|
|||
if( module->m_Attributs & MOD_VIRTUAL )
|
||||
{
|
||||
D( printf( "skipping module %s because it's virtual\n",
|
||||
CONV_TO_UTF8( module->GetReference() ) );)
|
||||
TO_UTF8( module->GetReference() ) );)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
|
|||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
#else
|
||||
|
@ -217,7 +217,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
|
|||
fputs( line, fpBack );
|
||||
|
||||
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 );
|
||||
|
||||
if( doBoardBack )
|
||||
|
@ -229,12 +229,12 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
|
|||
if( doBoardBack )
|
||||
fputs( line, fpBack );
|
||||
|
||||
sprintf( line, "## Side : %s\n", CONV_TO_UTF8( frontLayerName ) );
|
||||
sprintf( line, "## Side : %s\n", TO_UTF8( frontLayerName ) );
|
||||
fputs( line, fpFront );
|
||||
|
||||
if( doBoardBack )
|
||||
{
|
||||
sprintf( line, "## Side : %s\n", CONV_TO_UTF8( backLayerName ) );
|
||||
sprintf( line, "## Side : %s\n", TO_UTF8( backLayerName ) );
|
||||
fputs( line, fpBack );
|
||||
}
|
||||
|
||||
|
@ -249,8 +249,8 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
|
|||
wxPoint module_pos;
|
||||
wxString ref = Liste[ii].m_Reference;
|
||||
wxString val = Liste[ii].m_Value;
|
||||
sprintf( line, "%-8.8s %-16.16s ", CONV_TO_UTF8( ref ),
|
||||
CONV_TO_UTF8( val ) );
|
||||
sprintf( line, "%-8.8s %-16.16s ", TO_UTF8( ref ),
|
||||
TO_UTF8( val ) );
|
||||
|
||||
module_pos = Liste[ii].m_Module->m_Pos;
|
||||
module_pos.x -= File_Place_Offset.x;
|
||||
|
@ -268,13 +268,13 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
|
|||
|
||||
if( layer == LAYER_N_FRONT )
|
||||
{
|
||||
strcat( line, CONV_TO_UTF8( frontLayerName ) );
|
||||
strcat( line, TO_UTF8( frontLayerName ) );
|
||||
strcat( line, "\n" );
|
||||
fputs( line, fpFront );
|
||||
}
|
||||
else if( layer == LAYER_N_BACK )
|
||||
{
|
||||
strcat( line, CONV_TO_UTF8( backLayerName ) );
|
||||
strcat( line, TO_UTF8( backLayerName ) );
|
||||
strcat( line, "\n" );
|
||||
fputs( line, fpBack );
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
|
|||
fputs( line, rptfile );
|
||||
|
||||
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( "## Unit = inches, Angle = deg.\n", rptfile );
|
||||
|
||||
|
@ -387,16 +387,16 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
|
|||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
sprintf( line, "$MODULE \"%s\"\n",
|
||||
CONV_TO_UTF8( Module->m_Reference->m_Text ) );
|
||||
TO_UTF8( Module->m_Reference->m_Text ) );
|
||||
fputs( line, rptfile );
|
||||
|
||||
sprintf( line, "reference \"%s\"\n",
|
||||
CONV_TO_UTF8( Module->m_Reference->m_Text ) );
|
||||
TO_UTF8( Module->m_Reference->m_Text ) );
|
||||
fputs( line, rptfile );
|
||||
sprintf( line, "value \"%s\"\n",
|
||||
CONV_TO_UTF8( Module->m_Value->m_Text ) );
|
||||
TO_UTF8( Module->m_Value->m_Text ) );
|
||||
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 );
|
||||
|
||||
msg = wxT( "attribut" );
|
||||
|
@ -407,7 +407,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
|
|||
if( ( Module->m_Attributs & (MOD_VIRTUAL | MOD_CMS) ) == 0 )
|
||||
msg += wxT( " none" );
|
||||
msg += wxT( "\n" );
|
||||
fputs( CONV_TO_UTF8( msg ), rptfile );
|
||||
fputs( TO_UTF8( msg ), rptfile );
|
||||
|
||||
module_pos = Module->m_Pos;
|
||||
module_pos.x -= File_Place_Offset.x;
|
||||
|
@ -468,7 +468,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
fprintf( rptfile, "$EndMODULE %s\n\n",
|
||||
CONV_TO_UTF8(Module->m_Reference->m_Text ) );
|
||||
TO_UTF8(Module->m_Reference->m_Text ) );
|
||||
}
|
||||
|
||||
/* Write board Edges */
|
||||
|
|
|
@ -442,7 +442,7 @@ void EXCELLON_WRITER::WriteCoordinates( char * aLine, double aCoordX, double aCo
|
|||
while( ys[j] == '0' && 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;
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ void EXCELLON_WRITER::WriteCoordinates( char * aLine, double aCoordX, double aCo
|
|||
ypad++;
|
||||
xs.Printf( wxT( "%0*d" ), xpad, wxRound( aCoordX ) );
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ void EXCELLON_WRITER::WriteHeader( )
|
|||
|
||||
// The next 2 lines in EXCELLON files are comments:
|
||||
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 );
|
||||
msg = wxT( ";FORMAT={" );
|
||||
|
||||
|
@ -513,7 +513,7 @@ void EXCELLON_WRITER::WriteHeader( )
|
|||
|
||||
msg << zero_fmt[m_zeroFormat];
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|||
// Read pad number:
|
||||
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.y = (ibuf[1] + ibuf[3]) / 2;
|
||||
|
@ -399,7 +399,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|||
// Read pad number:
|
||||
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.y = ibuf[1];
|
||||
|
|
|
@ -394,7 +394,7 @@ int WinEDA_BasePcbFrame::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( data )
|
||||
{
|
||||
wxString layerName = CONV_FROM_UTF8( data );
|
||||
wxString layerName = FROM_UTF8( data );
|
||||
GetBoard()->SetLayerName( layer, layerName );
|
||||
|
||||
data = strtok( NULL, " \n\r" );
|
||||
|
@ -660,7 +660,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
|
|||
if( layerMask & 1 )
|
||||
{
|
||||
fprintf( aFile, "Layer[%d] %s %s\n", layer,
|
||||
CONV_TO_UTF8( aBoard->GetLayerName( layer ) ),
|
||||
TO_UTF8( aBoard->GetLayerName( 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 );
|
||||
|
||||
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(" "), wxT(" "), true);
|
||||
fprintf( aFile, "PcbPlotParams %s\n", CONV_TO_UTF8( record ) );
|
||||
fprintf( aFile, "PcbPlotParams %s\n", TO_UTF8( record ) );
|
||||
|
||||
fprintf( aFile, "$EndSETUP\n\n" );
|
||||
return 1;
|
||||
|
@ -775,6 +775,7 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
|
|||
/* Write copper layer count */
|
||||
NbLayers = GetBoard()->GetCopperLayerCount();
|
||||
fprintf( File, "$GENERAL\n" );
|
||||
fprintf( File, "encoding utf-8\n");
|
||||
fprintf( File, "LayerCount %d\n", NbLayers );
|
||||
|
||||
// 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, "Sheet %s %d %d\n",
|
||||
CONV_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, "Date \"%s\"\n", CONV_TO_UTF8( screen->m_Date ) );
|
||||
fprintf( File, "Rev \"%s\"\n", CONV_TO_UTF8( screen->m_Revision ) );
|
||||
fprintf( File, "Comp \"%s\"\n", CONV_TO_UTF8( screen->m_Company ) );
|
||||
fprintf( File, "Comment1 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire1 ) );
|
||||
fprintf( File, "Comment2 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire2 ) );
|
||||
fprintf( File, "Comment3 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire3 ) );
|
||||
fprintf( File, "Comment4 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire4 ) );
|
||||
TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y );
|
||||
fprintf( File, "Title \"%s\"\n", TO_UTF8( screen->m_Title ) );
|
||||
fprintf( File, "Date \"%s\"\n", TO_UTF8( screen->m_Date ) );
|
||||
fprintf( File, "Rev \"%s\"\n", TO_UTF8( screen->m_Revision ) );
|
||||
fprintf( File, "Comp \"%s\"\n", TO_UTF8( screen->m_Company ) );
|
||||
fprintf( File, "Comment1 \"%s\"\n", TO_UTF8( screen->m_Commentaire1 ) );
|
||||
fprintf( File, "Comment2 \"%s\"\n", TO_UTF8( screen->m_Commentaire2 ) );
|
||||
fprintf( File, "Comment3 \"%s\"\n", TO_UTF8( screen->m_Commentaire3 ) );
|
||||
fprintf( File, "Comment4 \"%s\"\n", TO_UTF8( screen->m_Commentaire4 ) );
|
||||
|
||||
fprintf( File, "$EndSHEETDESCR\n\n" );
|
||||
return TRUE;
|
||||
|
@ -862,7 +863,7 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
|
|||
int 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;
|
||||
if( sheet == &g_Sheet_user )
|
||||
|
@ -884,56 +885,56 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
|
|||
if( strnicmp( Line, "Title", 2 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
screen->m_Title = CONV_FROM_UTF8( buf );
|
||||
screen->m_Title = FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Date", 2 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
screen->m_Date = CONV_FROM_UTF8( buf );
|
||||
screen->m_Date = FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Rev", 2 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
screen->m_Revision = CONV_FROM_UTF8( buf );
|
||||
screen->m_Revision = FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comp", 4 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
screen->m_Company = CONV_FROM_UTF8( buf );
|
||||
screen->m_Company = FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comment1", 8 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
screen->m_Commentaire1 = CONV_FROM_UTF8( buf );
|
||||
screen->m_Commentaire1 = FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comment2", 8 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
screen->m_Commentaire2 = CONV_FROM_UTF8( buf );
|
||||
screen->m_Commentaire2 = FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comment3", 8 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
screen->m_Commentaire3 = CONV_FROM_UTF8( buf );
|
||||
screen->m_Commentaire3 = FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comment4", 8 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
screen->m_Commentaire4 = CONV_FROM_UTF8( buf );
|
||||
screen->m_Commentaire4 = FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1147,7 +1148,7 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
|
|||
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
|
||||
DateAndTime( line ) );
|
||||
fprintf( aFile, "# Created by Pcbnew%s\n\n",
|
||||
CONV_TO_UTF8( GetBuildVersion() ) );
|
||||
TO_UTF8( GetBuildVersion() ) );
|
||||
|
||||
GetBoard()->SynchronizeNetsAndNetClasses();
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& event )
|
|||
|
||||
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 );
|
||||
|
||||
if( newColor >= 0 )
|
||||
|
@ -252,7 +252,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event )
|
|||
|
||||
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 );
|
||||
|
||||
if( newColor >= 0 )
|
||||
|
@ -747,7 +747,7 @@ int LAYER_WIDGET::GetLayerColor( int aLayer )
|
|||
wxASSERT( bmb );
|
||||
|
||||
wxString colorTxt = bmb->GetName();
|
||||
int color = strtoul( CONV_TO_UTF8(colorTxt), NULL, 0 );
|
||||
int color = strtoul( TO_UTF8(colorTxt), NULL, 0 );
|
||||
return color;
|
||||
}
|
||||
|
||||
|
|
|
@ -198,9 +198,10 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* aModule, bool aCreateSysLib
|
|||
SetLocaleTo_C_standard();
|
||||
|
||||
fprintf( file, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) );
|
||||
fprintf( file, "# encoding utf-8\n");
|
||||
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 );
|
||||
|
||||
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 ) )
|
||||
{
|
||||
StrPurge( Line );
|
||||
msg = CONV_FROM_UTF8( Line );
|
||||
msg = FROM_UTF8( Line );
|
||||
if( CmpName.CmpNoCase( msg ) == 0 ) /* New module? */
|
||||
{
|
||||
NoFound = 0; break;
|
||||
|
@ -307,7 +308,9 @@ void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const wxString& aLibname
|
|||
|
||||
/* Create header with new date. */
|
||||
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 );
|
||||
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 )
|
||||
break;
|
||||
StrPurge( Line );
|
||||
msg = CONV_FROM_UTF8( Line );
|
||||
msg = FROM_UTF8( Line );
|
||||
if( CmpName.CmpNoCase( msg ) != 0 )
|
||||
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 )
|
||||
{
|
||||
sscanf( Line + 7, " %s", Name );
|
||||
msg = CONV_FROM_UTF8( Name );
|
||||
msg = FROM_UTF8( Name );
|
||||
if( msg.CmpNoCase( CmpName ) == 0 )
|
||||
{
|
||||
/* Delete old module. */
|
||||
|
@ -449,6 +452,7 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName,
|
|||
}
|
||||
char Line[256];
|
||||
fprintf( lib_module, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) );
|
||||
fprintf( lib_module, "# encoding utf-8\n");
|
||||
fputs( "$INDEX\n", lib_module );
|
||||
fputs( "$EndINDEX\n", lib_module );
|
||||
fputs( "$EndLIBRARY\n", lib_module );
|
||||
|
@ -564,7 +568,7 @@ bool WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
|||
}
|
||||
|
||||
StrPurge( Line );
|
||||
msg = CONV_FROM_UTF8( Line );
|
||||
msg = FROM_UTF8( Line );
|
||||
if( Name_Cmp.CmpNoCase( msg ) == 0 ) /* an existing footprint is
|
||||
* found */
|
||||
{
|
||||
|
@ -616,7 +620,9 @@ bool WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
|||
|
||||
/* Create the library header with a new date */
|
||||
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;
|
||||
GetLine( lib_module, Line, &LineNum );
|
||||
|
@ -635,7 +641,7 @@ bool WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
|||
}
|
||||
}
|
||||
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 )
|
||||
break;
|
||||
}
|
||||
|
@ -651,7 +657,7 @@ bool WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
|||
if( strnicmp( Line, "$MODULE", 7 ) == 0 )
|
||||
{
|
||||
sscanf( Line + 7, " %s", Name );
|
||||
msg = CONV_FROM_UTF8( Name );
|
||||
msg = FROM_UTF8( Name );
|
||||
if( msg.CmpNoCase( Name_Cmp ) == 0 )
|
||||
{
|
||||
/* skip old footprint descr (delete from the lib) */
|
||||
|
|
|
@ -277,7 +277,7 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module(
|
|||
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
|
||||
break;
|
||||
StrPurge( Line );
|
||||
msg = CONV_FROM_UTF8( Line );
|
||||
msg = FROM_UTF8( Line );
|
||||
if( msg.CmpNoCase( aModuleName ) == 0 )
|
||||
{
|
||||
Found = 1;
|
||||
|
@ -303,7 +303,7 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module(
|
|||
StrPurge( Line + 8 );
|
||||
|
||||
// Read module name.
|
||||
Name = CONV_FROM_UTF8( Line + 8 );
|
||||
Name = FROM_UTF8( Line + 8 );
|
||||
|
||||
if( Name.CmpNoCase( aModuleName ) == 0 )
|
||||
{
|
||||
|
|
|
@ -189,7 +189,7 @@ bool WinEDA_PcbFrame::ReadPcbNetlist( const wxString& aNetlistFullFilename,
|
|||
GetScreen()->ClearUndoRedoList();
|
||||
|
||||
OnModify();
|
||||
|
||||
|
||||
// Clear flags and pointeurs to avoid inconsistencies
|
||||
GetBoard()->m_Status_Pcb = 0;
|
||||
SetCurItem( NULL );
|
||||
|
@ -430,22 +430,22 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
if( ( text = strtok( Line, " ()\t\n" ) ) == NULL )
|
||||
Error = 1;
|
||||
else
|
||||
TimeStampPath = CONV_FROM_UTF8( text );
|
||||
TimeStampPath = FROM_UTF8( text );
|
||||
|
||||
if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL )
|
||||
Error = 1;
|
||||
else
|
||||
TextNameLibMod = CONV_FROM_UTF8( text );
|
||||
TextNameLibMod = FROM_UTF8( text );
|
||||
|
||||
if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL )
|
||||
Error = 1;
|
||||
else
|
||||
TextCmpName = CONV_FROM_UTF8( text );
|
||||
TextCmpName = FROM_UTF8( text );
|
||||
|
||||
if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL )
|
||||
Error = -1;
|
||||
else
|
||||
TextValeur = CONV_FROM_UTF8( text );
|
||||
TextValeur = FROM_UTF8( text );
|
||||
|
||||
if( Error > 0 )
|
||||
return NULL;
|
||||
|
@ -612,7 +612,7 @@ int SetPadNetName( char* Text,
|
|||
{
|
||||
trouve = true;
|
||||
if( *TextNetName != '?' )
|
||||
pad->SetNetname( CONV_FROM_UTF8( TextNetName ) );
|
||||
pad->SetNetname( FROM_UTF8( TextNetName ) );
|
||||
else
|
||||
pad->SetNetname( wxEmptyString );
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ int SetPadNetName( char* Text,
|
|||
{
|
||||
if( aMessageWindow )
|
||||
{
|
||||
wxString pin_name = CONV_FROM_UTF8( TextPinName );
|
||||
wxString pin_name = FROM_UTF8( TextPinName );
|
||||
Msg.Printf( _( "Module [%s]: Pad [%s] not found" ),
|
||||
GetChars( Module->m_Reference->m_Text ),
|
||||
GetChars( pin_name ) );
|
||||
|
@ -838,7 +838,7 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
|
|||
if( ( Text = strtok( NULL, " ()\t\n" ) ) == NULL )
|
||||
Error = 1;
|
||||
nb_modules_lus++;
|
||||
aBufName.Add( CONV_FROM_UTF8( Text ) );
|
||||
aBufName.Add( FROM_UTF8( Text ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -925,7 +925,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
|||
ptcar = Line + 11;
|
||||
ptcar = strtok( ptcar, " =;\t\n" );
|
||||
if( ptcar )
|
||||
refcurrcmp = CONV_FROM_UTF8( ptcar );
|
||||
refcurrcmp = FROM_UTF8( ptcar );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -934,7 +934,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
|||
ptcar = Line + 11;
|
||||
ptcar = strtok( ptcar, " =;\t\n" );
|
||||
if( ptcar )
|
||||
idmod = CONV_FROM_UTF8( ptcar );
|
||||
idmod = FROM_UTF8( ptcar );
|
||||
continue;
|
||||
}
|
||||
if( strnicmp( Line, "TimeStamp =", 11 ) == 0 )
|
||||
|
@ -942,7 +942,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
|||
ptcar = Line + 11;
|
||||
ptcar = strtok( ptcar, " =;\t\n" );
|
||||
if( ptcar )
|
||||
timestamp = CONV_FROM_UTF8( ptcar );
|
||||
timestamp = FROM_UTF8( ptcar );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "plot_common.h"
|
||||
#include "macros.h"
|
||||
|
||||
#define PLOT_LINEWIDTH_MIN 40
|
||||
#define PLOT_LINEWIDTH_MIN 0
|
||||
#define PLOT_LINEWIDTH_MAX 200
|
||||
#define HPGL_PEN_DIAMETER_MIN 0
|
||||
#define HPGL_PEN_DIAMETER_MAX 100
|
||||
|
@ -377,7 +377,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
|
|||
break;
|
||||
case T_outputdirectory:
|
||||
NeedSYMBOL();
|
||||
aPcbPlotParams->outputDirectory = CONV_FROM_UTF8( CurText() );
|
||||
aPcbPlotParams->outputDirectory = FROM_UTF8( CurText() );
|
||||
break;
|
||||
default:
|
||||
Unexpected( CurText() );
|
||||
|
|
|
@ -55,7 +55,7 @@ int main( int argc, char** argv )
|
|||
|
||||
if( argc == 2 )
|
||||
{
|
||||
filename = CONV_FROM_UTF8( argv[1] );
|
||||
filename = FROM_UTF8( argv[1] );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -65,7 +65,7 @@ int main( int argc, char** argv )
|
|||
}
|
||||
catch( IO_ERROR ioe )
|
||||
{
|
||||
fprintf( stderr, "%s\n", CONV_TO_UTF8(ioe.errorText) );
|
||||
fprintf( stderr, "%s\n", TO_UTF8(ioe.errorText) );
|
||||
failed = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
|
|||
char buf[1024];
|
||||
strcpy( buf, Line + 12 );
|
||||
strtok( buf, ";\n\r" );
|
||||
if( stricmp( buf, CONV_TO_UTF8( reference ) ) == 0 )
|
||||
if( stricmp( buf, TO_UTF8( reference ) ) == 0 )
|
||||
{
|
||||
start_descr = true;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
|
|||
|
||||
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" );
|
||||
m_WinMessages->AppendText( msg );
|
||||
|
@ -606,15 +606,15 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
|
|||
{
|
||||
fprintf( FichCmp, "\nBeginCmp\n" );
|
||||
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",
|
||||
!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",
|
||||
!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",
|
||||
CONV_TO_UTF8( Module->m_LibRef ) );
|
||||
TO_UTF8( Module->m_LibRef ) );
|
||||
fprintf( FichCmp, "EndCmp\n" );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue