wxT-ify utils.

This commit is contained in:
Jeff Young 2022-02-08 21:47:43 +00:00
parent 4fbb957fa3
commit 209d593ca0
13 changed files with 225 additions and 211 deletions

View File

@ -121,33 +121,33 @@ bool IDF2VRML::OnInit()
void IDF2VRML::OnInitCmdLine( wxCmdLineParser& parser ) void IDF2VRML::OnInitCmdLine( wxCmdLineParser& parser )
{ {
parser.SetDesc( cmdLineDesc ); parser.SetDesc( cmdLineDesc );
parser.SetSwitchChars( "-" ); parser.SetSwitchChars( wxT( "-" ) );
return; return;
} }
bool IDF2VRML::OnCmdLineParsed( wxCmdLineParser& parser ) bool IDF2VRML::OnCmdLineParsed( wxCmdLineParser& parser )
{ {
if( parser.Found( "k" ) ) if( parser.Found( wxT( "k" ) ) )
m_Compact = false; m_Compact = false;
double scale; double scale;
if( parser.Found( "s", &scale ) ) if( parser.Found( wxT( "s" ), &scale ) )
m_ScaleFactor = scale; m_ScaleFactor = scale;
wxString fname; wxString fname;
if( parser.Found( "f", &fname ) ) if( parser.Found( wxT( "f" ), &fname ) )
m_filename = fname; m_filename = fname;
if( parser.Found( "d" ) ) if( parser.Found( wxT( "d" ) ) )
m_NoOutlineSubs = true; m_NoOutlineSubs = true;
if( parser.Found( "z" ) ) if( parser.Found( wxT( "z" ) ) )
nozeroheights = true; nozeroheights = true;
if( parser.Found( "m" ) ) if( parser.Found( wxT( "m" ) ) )
showObjectMapping = true; showObjectMapping = true;
return true; return true;
@ -227,17 +227,18 @@ int IDF2VRML::OnRun()
if( m_ScaleFactor < 0.001 || m_ScaleFactor > 10.0 ) if( m_ScaleFactor < 0.001 || m_ScaleFactor > 10.0 )
{ {
wxLogMessage("scale factor out of range (%d); range is 0.001 to 10.0", m_ScaleFactor); wxLogMessage( wxT( "scale factor out of range (%d); range is 0.001 to 10.0" ),
m_ScaleFactor);
return -1; return -1;
} }
IDF3_BOARD pcb( IDF3::CAD_ELEC ); IDF3_BOARD pcb( IDF3::CAD_ELEC );
wxLogMessage( "Reading file: '%s'", m_filename ); wxLogMessage( wxT( "Reading file: '%s'" ), m_filename );
if( !pcb.ReadFile( m_filename, m_NoOutlineSubs ) ) if( !pcb.ReadFile( m_filename, m_NoOutlineSubs ) )
{ {
wxLogMessage( "Failed to read IDF data: %s", pcb.GetError() ); wxLogMessage( wxT( "Failed to read IDF data: %s" ), pcb.GetError() );
return -1; return -1;
} }
@ -257,16 +258,14 @@ int IDF2VRML::OnRun()
// Create the VRML file and write the header // Create the VRML file and write the header
wxFileName fname( m_filename ); wxFileName fname( m_filename );
fname.SetExt( "wrl" ); fname.SetExt( wxT( "wrl" ) );
fname.Normalize(); fname.Normalize();
wxLogMessage( "Writing file: '%s'", fname.GetFullName() ); wxLogMessage( wxT( "Writing file: '%s'" ), fname.GetFullName() );
OPEN_OSTREAM( ofile, fname.GetFullPath().ToUTF8() ); OPEN_OSTREAM( ofile, fname.GetFullPath().ToUTF8() );
if( ofile.fail() ) if( ofile.fail() )
{ wxLogMessage( wxT( "Could not open file: '%s'" ), fname.GetFullName() );
wxLogMessage( "Could not open file: '%s'", fname.GetFullName() );
}
ofile.imbue( std::locale( "C" ) ); ofile.imbue( std::locale( "C" ) );
ofile << std::fixed; // do not use exponents in VRML output ofile << std::fixed; // do not use exponents in VRML output
@ -326,7 +325,7 @@ bool MakeBoard( IDF3_BOARD& board, std::ostream& file )
if( board.GetBoardOutlinesSize() < 1 ) if( board.GetBoardOutlinesSize() < 1 )
{ {
wxLogMessage( "Cannot proceed; no board outline in IDF object" ); wxLogMessage( wxT( "Cannot proceed; no board outline in IDF object" ) );
return false; return false;
} }
@ -420,13 +419,13 @@ bool PopulateVRML( VRML_LAYER& model, const std::list< IDF_OUTLINE* >* items, bo
if( nvcont < 0 ) if( nvcont < 0 )
{ {
wxLogMessage( "Cannot create an outline" ); wxLogMessage( wxT( "Cannot create an outline" ) );
return false; return false;
} }
if( (*scont)->size() < 1 ) if( (*scont)->size() < 1 )
{ {
wxLogMessage( "Invalid contour: no vertices" ); wxLogMessage( wxT( "Invalid contour: no vertices" ) );
return false; return false;
} }
@ -464,7 +463,7 @@ bool AddSegment( VRML_LAYER& model, IDF_SEGMENT* seg, int icont, int iseg )
{ {
if( iseg != 0 ) if( iseg != 0 )
{ {
wxLogMessage( "Adding a circle to an existing vertex list" ); wxLogMessage( wxT( "Adding a circle to an existing vertex list" ) );
return false; return false;
} }
@ -574,16 +573,16 @@ bool WriteTriangles( std::ostream& file, VRML_IDS* vID, VRML_LAYER* layer, bool
{ {
if( !layer->WriteVertices( top_z, file, precision ) ) if( !layer->WriteVertices( top_z, file, precision ) )
{ {
wxLogMessage( "Errors writing planar vertices to %s\n%s", wxLogMessage( wxT( "Errors writing planar vertices to %s\n%s" ),
vID->objectName, layer->GetError() ); vID->objectName, layer->GetError() );
} }
} }
else else
{ {
if( !layer->Write3DVertices( top_z, bottom_z, file, precision ) ) if( !layer->Write3DVertices( top_z, bottom_z, file, precision ) )
{ {
wxLogMessage( "Errors writing 3D vertices to %s\n%s", wxLogMessage( wxT( "Errors writing 3D vertices to %s\n%s" ),
vID->objectName, layer->GetError() ); vID->objectName, layer->GetError() );
} }
} }
@ -869,7 +868,7 @@ VRML_IDS* GetColor( boost::ptr_map<const std::string, VRML_IDS>& cmap, int& inde
id->objectName = ostr.str(); id->objectName = ostr.str();
if( showObjectMapping ) if( showObjectMapping )
wxLogMessage( "* %s = '%s'", ostr.str(), uid ); wxLogMessage( wxT( "* %s = '%s'" ), ostr.str(), uid );
cmap.insert( uid, id ); cmap.insert( uid, id );

View File

@ -2918,8 +2918,10 @@ void GROUP_OUTLINE::readData( std::istream& aBoardFile, const std::string& aHead
} }
if( !GetIDFString( iline, token, quoted, idx ) || !CompareToken( ".END_PLACE_REGION", token ) ) if( !GetIDFString( iline, token, quoted, idx ) || !CompareToken( ".END_PLACE_REGION", token ) )
{
throw( IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, throw( IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"\n* invalid .PLACE_REGION section: no .END_PLACE_REGION found" ) ); "\n* invalid .PLACE_REGION section: no .END_PLACE_REGION found" ) );
}
} }

View File

@ -2804,11 +2804,11 @@ bool IDF3_BOARD::ReadFile( const wxString& aFullFileName, bool aNoSubstituteOutl
wxFileName libname( aFullFileName ); wxFileName libname( aFullFileName );
wxString ext = brdname.GetExt(); wxString ext = brdname.GetExt();
if( !ext.Cmp( "EMN" ) ) if( !ext.Cmp( wxT( "EMN" ) ) )
{ {
libname.SetExt( wxT( "EMP" ) ); libname.SetExt( wxT( "EMP" ) );
} }
else if( !ext.Cmp( "emn" ) ) else if( !ext.Cmp( wxT( "emn" ) ) )
{ {
libname.SetExt( wxT( "emp" ) ); libname.SetExt( wxT( "emp" ) );
} }

View File

@ -91,9 +91,9 @@ protected:
ReportMessage( theString.ToCString() ); ReportMessage( theString.ToCString() );
#if OCC_VERSION_HEX < OCC_VERSION_MIN #if OCC_VERSION_HEX < OCC_VERSION_MIN
if( theToPutEol ) if( theToPutEol )
ReportMessage( "\n" ); ReportMessage( wxT( "\n" ) );
#else #else
ReportMessage( "\n" ); ReportMessage( wxT( "\n" ) );
#endif #endif
} }
if( theGravity >= Message_Alarm ) if( theGravity >= Message_Alarm )
@ -284,10 +284,10 @@ wxString KICAD2MCAD_PRMS::getOutputExt() const
{ {
#ifdef SUPPORTS_IGES #ifdef SUPPORTS_IGES
if( m_fmtIGES ) if( m_fmtIGES )
return wxString( "igs" ); return wxT( "igs" );
else else
#endif #endif
return wxString( "step" ); return wxT( "step" );
} }
@ -299,7 +299,7 @@ KICAD2STEP::KICAD2STEP( KICAD2MCAD_PRMS aParams ) : m_params( aParams ), m_panel
int KICAD2STEP::Run() int KICAD2STEP::Run()
{ {
// create the main application window // create the main application window
KICAD2STEP_FRAME* frame = new KICAD2STEP_FRAME( "Kicad2step" ); KICAD2STEP_FRAME* frame = new KICAD2STEP_FRAME( wxT( "Kicad2step" ) );
m_panel = frame->m_panelKicad2Step; m_panel = frame->m_panelKicad2Step;
m_panel->m_params = m_params; m_panel->m_params = m_params;

View File

@ -33,7 +33,6 @@
#include <sstream> #include <sstream>
#include "kicad2step.h" #include "kicad2step.h"
#include "pcb/kicadpcb.h"
#include "kicad2step_frame_base.h" #include "kicad2step_frame_base.h"
#include <Standard_Failure.hxx> // In open cascade #include <Standard_Failure.hxx> // In open cascade
@ -49,8 +48,8 @@ public:
virtual bool OnCmdLineParsed( wxCmdLineParser& parser ) override; virtual bool OnCmdLineParsed( wxCmdLineParser& parser ) override;
private: private:
KICAD2STEP* m_converter; KICAD2STEP* m_converter;
KICAD2MCAD_PRMS m_params; KICAD2MCAD_PRMS m_params;
}; };
@ -96,7 +95,7 @@ static const wxCmdLineEntryDesc cmdLineDesc[] = {
void KICAD2MCAD_APP::OnInitCmdLine( wxCmdLineParser& parser ) void KICAD2MCAD_APP::OnInitCmdLine( wxCmdLineParser& parser )
{ {
parser.SetDesc( cmdLineDesc ); parser.SetDesc( cmdLineDesc );
parser.SetSwitchChars( "-" ); parser.SetSwitchChars( wxT( "-" ) );
} }
@ -124,28 +123,28 @@ int KICAD2MCAD_APP::OnRun()
bool KICAD2MCAD_APP::OnCmdLineParsed( wxCmdLineParser& parser ) bool KICAD2MCAD_APP::OnCmdLineParsed( wxCmdLineParser& parser )
{ {
#ifdef SUPPORTS_IGES #ifdef SUPPORTS_IGES
if( parser.Found( "fmt-iges" ) ) if( parser.Found( wxT( "fmt-iges" ) ) )
m_fmtIGES = true; m_fmtIGES = true;
#endif #endif
if( parser.Found( "f" ) ) if( parser.Found( wxT( "f" ) ) )
m_params.m_overwrite = true; m_params.m_overwrite = true;
if( parser.Found( "grid-origin" ) ) if( parser.Found( wxT( "grid-origin" ) ) )
m_params.m_useGridOrigin = true; m_params.m_useGridOrigin = true;
if( parser.Found( "drill-origin" ) ) if( parser.Found( wxT( "drill-origin" ) ) )
m_params.m_useDrillOrigin = true; m_params.m_useDrillOrigin = true;
if( parser.Found( "no-virtual" ) ) if( parser.Found( wxT( "no-virtual" ) ) )
m_params.m_includeVirtual = false; m_params.m_includeVirtual = false;
if( parser.Found( "subst-models" ) ) if( parser.Found( wxT( "subst-models" ) ) )
m_params.m_substModels = true; m_params.m_substModels = true;
wxString tstr; wxString tstr;
if( parser.Found( "user-origin", &tstr ) ) if( parser.Found( wxT( "user-origin" ), &tstr ) )
{ {
std::istringstream istr; std::istringstream istr;
istr.str( std::string( tstr.ToUTF8() ) ); istr.str( std::string( tstr.ToUTF8() ) );
@ -192,7 +191,7 @@ bool KICAD2MCAD_APP::OnCmdLineParsed( wxCmdLineParser& parser )
} }
} }
if( parser.Found( "min-distance", &tstr ) ) if( parser.Found( wxT( "min-distance" ), &tstr ) )
{ {
std::istringstream istr; std::istringstream istr;
istr.str( std::string( tstr.ToUTF8() ) ); istr.str( std::string( tstr.ToUTF8() ) );
@ -221,7 +220,7 @@ bool KICAD2MCAD_APP::OnCmdLineParsed( wxCmdLineParser& parser )
} }
} }
if( parser.Found( "o", &tstr ) ) if( parser.Found( wxT( "o" ), &tstr ) )
m_params.m_outputFile = tstr; m_params.m_outputFile = tstr;

View File

@ -87,10 +87,10 @@ bool S3D_RESOLVER::createPathList( void )
return false; return false;
#ifdef DEBUG #ifdef DEBUG
wxLogTrace( trace3dResolver, " * [3D model] search paths:\n" ); wxLogTrace( trace3dResolver, wxT( " * [3D model] search paths:\n" ) );
for( const SEARCH_PATH& searchPath : m_Paths ) for( const SEARCH_PATH& searchPath : m_Paths )
wxLogTrace( trace3dResolver, " + '%s'\n", searchPath.m_Pathexp ); wxLogTrace( trace3dResolver, wxT( " + '%s'\n" ), searchPath.m_Pathexp );
#endif #endif
return true; return true;
@ -120,20 +120,21 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName,
#ifdef _WIN32 #ifdef _WIN32
// translate from KiCad's internal UNIX-like path to MSWin paths // translate from KiCad's internal UNIX-like path to MSWin paths
tname.Replace( "/", "\\" ); tname.Replace( wxT( "/" ), wxT( "\\" ) );
#endif #endif
// Note: variable expansion must preferably be performed via a threadsafe wrapper for the // Note: variable expansion must preferably be performed via a threadsafe wrapper for the
// getenv() system call. If we allow the wxFileName::Normalize() routine to perform expansion // getenv() system call. If we allow the wxFileName::Normalize() routine to perform expansion
// then we will have a race condition since wxWidgets does not assure a threadsafe wrapper // then we will have a race condition since wxWidgets does not assure a threadsafe wrapper
// for getenv(). // for getenv().
if( tname.StartsWith( "${" ) || tname.StartsWith( "$(" ) ) if( tname.StartsWith( wxT( "${" ) ) || tname.StartsWith( wxT( "$(" ) ) )
tname = expandVars( tname ); tname = expandVars( tname );
wxFileName tmpFN( tname ); wxFileName tmpFN( tname );
// in the case of absolute filenames we don't store a map item // in the case of absolute filenames we don't store a map item
if( !aFileName.StartsWith( "${" ) && !aFileName.StartsWith( "$(" ) && tmpFN.IsAbsolute() ) if( !aFileName.StartsWith( wxT( "${" ) ) && !aFileName.StartsWith( wxT( "$(" ) )
&& tmpFN.IsAbsolute() )
{ {
if( tmpFN.FileExists() ) if( tmpFN.FileExists() )
{ {
@ -157,7 +158,7 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName,
// special case: if a path begins with ${ENV_VAR} but is not in the resolver's path list // special case: if a path begins with ${ENV_VAR} but is not in the resolver's path list
// then add it // then add it
if( aFileName.StartsWith( "${" ) || aFileName.StartsWith( "$(" ) ) if( aFileName.StartsWith( wxT( "${" ) ) || aFileName.StartsWith( wxT( "$(" ) ) )
checkEnvVarPath( aFileName ); checkEnvVarPath( aFileName );
return tname; return tname;
@ -169,7 +170,7 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName,
// if a path begins with ${ENV_VAR}/$(ENV_VAR) and is not resolved then the file either does // if a path begins with ${ENV_VAR}/$(ENV_VAR) and is not resolved then the file either does
// not exist or the ENV_VAR is not defined // not exist or the ENV_VAR is not defined
if( aFileName.StartsWith( "${" ) || aFileName.StartsWith( "$(" ) ) if( aFileName.StartsWith( wxT( "${" ) ) || aFileName.StartsWith( wxT( "$(" ) ) )
{ {
m_errflags |= ERRFLG_ENVPATH; m_errflags |= ERRFLG_ENVPATH;
return aFileName; return aFileName;
@ -184,12 +185,12 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName,
// been checked. This case accounts for partial paths which do not contain ${KIPRJMOD}. // been checked. This case accounts for partial paths which do not contain ${KIPRJMOD}.
// This check is performed before checking the path relative to ${KICAD6_3DMODEL_DIR} so that // This check is performed before checking the path relative to ${KICAD6_3DMODEL_DIR} so that
// users can potentially override a model within ${KICAD6_3DMODEL_DIR}. // users can potentially override a model within ${KICAD6_3DMODEL_DIR}.
if( !m_Paths.empty() && !m_Paths.begin()->m_Pathexp.empty() && !tname.StartsWith( ":" ) ) if( !m_Paths.empty() && !m_Paths.begin()->m_Pathexp.empty() && !tname.StartsWith( wxT( ":" ) ) )
{ {
tmpFN.Assign( m_Paths.begin()->m_Pathexp, "" ); tmpFN.Assign( m_Paths.begin()->m_Pathexp, wxT( "" ) );
wxString fullPath = tmpFN.GetPathWithSep() + tname; wxString fullPath = tmpFN.GetPathWithSep() + tname;
if( fullPath.StartsWith( "${" ) || fullPath.StartsWith( "$(" ) ) if( fullPath.StartsWith( wxT( "${" ) ) || fullPath.StartsWith( wxT( "$(" ) ) )
fullPath = expandVars( fullPath ); fullPath = expandVars( fullPath );
tmpFN.Assign( fullPath ); tmpFN.Assign( fullPath );
@ -208,10 +209,10 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName,
} }
// check the partial path relative to ${KICAD6_3DMODEL_DIR} (legacy behavior) // check the partial path relative to ${KICAD6_3DMODEL_DIR} (legacy behavior)
if( !tname.Contains( ":" ) ) if( !tname.Contains( wxT( ":" ) ) )
{ {
wxFileName fpath; wxFileName fpath;
wxString fullPath( "${KICAD6_3DMODEL_DIR}" ); wxString fullPath( wxT( "${KICAD6_3DMODEL_DIR}" ) );
fullPath.Append( fpath.GetPathSeparator() ); fullPath.Append( fpath.GetPathSeparator() );
fullPath.Append( tname ); fullPath.Append( tname );
fullPath = expandVars( fullPath ); fullPath = expandVars( fullPath );
@ -245,7 +246,7 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName,
for( const SEARCH_PATH& path : m_Paths ) for( const SEARCH_PATH& path : m_Paths )
{ {
// ${ENV_VAR} paths have already been checked; skip them // ${ENV_VAR} paths have already been checked; skip them
if( path.m_Alias.StartsWith( "${" ) || path.m_Alias.StartsWith( "$(" ) ) if( path.m_Alias.StartsWith( wxT( "${" ) ) || path.m_Alias.StartsWith( wxT( "$(" ) ) )
continue; continue;
if( path.m_Alias == alias && !path.m_Pathexp.empty() ) if( path.m_Alias == alias && !path.m_Pathexp.empty() )
@ -253,7 +254,7 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName,
wxFileName fpath( wxFileName::DirName( path.m_Pathexp ) ); wxFileName fpath( wxFileName::DirName( path.m_Pathexp ) );
wxString fullPath = fpath.GetPathWithSep() + relpath; wxString fullPath = fpath.GetPathWithSep() + relpath;
if( fullPath.StartsWith( "${") || fullPath.StartsWith( "$(" ) ) if( fullPath.StartsWith( wxT( "${" ) ) || fullPath.StartsWith( wxT( "$(" ) ) )
fullPath = expandVars( fullPath ); fullPath = expandVars( fullPath );
wxFileName tmp( fullPath ); wxFileName tmp( fullPath );
@ -287,32 +288,32 @@ bool S3D_RESOLVER::addPath( const SEARCH_PATH& aPath )
SEARCH_PATH tpath = aPath; SEARCH_PATH tpath = aPath;
#ifdef _WIN32 #ifdef _WIN32
while( tpath.m_Pathvar.EndsWith( "\\" ) ) while( tpath.m_Pathvar.EndsWith( wxT( "\\" ) ) )
tpath.m_Pathvar.erase( tpath.m_Pathvar.length() - 1 ); tpath.m_Pathvar.erase( tpath.m_Pathvar.length() - 1 );
#else #else
while( tpath.m_Pathvar.EndsWith( "/" ) && tpath.m_Pathvar.length() > 1 ) while( tpath.m_Pathvar.EndsWith( wxT( "/" ) ) && tpath.m_Pathvar.length() > 1 )
tpath.m_Pathvar.erase( tpath.m_Pathvar.length() - 1 ); tpath.m_Pathvar.erase( tpath.m_Pathvar.length() - 1 );
#endif #endif
wxFileName path( tpath.m_Pathvar, "" ); wxFileName path( tpath.m_Pathvar, wxT( "" ) );
path.Normalize(); path.Normalize();
if( !path.DirExists() ) if( !path.DirExists() )
{ {
// Show a message only in debug mode // Show a message only in debug mode
#ifdef DEBUG #ifdef DEBUG
if( aPath.m_Pathvar == "${KICAD6_3DMODEL_DIR}" if( aPath.m_Pathvar == wxT( "${KICAD6_3DMODEL_DIR}" )
|| aPath.m_Pathvar == "${KIPRJMOD}" || aPath.m_Pathvar == wxT( "${KIPRJMOD}" )
|| aPath.m_Pathvar == "${KISYS3DMOD}" ) || aPath.m_Pathvar == wxT( "${KISYS3DMOD}" ) )
{ {
// suppress the message if the missing pathvar is a system variable // suppress the message if the missing pathvar is a system variable
} }
else else
{ {
wxString msg = _( "The given path does not exist" ); wxString msg = _( "The given path does not exist" );
msg.append( "\n" ); msg.append( wxT( "\n" ) );
msg.append( tpath.m_Pathvar ); msg.append( tpath.m_Pathvar );
wxLogMessage( "%s\n", msg.ToUTF8() ); wxLogMessage( wxT( "%s\n" ), msg.ToUTF8() );
} }
#endif #endif
@ -323,10 +324,10 @@ bool S3D_RESOLVER::addPath( const SEARCH_PATH& aPath )
tpath.m_Pathexp = path.GetFullPath(); tpath.m_Pathexp = path.GetFullPath();
#ifdef _WIN32 #ifdef _WIN32
while( tpath.m_Pathexp.EndsWith( "\\" ) ) while( tpath.m_Pathexp.EndsWith( wxT( "\\" ) ) )
tpath.m_Pathexp.erase( tpath.m_Pathexp.length() - 1 ); tpath.m_Pathexp.erase( tpath.m_Pathexp.length() - 1 );
#else #else
while( tpath.m_Pathexp.EndsWith( "/" ) && tpath.m_Pathexp.length() > 1 ) while( tpath.m_Pathexp.EndsWith( wxT( "/" ) ) && tpath.m_Pathexp.length() > 1 )
tpath.m_Pathexp.erase( tpath.m_Pathexp.length() - 1 ); tpath.m_Pathexp.erase( tpath.m_Pathexp.length() - 1 );
#endif #endif
} }
@ -341,10 +342,10 @@ bool S3D_RESOLVER::addPath( const SEARCH_PATH& aPath )
{ {
wxString msg = _( "Alias:" ) + wxS( " " ); wxString msg = _( "Alias:" ) + wxS( " " );
msg.append( tpath.m_Alias ); msg.append( tpath.m_Alias );
msg.append( "\n" ); msg.append( wxS( "\n" ) );
msg.append( _( "This path:" ) + wxS( " " ) ); msg.append( _( "This path:" ) + wxS( " " ) );
msg.append( tpath.m_Pathvar ); msg.append( tpath.m_Pathvar );
msg.append( "\n" ); msg.append( wxS( "\n" ) );
msg.append( _( "Existing path:" ) + wxS( " " ) ); msg.append( _( "Existing path:" ) + wxS( " " ) );
msg.append( sPL->m_Pathvar ); msg.append( sPL->m_Pathvar );
wxMessageBox( msg, _( "Bad alias (duplicate name)" ) ); wxMessageBox( msg, _( "Bad alias (duplicate name)" ) );
@ -448,17 +449,17 @@ void S3D_RESOLVER::checkEnvVarPath( const wxString& aPath )
{ {
bool useParen = false; bool useParen = false;
if( aPath.StartsWith( "$(" ) ) if( aPath.StartsWith( wxT( "$(" ) ) )
useParen = true; useParen = true;
else if( !aPath.StartsWith( "${" ) ) else if( !aPath.StartsWith( wxT( "${" ) ) )
return; return;
size_t pEnd; size_t pEnd;
if( useParen ) if( useParen )
pEnd = aPath.find( ")" ); pEnd = aPath.find( wxT( ")" ) );
else else
pEnd = aPath.find( "}" ); pEnd = aPath.find( wxT( "}" ) );
if( pEnd == wxString::npos ) if( pEnd == wxString::npos )
return; return;
@ -475,7 +476,7 @@ void S3D_RESOLVER::checkEnvVarPath( const wxString& aPath )
if( sPL->m_Alias == envar ) if( sPL->m_Alias == envar )
return; return;
if( !sPL->m_Alias.StartsWith( "${" ) ) if( !sPL->m_Alias.StartsWith( wxT( "${" ) ) )
break; break;
++sPL; ++sPL;
@ -484,7 +485,7 @@ void S3D_RESOLVER::checkEnvVarPath( const wxString& aPath )
SEARCH_PATH lpath; SEARCH_PATH lpath;
lpath.m_Alias = envar; lpath.m_Alias = envar;
lpath.m_Pathvar = lpath.m_Alias; lpath.m_Pathvar = lpath.m_Alias;
wxFileName tmpFN( lpath.m_Alias, "" ); wxFileName tmpFN( lpath.m_Alias, wxT( "" ) );
wxUniChar psep = tmpFN.GetPathSeparator(); wxUniChar psep = tmpFN.GetPathSeparator();
tmpFN.Normalize(); tmpFN.Normalize();
@ -518,7 +519,7 @@ wxString S3D_RESOLVER::expandVars( const wxString& aPath )
result = i.second; result = i.second;
result.append( aPath.substr( 3 + i.first.length() ) ); result.append( aPath.substr( 3 + i.first.length() ) );
if( result.StartsWith( "${" ) || result.StartsWith( "$(" ) ) if( result.StartsWith( wxT( "${" ) ) || result.StartsWith( wxT( "$(" ) ) )
result = expandVars( result ); result = expandVars( result );
return result; return result;
@ -530,7 +531,7 @@ wxString S3D_RESOLVER::expandVars( const wxString& aPath )
if( result == aPath ) if( result == aPath )
return wxEmptyString; return wxEmptyString;
if( result.StartsWith( "${" ) || result.StartsWith( "$(" ) ) if( result.StartsWith( wxT( "${" ) ) || result.StartsWith( wxT( "$(" ) ) )
result = expandVars( result ); result = expandVars( result );
return result; return result;
@ -559,7 +560,7 @@ wxString S3D_RESOLVER::ShortenPath( const wxString& aFullPathName )
continue; continue;
} }
wxFileName fpath( sL->m_Pathexp, "" ); wxFileName fpath( sL->m_Pathexp, wxT( "" ) );
wxString fps = fpath.GetPathWithSep(); wxString fps = fpath.GetPathWithSep();
wxString tname; wxString tname;
@ -571,22 +572,22 @@ wxString S3D_RESOLVER::ShortenPath( const wxString& aFullPathName )
#ifdef _WIN32 #ifdef _WIN32
// ensure only the '/' separator is used in the internal name // ensure only the '/' separator is used in the internal name
fname.Replace( "\\", "/" ); fname.Replace( wxT( "\\" ), wxT( "/" ) );
#endif #endif
if( sL->m_Alias.StartsWith( "${" ) || sL->m_Alias.StartsWith( "$(" ) ) if( sL->m_Alias.StartsWith( wxT( "${" ) ) || sL->m_Alias.StartsWith( wxT( "$(" ) ) )
{ {
// old style ENV_VAR // old style ENV_VAR
tname = sL->m_Alias; tname = sL->m_Alias;
tname.Append( "/" ); tname.Append( wxT( "/" ) );
tname.append( fname ); tname.append( fname );
} }
else else
{ {
// new style alias // new style alias
tname = ":"; tname = wxT( ":" );
tname.append( sL->m_Alias ); tname.append( sL->m_Alias );
tname.append( ":" ); tname.append( wxT( ":" ) );
tname.append( fname ); tname.append( fname );
} }
@ -601,7 +602,7 @@ wxString S3D_RESOLVER::ShortenPath( const wxString& aFullPathName )
// UNIX separator but this is done for consistency and can // UNIX separator but this is done for consistency and can
// be helpful even when transferring project files from // be helpful even when transferring project files from
// MSWin to *NIX. // MSWin to *NIX.
fname.Replace( "\\", "/" ); fname.Replace( wxT( "\\" ), wxT( "/" ) );
#endif #endif
return fname; return fname;
@ -736,12 +737,12 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
// ensure that the file separators suit the current platform // ensure that the file separators suit the current platform
#ifdef __WINDOWS__ #ifdef __WINDOWS__
filename.Replace( "/", "\\" ); filename.Replace( wxT( "/" ), wxT( "\\" ) );
// if we see the :\ pattern then it must be a drive designator // if we see the :\ pattern then it must be a drive designator
if( aliasEnd != wxString::npos ) if( aliasEnd != wxString::npos )
{ {
size_t pos1 = aFileName.find( ":\\" ); size_t pos1 = aFileName.find( wxT( ":\\" ) );
if( pos1 != wxString::npos && ( pos1 != aliasEnd || pos1 != 1 ) ) if( pos1 != wxString::npos && ( pos1 != aliasEnd || pos1 != 1 ) )
return false; return false;
@ -751,7 +752,7 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
aliasEnd = wxString::npos; aliasEnd = wxString::npos;
} }
#else #else
filename.Replace( "\\", "/" ); filename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif #endif
// names may not end with ':' // names may not end with ':'
@ -781,9 +782,9 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
// environment string before testing // environment string before testing
aliasEnd = wxString::npos; aliasEnd = wxString::npos;
if( aFileName.StartsWith( "${" ) ) if( aFileName.StartsWith( wxT( "${" ) ) )
aliasEnd = aFileName.find( '}' ); aliasEnd = aFileName.find( '}' );
else if( aFileName.StartsWith( "$(" ) ) else if( aFileName.StartsWith( wxT( "$(" ) ) )
aliasEnd = aFileName.find( ')' ); aliasEnd = aFileName.find( ')' );
if( aliasEnd != wxString::npos ) if( aliasEnd != wxString::npos )

View File

@ -55,7 +55,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_position << " (line " << data->GetLineNumber() << ")"; ostr << bad_position << " (line " << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -64,7 +64,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou
std::ostringstream ostr; std::ostringstream ostr;
ostr << "* SEXPR item is not a position string (line "; ostr << "* SEXPR item is not a position string (line ";
ostr << data->GetLineNumber() << ")"; ostr << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -83,7 +83,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_position << " (line " << child->GetLineNumber() << ")"; ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -102,7 +102,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_position << " (line " << child->GetLineNumber() << ")"; ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -127,7 +127,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_position << " (line " << child->GetLineNumber() << ")"; ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -152,7 +152,7 @@ bool Get2DCoordinate( const SEXPR::SEXPR* data, DOUBLET& aCoordinate )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_position << " (line " << data->GetLineNumber() << ")"; ostr << bad_position << " (line " << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -171,7 +171,7 @@ bool Get2DCoordinate( const SEXPR::SEXPR* data, DOUBLET& aCoordinate )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_position << " (line " << child->GetLineNumber() << ")"; ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -190,7 +190,7 @@ bool Get2DCoordinate( const SEXPR::SEXPR* data, DOUBLET& aCoordinate )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_position << " (line " << child->GetLineNumber() << ")"; ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -210,7 +210,7 @@ bool Get3DCoordinate( const SEXPR::SEXPR* data, TRIPLET& aCoordinate )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_position << " (line " << data->GetLineNumber() << ")"; ostr << bad_position << " (line " << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -229,7 +229,7 @@ bool Get3DCoordinate( const SEXPR::SEXPR* data, TRIPLET& aCoordinate )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_position << " (line " << child->GetLineNumber() << ")"; ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
} }
@ -250,7 +250,7 @@ bool GetXYZRotation( const SEXPR::SEXPR* data, TRIPLET& aRotation )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_rotation << " (line " << data->GetLineNumber() << ")"; ostr << bad_rotation << " (line " << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }

View File

@ -60,7 +60,7 @@ bool KICADCURVE::Read( SEXPR::SEXPR* aEntry, CURVE_TYPE aCurveType )
&& CURVE_CIRCLE != aCurveType && CURVE_BEZIER != aCurveType && CURVE_CIRCLE != aCurveType && CURVE_BEZIER != aCurveType
&& CURVE_POLYGON != aCurveType ) && CURVE_POLYGON != aCurveType )
{ {
wxLogMessage( "* Unsupported curve type: %d\n", aCurveType ); wxLogMessage( wxT( "* Unsupported curve type: %d\n" ), aCurveType );
return false; return false;
} }
@ -74,7 +74,7 @@ bool KICADCURVE::Read( SEXPR::SEXPR* aEntry, CURVE_TYPE aCurveType )
|| ( CURVE_BEZIER == aCurveType && nchild < 5 ) || ( CURVE_BEZIER == aCurveType && nchild < 5 )
|| ( CURVE_POLYGON == aCurveType && nchild < 5 ) ) || ( CURVE_POLYGON == aCurveType && nchild < 5 ) )
{ {
wxLogMessage( "* bad curve data; not enough parameters\n" ); wxLogMessage( wxT( "* bad curve data; not enough parameters\n" ) );
return false; return false;
} }
@ -154,10 +154,9 @@ bool KICADCURVE::Read( SEXPR::SEXPR* aEntry, CURVE_TYPE aCurveType )
else if( text == "angle" ) else if( text == "angle" )
{ {
if( child->GetNumberOfChildren() < 2 if( child->GetNumberOfChildren() < 2
|| ( !child->GetChild( 1 )->IsDouble() || ( !child->GetChild( 1 )->IsDouble() && !child->GetChild( 1 )->IsInteger() ) )
&& !child->GetChild( 1 )->IsInteger() ) )
{ {
wxLogMessage( "* bad angle data\n" ); wxLogMessage( wxT( "* bad angle data\n" ) );
return false; return false;
} }
@ -176,7 +175,7 @@ bool KICADCURVE::Read( SEXPR::SEXPR* aEntry, CURVE_TYPE aCurveType )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << "* bad layer data: " << child->AsString(); ostr << "* bad layer data: " << child->AsString();
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }

View File

@ -86,7 +86,7 @@ bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << "* BUG: module parser invoked for type '" << name << "'\n"; ostr << "* BUG: module parser invoked for type '" << name << "'\n";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -109,14 +109,16 @@ bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry )
if( symname == "locked" || symname == "placed" ) if( symname == "locked" || symname == "placed" )
continue; continue;
wxLogMessage( "* module descr in PCB file at line %d: unexpected keyword '%s'\n", wxLogMessage( wxT( "* module descr in PCB file at line %d: unexpected keyword "
child->GetLineNumber(), symname.c_str() ); "'%s'\n" ),
child->GetLineNumber(),
symname.c_str() );
return false; return false;
} }
if( !child->IsList() ) if( !child->IsList() )
{ {
wxLogMessage( "* corrupt module in PCB file at line %d\n", wxLogMessage( wxT( "* corrupt module in PCB file at line %d\n" ),
child->GetLineNumber() ); child->GetLineNumber() );
return false; return false;
} }
@ -155,7 +157,7 @@ bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry )
std::ostringstream ostr; std::ostringstream ostr;
ostr << "* data is not a valid PCB module\n"; ostr << "* data is not a valid PCB module\n";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -248,7 +250,7 @@ bool KICADFOOTPRINT::parseLayer( SEXPR::SEXPR* data )
std::ostringstream ostr; std::ostringstream ostr;
ostr << "* corrupt module in PCB file (line "; ostr << "* corrupt module in PCB file (line ";
ostr << val->GetLineNumber() << "); layer cannot be parsed\n"; ostr << val->GetLineNumber() << "); layer cannot be parsed\n";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -276,7 +278,7 @@ bool KICADFOOTPRINT::parseAttribute( SEXPR::SEXPR* data )
std::ostringstream ostr; std::ostringstream ostr;
ostr << "* corrupt module in PCB file (line "; ostr << "* corrupt module in PCB file (line ";
ostr << data->GetLineNumber() << "); attribute cannot be parsed\n"; ostr << data->GetLineNumber() << "); attribute cannot be parsed\n";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -443,10 +445,10 @@ bool KICADFOOTPRINT::ComposePCB( class PCBMODEL* aPCB, S3D_RESOLVER* resolver,
for( const wxString& path : searchedPaths ) for( const wxString& path : searchedPaths )
paths += " " + path + "\n"; paths += " " + path + "\n";
ReportMessage( wxString::Format( "Could not add 3D model to %s.\n" ReportMessage( wxString::Format( wxT( "Could not add 3D model to %s.\n"
"File not found: %s\n" "File not found: %s\n"
"Searched paths:\n" "Searched paths:\n"
"%s", "%s" ),
m_refdes, m_refdes,
mname, mname,
paths) ); paths) );
@ -466,8 +468,8 @@ bool KICADFOOTPRINT::ComposePCB( class PCBMODEL* aPCB, S3D_RESOLVER* resolver,
} }
catch( const Standard_Failure& e) catch( const Standard_Failure& e)
{ {
ReportMessage( wxString::Format( "Could not add 3D model to %s.\n" ReportMessage( wxString::Format( wxT( "Could not add 3D model to %s.\n"
"OpenCASCADE error: %s\n", "OpenCASCADE error: %s\n" ),
m_refdes, m_refdes,
e.GetMessageString() ) ); e.GetMessageString() ) );
} }

View File

@ -54,7 +54,7 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << "* invalid model entry"; ostr << "* invalid model entry";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -72,7 +72,7 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << "* invalid model entry; invalid path"; ostr << "* invalid model entry; invalid path";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }

View File

@ -59,7 +59,7 @@ bool KICADPAD::Read( const SEXPR::SEXPR* aEntry )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_pad << " (line " << aEntry->GetLineNumber() << ")"; ostr << bad_pad << " (line " << aEntry->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -111,7 +111,7 @@ bool KICADPAD::parseDrill( const SEXPR::SEXPR* aDrill )
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_drill << " (line " << aDrill->GetLineNumber() << ")"; ostr << bad_drill << " (line " << aDrill->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -132,7 +132,7 @@ bool KICADPAD::parseDrill( const SEXPR::SEXPR* aDrill )
ostr << bad_drill << " (line " << child->GetLineNumber(); ostr << bad_drill << " (line " << child->GetLineNumber();
ostr << ") (unexpected symbol: "; ostr << ") (unexpected symbol: ";
ostr << child->GetSymbol() << "), nchild = " << nchild; ostr << child->GetSymbol() << "), nchild = " << nchild;
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
} }
@ -148,7 +148,7 @@ bool KICADPAD::parseDrill( const SEXPR::SEXPR* aDrill )
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_drill << " (line " << child->GetLineNumber(); ostr << bad_drill << " (line " << child->GetLineNumber();
ostr << ") (did not find X size)"; ostr << ") (did not find X size)";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }
@ -177,7 +177,7 @@ bool KICADPAD::parseDrill( const SEXPR::SEXPR* aDrill )
std::ostringstream ostr; std::ostringstream ostr;
ostr << bad_drill << " (line " << child->GetLineNumber(); ostr << bad_drill << " (line " << child->GetLineNumber();
ostr << ") (did not find Y size)"; ostr << ") (did not find Y size)";
wxLogMessage( "%s\n", ostr.str().c_str() ); wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() );
return false; return false;
} }

View File

@ -42,7 +42,7 @@
KICADPCB::KICADPCB( const wxString& aPcbName ) KICADPCB::KICADPCB( const wxString& aPcbName )
{ {
m_resolver.Set3DConfigDir( "" ); m_resolver.Set3DConfigDir( wxT( "" ) );
m_thickness = 1.6; m_thickness = 1.6;
m_pcb_model = nullptr; m_pcb_model = nullptr;
m_minDistance = MIN_DISTANCE; m_minDistance = MIN_DISTANCE;
@ -74,14 +74,14 @@ bool KICADPCB::ReadFile( const wxString& aFileName )
if( fname.GetExt() != "kicad_pcb" ) if( fname.GetExt() != "kicad_pcb" )
{ {
ReportMessage( wxString::Format( "expecting extension kicad_pcb, got %s\n", ReportMessage( wxString::Format( wxT( "expecting extension kicad_pcb, got %s\n" ),
fname.GetExt() ) ); fname.GetExt() ) );
return false; return false;
} }
if( !fname.FileExists() ) if( !fname.FileExists() )
{ {
ReportMessage( wxString::Format( "No such file: %s\n", aFileName ) ); ReportMessage( wxString::Format( wxT( "No such file: %s\n" ), aFileName ) );
return false; return false;
} }
@ -96,7 +96,7 @@ bool KICADPCB::ReadFile( const wxString& aFileName )
if( !data ) if( !data )
{ {
ReportMessage( wxString::Format( "No data in file: %s\n", aFileName ) ); ReportMessage( wxString::Format( wxT( "No data in file: %s\n" ), aFileName ) );
return false; return false;
} }
@ -105,12 +105,14 @@ bool KICADPCB::ReadFile( const wxString& aFileName )
} }
catch( std::exception& e ) catch( std::exception& e )
{ {
ReportMessage( wxString::Format( "error reading file: %s\n%s\n", aFileName, e.what() ) ); ReportMessage( wxString::Format( wxT( "error reading file: %s\n%s\n" ),
aFileName,
e.what() ) );
return false; return false;
} }
catch( ... ) catch( ... )
{ {
ReportMessage( wxString::Format( "unexpected exception while reading file: %s\n", ReportMessage( wxString::Format( wxT( "unexpected exception while reading file: %s\n" ),
aFileName ) ); aFileName ) );
return false; return false;
} }
@ -162,7 +164,7 @@ bool KICADPCB::parsePCB( SEXPR::SEXPR* data )
if( !child->IsList() ) if( !child->IsList() )
{ {
ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n", ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n" ),
child->GetLineNumber() ) ); child->GetLineNumber() ) );
return false; return false;
} }
@ -196,7 +198,7 @@ bool KICADPCB::parsePCB( SEXPR::SEXPR* data )
return result; return result;
} }
ReportMessage( wxString::Format( "data is not a valid PCB file: %s\n", m_filename ) ); ReportMessage( wxString::Format( wxT( "data is not a valid PCB file: %s\n" ), m_filename ) );
return false; return false;
} }
@ -212,7 +214,7 @@ bool KICADPCB::parseGeneral( SEXPR::SEXPR* data )
if( !child->IsList() ) if( !child->IsList() )
{ {
ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n", ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n" ),
child->GetLineNumber() ) ); child->GetLineNumber() ) );
return false; return false;
} }
@ -225,8 +227,8 @@ bool KICADPCB::parseGeneral( SEXPR::SEXPR* data )
return true; return true;
} }
ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n" ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n"
"no PCB thickness specified in general section\n", "no PCB thickness specified in general section\n" ),
child->GetLineNumber() ) ); child->GetLineNumber() ) );
return false; return false;
} }
@ -244,7 +246,7 @@ bool KICADPCB::parseLayers( SEXPR::SEXPR* data )
if( !child->IsList() ) if( !child->IsList() )
{ {
ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n", ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n" ),
child->GetLineNumber() ) ); child->GetLineNumber() ) );
return false; return false;
} }
@ -285,7 +287,7 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data )
if( !child->IsList() ) if( !child->IsList() )
{ {
ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n", ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n" ),
child->GetLineNumber() ) ); child->GetLineNumber() ) );
return false; return false;
} }
@ -295,8 +297,8 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data )
{ {
if( child->GetNumberOfChildren() != 3 ) if( child->GetNumberOfChildren() != 3 )
{ {
ReportMessage( wxString::Format( "corrupt PCB file (line %d): grid_origin has " ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d): grid_origin has "
"%d children (expected: 3)\n", "%d children (expected: 3)\n" ),
child->GetLineNumber(), child->GetLineNumber(),
child->GetNumberOfChildren() ) ); child->GetNumberOfChildren() ) );
return false; return false;
@ -310,8 +312,8 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data )
{ {
if( child->GetNumberOfChildren() != 3 ) if( child->GetNumberOfChildren() != 3 )
{ {
ReportMessage( wxString::Format( "corrupt PCB file (line %d): aux_axis_origin has" ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d): aux_axis_origin "
" %d children (expected: 3)\n", "has %d children (expected: 3)\n" ),
child->GetLineNumber(), child->GetLineNumber(),
child->GetNumberOfChildren() ) ); child->GetNumberOfChildren() ) );
return false; return false;
@ -449,7 +451,7 @@ bool KICADPCB::ComposePCB( bool aComposeVirtual, bool aSubstituteModels )
if( m_footprints.empty() && m_curves.empty() ) if( m_footprints.empty() && m_curves.empty() )
{ {
ReportMessage( "Error: no PCB data (no footprint, no outline) to render\n" ); ReportMessage( wxT( "Error: no PCB data (no footprint, no outline) to render\n" ) );
return false; return false;
} }
@ -502,11 +504,11 @@ bool KICADPCB::ComposePCB( bool aComposeVirtual, bool aSubstituteModels )
for( auto i : m_footprints ) for( auto i : m_footprints )
i->ComposePCB( m_pcb_model, &m_resolver, origin, aComposeVirtual, aSubstituteModels ); i->ComposePCB( m_pcb_model, &m_resolver, origin, aComposeVirtual, aSubstituteModels );
ReportMessage( "Create PCB solid model\n" ); ReportMessage( wxT( "Create PCB solid model\n" ) );
if( !m_pcb_model->CreatePCB() ) if( !m_pcb_model->CreatePCB() )
{ {
ReportMessage( "could not create PCB solid model\n" ); ReportMessage( wxT( "could not create PCB solid model\n" ) );
delete m_pcb_model; delete m_pcb_model;
m_pcb_model = NULL; m_pcb_model = NULL;
return false; return false;

View File

@ -185,7 +185,7 @@ FormatType fileType( const char* aFileName )
if( !lfile.FileExists() ) if( !lfile.FileExists() )
{ {
wxString msg; wxString msg;
msg.Printf( " * fileType(): no such file: %s\n", msg.Printf( wxT( " * fileType(): no such file: %s\n" ),
wxString::FromUTF8Unchecked( aFileName ) ); wxString::FromUTF8Unchecked( aFileName ) );
ReportMessage( msg ); ReportMessage( msg );
@ -194,19 +194,19 @@ FormatType fileType( const char* aFileName )
wxString ext = lfile.GetExt().Lower(); wxString ext = lfile.GetExt().Lower();
if( ext == "wrl" ) if( ext == wxT( "wrl" ) )
return FMT_WRL; return FMT_WRL;
if( ext == "wrz" ) if( ext == wxT( "wrz" ) )
return FMT_WRZ; return FMT_WRZ;
if( ext == "idf" ) if( ext == wxT( "idf" ) )
return FMT_IDF; // component outline return FMT_IDF; // component outline
if( ext == "emn" ) if( ext == wxT( "emn" ) )
return FMT_EMN; // PCB assembly return FMT_EMN; // PCB assembly
if( ext == "stpz" || ext == "gz" ) if( ext == wxT( "stpz" ) || ext == wxT( "gz" ) )
return FMT_STEPZ; return FMT_STEPZ;
OPEN_ISTREAM( ifile, aFileName ); OPEN_ISTREAM( ifile, aFileName );
@ -282,7 +282,8 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve )
if( distance < m_minDistance2 ) if( distance < m_minDistance2 )
{ {
wxString msg; wxString msg;
msg.Printf( " * AddOutlineSegment() rejected a zero-length %s\n", aCurve->Describe() ); msg.Printf( wxT( " * AddOutlineSegment() rejected a zero-length %s\n" ),
aCurve->Describe() );
ReportMessage( msg ); ReportMessage( msg );
return false; return false;
} }
@ -297,7 +298,8 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve )
if( rad < m_minDistance2 ) if( rad < m_minDistance2 )
{ {
wxString msg; wxString msg;
msg.Printf( " * AddOutlineSegment() rejected a zero-radius %s\n", aCurve->Describe() ); msg.Printf( wxT( " * AddOutlineSegment() rejected a zero-radius %s\n" ),
aCurve->Describe() );
ReportMessage( msg ); ReportMessage( msg );
return false; return false;
} }
@ -333,8 +335,8 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve )
if( rad < m_minDistance2 ) if( rad < m_minDistance2 )
{ {
ReportMessage( wxString::Format( " * AddOutlineSegment() rejected an arc with " ReportMessage( wxString::Format( wxT( " * AddOutlineSegment() rejected an arc "
"equivalent end points, %s\n", "with equivalent end points, %s\n" ),
aCurve->Describe() ) ); aCurve->Describe() ) );
return false; return false;
} }
@ -451,7 +453,8 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve )
do do
{ {
wxString msg; wxString msg;
msg.Printf( " * AddOutlineSegment() unsupported curve type: %d\n", aCurve->m_form ); msg.Printf( wxT( " * AddOutlineSegment() unsupported curve type: %d\n" ),
aCurve->m_form );
ReportMessage( msg ); ReportMessage( msg );
} while( 0 ); } while( 0 );
@ -610,12 +613,12 @@ bool PCBMODEL::AddComponent( const std::string& aFileNameUTF8, const std::string
{ {
if( aFileNameUTF8.empty() ) if( aFileNameUTF8.empty() )
{ {
ReportMessage( wxString::Format( "No model defined for component %s.\n", aRefDes ) ); ReportMessage( wxString::Format( wxT( "No model defined for component %s.\n" ), aRefDes ) );
return false; return false;
} }
wxString fileName( wxString::FromUTF8( aFileNameUTF8.c_str() ) ); wxString fileName( wxString::FromUTF8( aFileNameUTF8.c_str() ) );
ReportMessage( wxString::Format( "Add component %s.\n", aRefDes ) ); ReportMessage( wxString::Format( wxT( "Add component %s.\n" ), aRefDes ) );
// first retrieve a label // first retrieve a label
TDF_Label lmodel; TDF_Label lmodel;
@ -624,7 +627,7 @@ bool PCBMODEL::AddComponent( const std::string& aFileNameUTF8, const std::string
if( !getModelLabel( aFileNameUTF8, aScale, lmodel, aSubstituteModels, &errorMessage ) ) if( !getModelLabel( aFileNameUTF8, aScale, lmodel, aSubstituteModels, &errorMessage ) )
{ {
if( errorMessage.IsEmpty() ) if( errorMessage.IsEmpty() )
ReportMessage( wxString::Format( "No model for filename '%s'.\n", fileName ) ); ReportMessage( wxString::Format( wxT( "No model for filename '%s'.\n" ), fileName ) );
else else
ReportMessage( errorMessage ); ReportMessage( errorMessage );
@ -636,7 +639,8 @@ bool PCBMODEL::AddComponent( const std::string& aFileNameUTF8, const std::string
if( !getModelLocation( aBottom, aPosition, aRotation, aOffset, aOrientation, toploc ) ) if( !getModelLocation( aBottom, aPosition, aRotation, aOffset, aOrientation, toploc ) )
{ {
ReportMessage( wxString::Format( "No location data for filename '%s'.\n", fileName ) ); ReportMessage( wxString::Format( wxT( "No location data for filename '%s'.\n" ),
fileName ) );
return false; return false;
} }
@ -645,7 +649,7 @@ bool PCBMODEL::AddComponent( const std::string& aFileNameUTF8, const std::string
if( llabel.IsNull() ) if( llabel.IsNull() )
{ {
ReportMessage( wxString::Format( "Could not add component with filename '%s'.\n", ReportMessage( wxString::Format( wxT( "Could not add component with filename '%s'.\n" ),
fileName ) ); fileName ) );
return false; return false;
} }
@ -690,7 +694,7 @@ bool PCBMODEL::CreatePCB()
if( m_curves.empty() || m_mincurve == m_curves.end() ) if( m_curves.empty() || m_mincurve == m_curves.end() )
{ {
m_hasPCB = true; m_hasPCB = true;
ReportMessage( "No valid board outline.\n" ); ReportMessage( wxT( "No valid board outline.\n" ) );
return false; return false;
} }
@ -701,7 +705,7 @@ bool PCBMODEL::CreatePCB()
oln.AddSegment( *m_mincurve ); oln.AddSegment( *m_mincurve );
m_curves.erase( m_mincurve ); m_curves.erase( m_mincurve );
ReportMessage( wxString::Format( "Build board outline (%d items).\n", ReportMessage( wxString::Format( wxT( "Build board outline (%d items).\n" ),
(int)m_curves.size() ) ); (int)m_curves.size() ) );
while( !m_curves.empty() ) while( !m_curves.empty() )
@ -712,7 +716,7 @@ bool PCBMODEL::CreatePCB()
{ {
if( !oln.MakeShape( board, m_thickness ) ) if( !oln.MakeShape( board, m_thickness ) )
{ {
ReportMessage( "Could not create board extrusion.\n" ); ReportMessage( wxT( "Could not create board extrusion.\n" ) );
return false; return false;
} }
} }
@ -726,7 +730,7 @@ bool PCBMODEL::CreatePCB()
} }
else else
{ {
ReportMessage( "Could not create board cutout.\n" ); ReportMessage( wxT( "Could not create board cutout.\n" ) );
} }
} }
@ -759,7 +763,7 @@ bool PCBMODEL::CreatePCB()
if( !added && !oln.m_curves.empty() ) if( !added && !oln.m_curves.empty() )
{ {
wxString msg; wxString msg;
msg.Printf( "Could not close outline (dropping outline data with %d segments).\n", msg.Printf( wxT( "Could not close outline (dropping outline data with %d segments).\n" ),
static_cast<int>( oln.m_curves.size() ) ); static_cast<int>( oln.m_curves.size() ) );
for( const auto& c : oln.m_curves ) for( const auto& c : oln.m_curves )
@ -782,7 +786,7 @@ bool PCBMODEL::CreatePCB()
{ {
if( !oln.MakeShape( board, m_thickness ) ) if( !oln.MakeShape( board, m_thickness ) )
{ {
ReportMessage( "Could not create board extrusion.\n" ); ReportMessage( wxT( "Could not create board extrusion.\n" ) );
return false; return false;
} }
} }
@ -796,21 +800,21 @@ bool PCBMODEL::CreatePCB()
} }
else else
{ {
ReportMessage( "Could not create board cutout.\n" ); ReportMessage( wxT( "Could not create board cutout.\n" ) );
} }
} }
} }
else else
{ {
ReportMessage( "Could not create closed board outlines.\n" ); ReportMessage( wxT( "Could not create closed board outlines.\n" ) );
return false; return false;
} }
// subtract cutouts (if any) // subtract cutouts (if any)
if( m_cutouts.size() ) if( m_cutouts.size() )
{ {
ReportMessage( wxString::Format( "Build board cutouts and holes (%d holes).\n", ReportMessage( wxString::Format( wxT( "Build board cutouts and holes (%d holes).\n" ),
(int)m_cutouts.size() ) ); (int) m_cutouts.size() ) );
} }
#if 0 #if 0
@ -829,11 +833,11 @@ bool PCBMODEL::CreatePCB()
char_count++; char_count++;
if( char_count < 80 ) if( char_count < 80 )
ReportMessage( "." ); ReportMessage( wxT( "." ) );
else else
{ {
char_count = 0; char_count = 0;
ReportMessage( wxString::Format( ". %d/%d\n", cur_count, cntmax ) ); ReportMessage( wxString::Format( wxT( ". %d/%d\n" ), cur_count, cntmax ) );
} }
} }
#else // Much faster than first version: group all holes and cut only once #else // Much faster than first version: group all holes and cut only once
@ -856,7 +860,7 @@ bool PCBMODEL::CreatePCB()
#endif #endif
// push the board to the data structure // push the board to the data structure
ReportMessage( "\nGenerate board full shape.\n" ); ReportMessage( wxT( "\nGenerate board full shape.\n" ) );
// Dont expand the component or else coloring it gets hard // Dont expand the component or else coloring it gets hard
m_pcb_label = m_assy->AddComponent( m_assy_label, board, false ); m_pcb_label = m_assy->AddComponent( m_assy_label, board, false );
@ -876,7 +880,7 @@ bool PCBMODEL::CreatePCB()
TDF_Label label = node->Father()->Label(); TDF_Label label = node->Father()->Label();
if( !label.IsNull() ) if( !label.IsNull() )
{ {
wxString pcbName = wxString::Format( "%s PCB", m_pcbName ); wxString pcbName = wxString::Format( wxT( "%s PCB" ), m_pcbName );
std::string pcbNameStdString( pcbName.ToUTF8() ); std::string pcbNameStdString( pcbName.ToUTF8() );
TCollection_ExtendedString partname( pcbNameStdString.c_str() ); TCollection_ExtendedString partname( pcbNameStdString.c_str() );
TDataStd_Name::Set( label, partname ); TDataStd_Name::Set( label, partname );
@ -911,7 +915,8 @@ bool PCBMODEL::WriteIGES( const wxString& aFileName )
{ {
if( m_pcb_label.IsNull() ) if( m_pcb_label.IsNull() )
{ {
ReportMessage( wxString::Format( "No valid PCB assembly; cannot create output file '%s'.\n", ReportMessage( wxString::Format( wxT( "No valid PCB assembly; cannot create output file "
"'%s'.\n" ),
aFileName ) ); aFileName ) );
return false; return false;
} }
@ -940,7 +945,8 @@ bool PCBMODEL::WriteSTEP( const wxString& aFileName )
{ {
if( m_pcb_label.IsNull() ) if( m_pcb_label.IsNull() )
{ {
ReportMessage( wxString::Format( "No valid PCB assembly; cannot create output file '%s'.\n", ReportMessage( wxString::Format( wxT( "No valid PCB assembly; cannot create output file "
"'%s'.\n" ),
aFileName ) ); aFileName ) );
return false; return false;
} }
@ -956,7 +962,7 @@ bool PCBMODEL::WriteSTEP( const wxString& aFileName )
// target is still better than "open cascade step translter v..." // target is still better than "open cascade step translter v..."
// UTF8 should be ok from ISO 10303-21:2016, but... older stuff? use boring ascii // UTF8 should be ok from ISO 10303-21:2016, but... older stuff? use boring ascii
if( !Interface_Static::SetCVal( "write.step.product.name", fn.GetName().ToAscii() ) ) if( !Interface_Static::SetCVal( "write.step.product.name", fn.GetName().ToAscii() ) )
ReportMessage( "Failed to set step product name, but will attempt to continue." ); ReportMessage( wxT( "Failed to set step product name, but will attempt to continue." ) );
if( Standard_False == writer.Transfer( m_doc, STEPControl_AsIs ) ) if( Standard_False == writer.Transfer( m_doc, STEPControl_AsIs ) )
return false; return false;
@ -991,7 +997,7 @@ bool PCBMODEL::WriteSTEP( const wxString& aFileName )
{ {
if( !wxRenameFile( tmpfname, fn.GetFullName(), true ) ) if( !wxRenameFile( tmpfname, fn.GetFullName(), true ) )
{ {
ReportMessage( wxString::Format( "Cannot rename temporary file '%s' to '%s'.\n", ReportMessage( wxString::Format( wxT( "Cannot rename temporary file '%s' to '%s'.\n" ),
tmpfname, tmpfname,
fn.GetFullName() ) ); fn.GetFullName() ) );
success = false; success = false;
@ -1031,7 +1037,8 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale,
case FMT_IGES: case FMT_IGES:
if( !readIGES( doc, aFileNameUTF8.c_str() ) ) if( !readIGES( doc, aFileNameUTF8.c_str() ) )
{ {
ReportMessage( wxString::Format( "readIGES() failed on filename '%s'.\n", fileName ) ); ReportMessage( wxString::Format( wxT( "readIGES() failed on filename '%s'.\n" ),
fileName ) );
return false; return false;
} }
break; break;
@ -1039,7 +1046,8 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale,
case FMT_STEP: case FMT_STEP:
if( !readSTEP( doc, aFileNameUTF8.c_str() ) ) if( !readSTEP( doc, aFileNameUTF8.c_str() ) )
{ {
ReportMessage( wxString::Format( "readSTEP() failed on filename '%s'.\n", fileName ) ); ReportMessage( wxString::Format( wxT( "readSTEP() failed on filename '%s'.\n" ),
fileName ) );
return false; return false;
} }
break; break;
@ -1052,12 +1060,12 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale,
wxFileName outFile( fileName ); wxFileName outFile( fileName );
outFile.SetPath( wxStandardPaths::Get().GetTempDir() ); outFile.SetPath( wxStandardPaths::Get().GetTempDir() );
outFile.SetExt( "step" ); outFile.SetExt( wxT( "step" ) );
wxFileOffset size = ifile.GetLength(); wxFileOffset size = ifile.GetLength();
if( size == wxInvalidOffset ) if( size == wxInvalidOffset )
{ {
ReportMessage( wxString::Format( "getModelLabel() failed on filename '%s'.\n", ReportMessage( wxString::Format( wxT( "getModelLabel() failed on filename '%s'.\n" ),
fileName ) ); fileName ) );
return false; return false;
} }
@ -1081,7 +1089,8 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale,
} }
catch( ... ) catch( ... )
{ {
ReportMessage( wxString::Format( "failed to decompress '%s'.\n", fileName ) ); ReportMessage( wxString::Format( wxT( "failed to decompress '%s'.\n" ),
fileName ) );
} }
if( expanded.empty() ) if( expanded.empty() )
@ -1140,29 +1149,29 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale,
wxArrayString alts; wxArrayString alts;
// Step files // Step files
alts.Add( "stp" ); alts.Add( wxT( "stp" ) );
alts.Add( "step" ); alts.Add( wxT( "step" ) );
alts.Add( "STP" ); alts.Add( wxT( "STP" ) );
alts.Add( "STEP" ); alts.Add( wxT( "STEP" ) );
alts.Add( "Stp" ); alts.Add( wxT( "Stp" ) );
alts.Add( "Step" ); alts.Add( wxT( "Step" ) );
alts.Add( "stpz" ); alts.Add( wxT( "stpz" ) );
alts.Add( "stpZ" ); alts.Add( wxT( "stpZ" ) );
alts.Add( "STPZ" ); alts.Add( wxT( "STPZ" ) );
alts.Add( "step.gz" ); alts.Add( wxT( "step.gz" ) );
alts.Add( "stp.gz" ); alts.Add( wxT( "stp.gz" ) );
// IGES files // IGES files
alts.Add( "iges" ); alts.Add( wxT( "iges" ) );
alts.Add( "IGES" ); alts.Add( wxT( "IGES" ) );
alts.Add( "igs" ); alts.Add( wxT( "igs" ) );
alts.Add( "IGS" ); alts.Add( wxT( "IGS" ) );
//TODO - Other alternative formats? //TODO - Other alternative formats?
for( const auto& alt : alts ) for( const auto& alt : alts )
{ {
wxFileName altFile( basePath, baseName + "." + alt ); wxFileName altFile( basePath, baseName + wxT( "." ) + alt );
if( altFile.IsOk() && altFile.FileExists() ) if( altFile.IsOk() && altFile.FileExists() )
{ {
@ -1187,7 +1196,7 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale,
else // Substitution is not allowed else // Substitution is not allowed
{ {
if( aErrorMessage ) if( aErrorMessage )
aErrorMessage->Printf( "Cannot add a VRML model to a STEP file.\n" ); aErrorMessage->Printf( wxT( "Cannot add a VRML model to a STEP file.\n" ) );
return false; return false;
} }
@ -1204,7 +1213,7 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale,
if( aLabel.IsNull() ) if( aLabel.IsNull() )
{ {
ReportMessage( wxString::Format( "Could not transfer model data from file '%s'.\n", ReportMessage( wxString::Format( wxT( "Could not transfer model data from file '%s'.\n" ),
fileName ) ); fileName ) );
return false; return false;
} }
@ -1401,7 +1410,7 @@ TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source,
} }
else else
{ {
ReportMessage( " * transfertModel(): failed to scale model\n" ); ReportMessage( wxT( " * transfertModel(): failed to scale model\n" ) );
scaled_shape = shape; scaled_shape = shape;
} }
@ -1607,14 +1616,15 @@ bool OUTLINE::MakeShape( TopoDS_Shape& aShape, double aThickness )
} }
catch( const Standard_Failure& e ) catch( const Standard_Failure& e )
{ {
ReportMessage( wxString::Format( "Exception caught: %s\n", e.GetMessageString() ) ); ReportMessage( wxString::Format( wxT( "Exception caught: %s\n" ),
e.GetMessageString() ) );
success = false; success = false;
} }
if( !success ) if( !success )
{ {
ReportMessage( wxString::Format( "failed to add edge: %s\n" ReportMessage( wxString::Format( wxT( "failed to add edge: %s\n"
"last valid outline point: %f %f\n", "last valid outline point: %f %f\n" ),
i.Describe().c_str(), i.Describe().c_str(),
lastPoint.x, lastPoint.x,
lastPoint.y ) ); lastPoint.y ) );
@ -1627,7 +1637,7 @@ bool OUTLINE::MakeShape( TopoDS_Shape& aShape, double aThickness )
if( aShape.IsNull() ) if( aShape.IsNull() )
{ {
ReportMessage( "failed to create a prismatic shape\n" ); ReportMessage( wxT( "failed to create a prismatic shape\n" ) );
return false; return false;
} }
@ -1688,7 +1698,7 @@ bool OUTLINE::addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBL
break; break;
default: default:
ReportMessage( wxString::Format( "unsupported curve type: %d\n", aCurve.m_form ) ); ReportMessage( wxString::Format( wxT( "unsupported curve type: %d\n" ), aCurve.m_form ) );
return false; return false;
} }
@ -1700,7 +1710,7 @@ bool OUTLINE::addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBL
if( BRepBuilderAPI_DisconnectedWire == aWire->Error() ) if( BRepBuilderAPI_DisconnectedWire == aWire->Error() )
{ {
ReportMessage( "failed to add curve\n" ); ReportMessage( wxT( "failed to add curve\n" ) );
return false; return false;
} }