diff --git a/utils/idftools/idf2vrml.cpp b/utils/idftools/idf2vrml.cpp index 5f836f34bf..678d8613b1 100644 --- a/utils/idftools/idf2vrml.cpp +++ b/utils/idftools/idf2vrml.cpp @@ -121,33 +121,33 @@ bool IDF2VRML::OnInit() void IDF2VRML::OnInitCmdLine( wxCmdLineParser& parser ) { parser.SetDesc( cmdLineDesc ); - parser.SetSwitchChars( "-" ); + parser.SetSwitchChars( wxT( "-" ) ); return; } bool IDF2VRML::OnCmdLineParsed( wxCmdLineParser& parser ) { - if( parser.Found( "k" ) ) + if( parser.Found( wxT( "k" ) ) ) m_Compact = false; double scale; - if( parser.Found( "s", &scale ) ) + if( parser.Found( wxT( "s" ), &scale ) ) m_ScaleFactor = scale; wxString fname; - if( parser.Found( "f", &fname ) ) + if( parser.Found( wxT( "f" ), &fname ) ) m_filename = fname; - if( parser.Found( "d" ) ) + if( parser.Found( wxT( "d" ) ) ) m_NoOutlineSubs = true; - if( parser.Found( "z" ) ) + if( parser.Found( wxT( "z" ) ) ) nozeroheights = true; - if( parser.Found( "m" ) ) + if( parser.Found( wxT( "m" ) ) ) showObjectMapping = true; return true; @@ -227,17 +227,18 @@ int IDF2VRML::OnRun() 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; } 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 ) ) { - wxLogMessage( "Failed to read IDF data: %s", pcb.GetError() ); + wxLogMessage( wxT( "Failed to read IDF data: %s" ), pcb.GetError() ); return -1; } @@ -257,16 +258,14 @@ int IDF2VRML::OnRun() // Create the VRML file and write the header wxFileName fname( m_filename ); - fname.SetExt( "wrl" ); + fname.SetExt( wxT( "wrl" ) ); fname.Normalize(); - wxLogMessage( "Writing file: '%s'", fname.GetFullName() ); + wxLogMessage( wxT( "Writing file: '%s'" ), fname.GetFullName() ); OPEN_OSTREAM( ofile, fname.GetFullPath().ToUTF8() ); if( ofile.fail() ) - { - wxLogMessage( "Could not open file: '%s'", fname.GetFullName() ); - } + wxLogMessage( wxT( "Could not open file: '%s'" ), fname.GetFullName() ); ofile.imbue( std::locale( "C" ) ); 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 ) { - wxLogMessage( "Cannot proceed; no board outline in IDF object" ); + wxLogMessage( wxT( "Cannot proceed; no board outline in IDF object" ) ); return false; } @@ -420,13 +419,13 @@ bool PopulateVRML( VRML_LAYER& model, const std::list< IDF_OUTLINE* >* items, bo if( nvcont < 0 ) { - wxLogMessage( "Cannot create an outline" ); + wxLogMessage( wxT( "Cannot create an outline" ) ); return false; } if( (*scont)->size() < 1 ) { - wxLogMessage( "Invalid contour: no vertices" ); + wxLogMessage( wxT( "Invalid contour: no vertices" ) ); return false; } @@ -464,7 +463,7 @@ bool AddSegment( VRML_LAYER& model, IDF_SEGMENT* seg, int icont, int iseg ) { if( iseg != 0 ) { - wxLogMessage( "Adding a circle to an existing vertex list" ); + wxLogMessage( wxT( "Adding a circle to an existing vertex list" ) ); 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 ) ) { - wxLogMessage( "Errors writing planar vertices to %s\n%s", - vID->objectName, layer->GetError() ); + wxLogMessage( wxT( "Errors writing planar vertices to %s\n%s" ), + vID->objectName, layer->GetError() ); } } else { if( !layer->Write3DVertices( top_z, bottom_z, file, precision ) ) { - wxLogMessage( "Errors writing 3D vertices to %s\n%s", - vID->objectName, layer->GetError() ); + wxLogMessage( wxT( "Errors writing 3D vertices to %s\n%s" ), + vID->objectName, layer->GetError() ); } } @@ -869,7 +868,7 @@ VRML_IDS* GetColor( boost::ptr_map& cmap, int& inde id->objectName = ostr.str(); if( showObjectMapping ) - wxLogMessage( "* %s = '%s'", ostr.str(), uid ); + wxLogMessage( wxT( "* %s = '%s'" ), ostr.str(), uid ); cmap.insert( uid, id ); diff --git a/utils/idftools/idf_outlines.cpp b/utils/idftools/idf_outlines.cpp index a8bf8ea366..ec7f65f76a 100644 --- a/utils/idftools/idf_outlines.cpp +++ b/utils/idftools/idf_outlines.cpp @@ -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 ) ) + { throw( IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, "\n* invalid .PLACE_REGION section: no .END_PLACE_REGION found" ) ); + } } diff --git a/utils/idftools/idf_parser.cpp b/utils/idftools/idf_parser.cpp index e03cc19ccd..e295d75096 100644 --- a/utils/idftools/idf_parser.cpp +++ b/utils/idftools/idf_parser.cpp @@ -2804,11 +2804,11 @@ bool IDF3_BOARD::ReadFile( const wxString& aFullFileName, bool aNoSubstituteOutl wxFileName libname( aFullFileName ); wxString ext = brdname.GetExt(); - if( !ext.Cmp( "EMN" ) ) + if( !ext.Cmp( wxT( "EMN" ) ) ) { libname.SetExt( wxT( "EMP" ) ); } - else if( !ext.Cmp( "emn" ) ) + else if( !ext.Cmp( wxT( "emn" ) ) ) { libname.SetExt( wxT( "emp" ) ); } diff --git a/utils/kicad2step/kicad2step.cpp b/utils/kicad2step/kicad2step.cpp index 4120672054..c432fa8b24 100644 --- a/utils/kicad2step/kicad2step.cpp +++ b/utils/kicad2step/kicad2step.cpp @@ -91,9 +91,9 @@ protected: ReportMessage( theString.ToCString() ); #if OCC_VERSION_HEX < OCC_VERSION_MIN if( theToPutEol ) - ReportMessage( "\n" ); + ReportMessage( wxT( "\n" ) ); #else - ReportMessage( "\n" ); + ReportMessage( wxT( "\n" ) ); #endif } if( theGravity >= Message_Alarm ) @@ -284,10 +284,10 @@ wxString KICAD2MCAD_PRMS::getOutputExt() const { #ifdef SUPPORTS_IGES if( m_fmtIGES ) - return wxString( "igs" ); + return wxT( "igs" ); else #endif - return wxString( "step" ); + return wxT( "step" ); } @@ -299,7 +299,7 @@ KICAD2STEP::KICAD2STEP( KICAD2MCAD_PRMS aParams ) : m_params( aParams ), m_panel int KICAD2STEP::Run() { // 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->m_params = m_params; diff --git a/utils/kicad2step/kicad2step_app.cpp b/utils/kicad2step/kicad2step_app.cpp index ca1bda4829..c05ae2b349 100644 --- a/utils/kicad2step/kicad2step_app.cpp +++ b/utils/kicad2step/kicad2step_app.cpp @@ -33,7 +33,6 @@ #include #include "kicad2step.h" -#include "pcb/kicadpcb.h" #include "kicad2step_frame_base.h" #include // In open cascade @@ -49,8 +48,8 @@ public: virtual bool OnCmdLineParsed( wxCmdLineParser& parser ) override; private: - KICAD2STEP* m_converter; - KICAD2MCAD_PRMS m_params; + KICAD2STEP* m_converter; + KICAD2MCAD_PRMS m_params; }; @@ -96,7 +95,7 @@ static const wxCmdLineEntryDesc cmdLineDesc[] = { void KICAD2MCAD_APP::OnInitCmdLine( wxCmdLineParser& parser ) { parser.SetDesc( cmdLineDesc ); - parser.SetSwitchChars( "-" ); + parser.SetSwitchChars( wxT( "-" ) ); } @@ -124,28 +123,28 @@ int KICAD2MCAD_APP::OnRun() bool KICAD2MCAD_APP::OnCmdLineParsed( wxCmdLineParser& parser ) { #ifdef SUPPORTS_IGES - if( parser.Found( "fmt-iges" ) ) + if( parser.Found( wxT( "fmt-iges" ) ) ) m_fmtIGES = true; #endif - if( parser.Found( "f" ) ) + if( parser.Found( wxT( "f" ) ) ) m_params.m_overwrite = true; - if( parser.Found( "grid-origin" ) ) + if( parser.Found( wxT( "grid-origin" ) ) ) m_params.m_useGridOrigin = true; - if( parser.Found( "drill-origin" ) ) + if( parser.Found( wxT( "drill-origin" ) ) ) m_params.m_useDrillOrigin = true; - if( parser.Found( "no-virtual" ) ) + if( parser.Found( wxT( "no-virtual" ) ) ) m_params.m_includeVirtual = false; - if( parser.Found( "subst-models" ) ) + if( parser.Found( wxT( "subst-models" ) ) ) m_params.m_substModels = true; wxString tstr; - if( parser.Found( "user-origin", &tstr ) ) + if( parser.Found( wxT( "user-origin" ), &tstr ) ) { std::istringstream istr; 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; 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; diff --git a/utils/kicad2step/pcb/3d_resolver.cpp b/utils/kicad2step/pcb/3d_resolver.cpp index bc7040f4d1..a9c01e9af2 100644 --- a/utils/kicad2step/pcb/3d_resolver.cpp +++ b/utils/kicad2step/pcb/3d_resolver.cpp @@ -87,10 +87,10 @@ bool S3D_RESOLVER::createPathList( void ) return false; #ifdef DEBUG - wxLogTrace( trace3dResolver, " * [3D model] search paths:\n" ); + wxLogTrace( trace3dResolver, wxT( " * [3D model] search paths:\n" ) ); for( const SEARCH_PATH& searchPath : m_Paths ) - wxLogTrace( trace3dResolver, " + '%s'\n", searchPath.m_Pathexp ); + wxLogTrace( trace3dResolver, wxT( " + '%s'\n" ), searchPath.m_Pathexp ); #endif return true; @@ -120,20 +120,21 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName, #ifdef _WIN32 // translate from KiCad's internal UNIX-like path to MSWin paths - tname.Replace( "/", "\\" ); + tname.Replace( wxT( "/" ), wxT( "\\" ) ); #endif // 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 // then we will have a race condition since wxWidgets does not assure a threadsafe wrapper // for getenv(). - if( tname.StartsWith( "${" ) || tname.StartsWith( "$(" ) ) + if( tname.StartsWith( wxT( "${" ) ) || tname.StartsWith( wxT( "$(" ) ) ) tname = expandVars( tname ); wxFileName tmpFN( tname ); // 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() ) { @@ -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 // then add it - if( aFileName.StartsWith( "${" ) || aFileName.StartsWith( "$(" ) ) + if( aFileName.StartsWith( wxT( "${" ) ) || aFileName.StartsWith( wxT( "$(" ) ) ) checkEnvVarPath( aFileName ); 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 // 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; 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}. // 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}. - 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; - if( fullPath.StartsWith( "${" ) || fullPath.StartsWith( "$(" ) ) + if( fullPath.StartsWith( wxT( "${" ) ) || fullPath.StartsWith( wxT( "$(" ) ) ) fullPath = expandVars( 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) - if( !tname.Contains( ":" ) ) + if( !tname.Contains( wxT( ":" ) ) ) { wxFileName fpath; - wxString fullPath( "${KICAD6_3DMODEL_DIR}" ); + wxString fullPath( wxT( "${KICAD6_3DMODEL_DIR}" ) ); fullPath.Append( fpath.GetPathSeparator() ); fullPath.Append( tname ); fullPath = expandVars( fullPath ); @@ -245,7 +246,7 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName, for( const SEARCH_PATH& path : m_Paths ) { // ${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; 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 ) ); wxString fullPath = fpath.GetPathWithSep() + relpath; - if( fullPath.StartsWith( "${") || fullPath.StartsWith( "$(" ) ) + if( fullPath.StartsWith( wxT( "${" ) ) || fullPath.StartsWith( wxT( "$(" ) ) ) fullPath = expandVars( fullPath ); wxFileName tmp( fullPath ); @@ -287,32 +288,32 @@ bool S3D_RESOLVER::addPath( const SEARCH_PATH& aPath ) SEARCH_PATH tpath = aPath; #ifdef _WIN32 - while( tpath.m_Pathvar.EndsWith( "\\" ) ) + while( tpath.m_Pathvar.EndsWith( wxT( "\\" ) ) ) tpath.m_Pathvar.erase( tpath.m_Pathvar.length() - 1 ); #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 ); #endif - wxFileName path( tpath.m_Pathvar, "" ); + wxFileName path( tpath.m_Pathvar, wxT( "" ) ); path.Normalize(); if( !path.DirExists() ) { // Show a message only in debug mode #ifdef DEBUG - if( aPath.m_Pathvar == "${KICAD6_3DMODEL_DIR}" - || aPath.m_Pathvar == "${KIPRJMOD}" - || aPath.m_Pathvar == "${KISYS3DMOD}" ) + if( aPath.m_Pathvar == wxT( "${KICAD6_3DMODEL_DIR}" ) + || aPath.m_Pathvar == wxT( "${KIPRJMOD}" ) + || aPath.m_Pathvar == wxT( "${KISYS3DMOD}" ) ) { // suppress the message if the missing pathvar is a system variable } else { wxString msg = _( "The given path does not exist" ); - msg.append( "\n" ); + msg.append( wxT( "\n" ) ); msg.append( tpath.m_Pathvar ); - wxLogMessage( "%s\n", msg.ToUTF8() ); + wxLogMessage( wxT( "%s\n" ), msg.ToUTF8() ); } #endif @@ -323,10 +324,10 @@ bool S3D_RESOLVER::addPath( const SEARCH_PATH& aPath ) tpath.m_Pathexp = path.GetFullPath(); #ifdef _WIN32 - while( tpath.m_Pathexp.EndsWith( "\\" ) ) + while( tpath.m_Pathexp.EndsWith( wxT( "\\" ) ) ) tpath.m_Pathexp.erase( tpath.m_Pathexp.length() - 1 ); #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 ); #endif } @@ -341,10 +342,10 @@ bool S3D_RESOLVER::addPath( const SEARCH_PATH& aPath ) { wxString msg = _( "Alias:" ) + wxS( " " ); msg.append( tpath.m_Alias ); - msg.append( "\n" ); + msg.append( wxS( "\n" ) ); msg.append( _( "This path:" ) + wxS( " " ) ); msg.append( tpath.m_Pathvar ); - msg.append( "\n" ); + msg.append( wxS( "\n" ) ); msg.append( _( "Existing path:" ) + wxS( " " ) ); msg.append( sPL->m_Pathvar ); wxMessageBox( msg, _( "Bad alias (duplicate name)" ) ); @@ -448,17 +449,17 @@ void S3D_RESOLVER::checkEnvVarPath( const wxString& aPath ) { bool useParen = false; - if( aPath.StartsWith( "$(" ) ) + if( aPath.StartsWith( wxT( "$(" ) ) ) useParen = true; - else if( !aPath.StartsWith( "${" ) ) + else if( !aPath.StartsWith( wxT( "${" ) ) ) return; size_t pEnd; if( useParen ) - pEnd = aPath.find( ")" ); + pEnd = aPath.find( wxT( ")" ) ); else - pEnd = aPath.find( "}" ); + pEnd = aPath.find( wxT( "}" ) ); if( pEnd == wxString::npos ) return; @@ -475,7 +476,7 @@ void S3D_RESOLVER::checkEnvVarPath( const wxString& aPath ) if( sPL->m_Alias == envar ) return; - if( !sPL->m_Alias.StartsWith( "${" ) ) + if( !sPL->m_Alias.StartsWith( wxT( "${" ) ) ) break; ++sPL; @@ -484,7 +485,7 @@ void S3D_RESOLVER::checkEnvVarPath( const wxString& aPath ) SEARCH_PATH lpath; lpath.m_Alias = envar; lpath.m_Pathvar = lpath.m_Alias; - wxFileName tmpFN( lpath.m_Alias, "" ); + wxFileName tmpFN( lpath.m_Alias, wxT( "" ) ); wxUniChar psep = tmpFN.GetPathSeparator(); tmpFN.Normalize(); @@ -518,7 +519,7 @@ wxString S3D_RESOLVER::expandVars( const wxString& aPath ) result = i.second; result.append( aPath.substr( 3 + i.first.length() ) ); - if( result.StartsWith( "${" ) || result.StartsWith( "$(" ) ) + if( result.StartsWith( wxT( "${" ) ) || result.StartsWith( wxT( "$(" ) ) ) result = expandVars( result ); return result; @@ -530,7 +531,7 @@ wxString S3D_RESOLVER::expandVars( const wxString& aPath ) if( result == aPath ) return wxEmptyString; - if( result.StartsWith( "${" ) || result.StartsWith( "$(" ) ) + if( result.StartsWith( wxT( "${" ) ) || result.StartsWith( wxT( "$(" ) ) ) result = expandVars( result ); return result; @@ -559,7 +560,7 @@ wxString S3D_RESOLVER::ShortenPath( const wxString& aFullPathName ) continue; } - wxFileName fpath( sL->m_Pathexp, "" ); + wxFileName fpath( sL->m_Pathexp, wxT( "" ) ); wxString fps = fpath.GetPathWithSep(); wxString tname; @@ -571,22 +572,22 @@ wxString S3D_RESOLVER::ShortenPath( const wxString& aFullPathName ) #ifdef _WIN32 // ensure only the '/' separator is used in the internal name - fname.Replace( "\\", "/" ); + fname.Replace( wxT( "\\" ), wxT( "/" ) ); #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 tname = sL->m_Alias; - tname.Append( "/" ); + tname.Append( wxT( "/" ) ); tname.append( fname ); } else { // new style alias - tname = ":"; + tname = wxT( ":" ); tname.append( sL->m_Alias ); - tname.append( ":" ); + tname.append( wxT( ":" ) ); tname.append( fname ); } @@ -601,7 +602,7 @@ wxString S3D_RESOLVER::ShortenPath( const wxString& aFullPathName ) // UNIX separator but this is done for consistency and can // be helpful even when transferring project files from // MSWin to *NIX. - fname.Replace( "\\", "/" ); + fname.Replace( wxT( "\\" ), wxT( "/" ) ); #endif return fname; @@ -736,12 +737,12 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias ) // ensure that the file separators suit the current platform #ifdef __WINDOWS__ - filename.Replace( "/", "\\" ); + filename.Replace( wxT( "/" ), wxT( "\\" ) ); // if we see the :\ pattern then it must be a drive designator if( aliasEnd != wxString::npos ) { - size_t pos1 = aFileName.find( ":\\" ); + size_t pos1 = aFileName.find( wxT( ":\\" ) ); if( pos1 != wxString::npos && ( pos1 != aliasEnd || pos1 != 1 ) ) return false; @@ -751,7 +752,7 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias ) aliasEnd = wxString::npos; } #else - filename.Replace( "\\", "/" ); + filename.Replace( wxT( "\\" ), wxT( "/" ) ); #endif // names may not end with ':' @@ -781,9 +782,9 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias ) // environment string before testing aliasEnd = wxString::npos; - if( aFileName.StartsWith( "${" ) ) + if( aFileName.StartsWith( wxT( "${" ) ) ) aliasEnd = aFileName.find( '}' ); - else if( aFileName.StartsWith( "$(" ) ) + else if( aFileName.StartsWith( wxT( "$(" ) ) ) aliasEnd = aFileName.find( ')' ); if( aliasEnd != wxString::npos ) diff --git a/utils/kicad2step/pcb/base.cpp b/utils/kicad2step/pcb/base.cpp index 3b5d2d5ed9..c89ecb73d2 100644 --- a/utils/kicad2step/pcb/base.cpp +++ b/utils/kicad2step/pcb/base.cpp @@ -55,7 +55,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou { std::ostringstream ostr; ostr << bad_position << " (line " << data->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -64,7 +64,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou std::ostringstream ostr; ostr << "* SEXPR item is not a position string (line "; ostr << data->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -83,7 +83,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou { std::ostringstream ostr; ostr << bad_position << " (line " << child->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -102,7 +102,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou { std::ostringstream ostr; ostr << bad_position << " (line " << child->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -127,7 +127,7 @@ bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, dou { std::ostringstream ostr; ostr << bad_position << " (line " << child->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -152,7 +152,7 @@ bool Get2DCoordinate( const SEXPR::SEXPR* data, DOUBLET& aCoordinate ) { std::ostringstream ostr; ostr << bad_position << " (line " << data->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -171,7 +171,7 @@ bool Get2DCoordinate( const SEXPR::SEXPR* data, DOUBLET& aCoordinate ) { std::ostringstream ostr; ostr << bad_position << " (line " << child->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -190,7 +190,7 @@ bool Get2DCoordinate( const SEXPR::SEXPR* data, DOUBLET& aCoordinate ) { std::ostringstream ostr; ostr << bad_position << " (line " << child->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -210,7 +210,7 @@ bool Get3DCoordinate( const SEXPR::SEXPR* data, TRIPLET& aCoordinate ) { std::ostringstream ostr; ostr << bad_position << " (line " << data->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -229,7 +229,7 @@ bool Get3DCoordinate( const SEXPR::SEXPR* data, TRIPLET& aCoordinate ) { std::ostringstream ostr; ostr << bad_position << " (line " << child->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } } @@ -250,7 +250,7 @@ bool GetXYZRotation( const SEXPR::SEXPR* data, TRIPLET& aRotation ) { std::ostringstream ostr; ostr << bad_rotation << " (line " << data->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } diff --git a/utils/kicad2step/pcb/kicadcurve.cpp b/utils/kicad2step/pcb/kicadcurve.cpp index 66086ef555..c475a2ef0a 100644 --- a/utils/kicad2step/pcb/kicadcurve.cpp +++ b/utils/kicad2step/pcb/kicadcurve.cpp @@ -60,7 +60,7 @@ bool KICADCURVE::Read( SEXPR::SEXPR* aEntry, CURVE_TYPE aCurveType ) && CURVE_CIRCLE != aCurveType && CURVE_BEZIER != aCurveType && CURVE_POLYGON != aCurveType ) { - wxLogMessage( "* Unsupported curve type: %d\n", aCurveType ); + wxLogMessage( wxT( "* Unsupported curve type: %d\n" ), aCurveType ); return false; } @@ -74,7 +74,7 @@ bool KICADCURVE::Read( SEXPR::SEXPR* aEntry, CURVE_TYPE aCurveType ) || ( CURVE_BEZIER == 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; } @@ -154,10 +154,9 @@ bool KICADCURVE::Read( SEXPR::SEXPR* aEntry, CURVE_TYPE aCurveType ) else if( text == "angle" ) { if( child->GetNumberOfChildren() < 2 - || ( !child->GetChild( 1 )->IsDouble() - && !child->GetChild( 1 )->IsInteger() ) ) + || ( !child->GetChild( 1 )->IsDouble() && !child->GetChild( 1 )->IsInteger() ) ) { - wxLogMessage( "* bad angle data\n" ); + wxLogMessage( wxT( "* bad angle data\n" ) ); return false; } @@ -176,7 +175,7 @@ bool KICADCURVE::Read( SEXPR::SEXPR* aEntry, CURVE_TYPE aCurveType ) { std::ostringstream ostr; ostr << "* bad layer data: " << child->AsString(); - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } diff --git a/utils/kicad2step/pcb/kicadfootprint.cpp b/utils/kicad2step/pcb/kicadfootprint.cpp index c446a21c8a..9053125f4d 100644 --- a/utils/kicad2step/pcb/kicadfootprint.cpp +++ b/utils/kicad2step/pcb/kicadfootprint.cpp @@ -86,7 +86,7 @@ bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry ) { std::ostringstream ostr; 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; } @@ -109,14 +109,16 @@ bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry ) if( symname == "locked" || symname == "placed" ) continue; - wxLogMessage( "* module descr in PCB file at line %d: unexpected keyword '%s'\n", - child->GetLineNumber(), symname.c_str() ); + wxLogMessage( wxT( "* module descr in PCB file at line %d: unexpected keyword " + "'%s'\n" ), + child->GetLineNumber(), + symname.c_str() ); return false; } 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() ); return false; } @@ -155,7 +157,7 @@ bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry ) std::ostringstream ostr; 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; } @@ -248,7 +250,7 @@ bool KICADFOOTPRINT::parseLayer( SEXPR::SEXPR* data ) std::ostringstream ostr; ostr << "* corrupt module in PCB file (line "; 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; } @@ -276,7 +278,7 @@ bool KICADFOOTPRINT::parseAttribute( SEXPR::SEXPR* data ) std::ostringstream ostr; ostr << "* corrupt module in PCB file (line "; 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; } @@ -443,10 +445,10 @@ bool KICADFOOTPRINT::ComposePCB( class PCBMODEL* aPCB, S3D_RESOLVER* resolver, for( const wxString& path : searchedPaths ) paths += " " + path + "\n"; - ReportMessage( wxString::Format( "Could not add 3D model to %s.\n" - "File not found: %s\n" - "Searched paths:\n" - "%s", + ReportMessage( wxString::Format( wxT( "Could not add 3D model to %s.\n" + "File not found: %s\n" + "Searched paths:\n" + "%s" ), m_refdes, mname, paths) ); @@ -466,8 +468,8 @@ bool KICADFOOTPRINT::ComposePCB( class PCBMODEL* aPCB, S3D_RESOLVER* resolver, } catch( const Standard_Failure& e) { - ReportMessage( wxString::Format( "Could not add 3D model to %s.\n" - "OpenCASCADE error: %s\n", + ReportMessage( wxString::Format( wxT( "Could not add 3D model to %s.\n" + "OpenCASCADE error: %s\n" ), m_refdes, e.GetMessageString() ) ); } diff --git a/utils/kicad2step/pcb/kicadmodel.cpp b/utils/kicad2step/pcb/kicadmodel.cpp index 73826a4a6b..5fcd4ad0aa 100644 --- a/utils/kicad2step/pcb/kicadmodel.cpp +++ b/utils/kicad2step/pcb/kicadmodel.cpp @@ -54,7 +54,7 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry ) { std::ostringstream ostr; ostr << "* invalid model entry"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -72,7 +72,7 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry ) { std::ostringstream ostr; ostr << "* invalid model entry; invalid path"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } diff --git a/utils/kicad2step/pcb/kicadpad.cpp b/utils/kicad2step/pcb/kicadpad.cpp index ab398001fb..8ecb925b18 100644 --- a/utils/kicad2step/pcb/kicadpad.cpp +++ b/utils/kicad2step/pcb/kicadpad.cpp @@ -59,7 +59,7 @@ bool KICADPAD::Read( const SEXPR::SEXPR* aEntry ) { std::ostringstream ostr; ostr << bad_pad << " (line " << aEntry->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -111,7 +111,7 @@ bool KICADPAD::parseDrill( const SEXPR::SEXPR* aDrill ) { std::ostringstream ostr; ostr << bad_drill << " (line " << aDrill->GetLineNumber() << ")"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -132,7 +132,7 @@ bool KICADPAD::parseDrill( const SEXPR::SEXPR* aDrill ) ostr << bad_drill << " (line " << child->GetLineNumber(); ostr << ") (unexpected symbol: "; ostr << child->GetSymbol() << "), nchild = " << nchild; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } } @@ -148,7 +148,7 @@ bool KICADPAD::parseDrill( const SEXPR::SEXPR* aDrill ) std::ostringstream ostr; ostr << bad_drill << " (line " << child->GetLineNumber(); ostr << ") (did not find X size)"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } @@ -177,7 +177,7 @@ bool KICADPAD::parseDrill( const SEXPR::SEXPR* aDrill ) std::ostringstream ostr; ostr << bad_drill << " (line " << child->GetLineNumber(); ostr << ") (did not find Y size)"; - wxLogMessage( "%s\n", ostr.str().c_str() ); + wxLogMessage( wxT( "%s\n" ), ostr.str().c_str() ); return false; } diff --git a/utils/kicad2step/pcb/kicadpcb.cpp b/utils/kicad2step/pcb/kicadpcb.cpp index 48050b21a4..c438a0cc36 100644 --- a/utils/kicad2step/pcb/kicadpcb.cpp +++ b/utils/kicad2step/pcb/kicadpcb.cpp @@ -42,7 +42,7 @@ KICADPCB::KICADPCB( const wxString& aPcbName ) { - m_resolver.Set3DConfigDir( "" ); + m_resolver.Set3DConfigDir( wxT( "" ) ); m_thickness = 1.6; m_pcb_model = nullptr; m_minDistance = MIN_DISTANCE; @@ -74,14 +74,14 @@ bool KICADPCB::ReadFile( const wxString& aFileName ) 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() ) ); return false; } if( !fname.FileExists() ) { - ReportMessage( wxString::Format( "No such file: %s\n", aFileName ) ); + ReportMessage( wxString::Format( wxT( "No such file: %s\n" ), aFileName ) ); return false; } @@ -96,7 +96,7 @@ bool KICADPCB::ReadFile( const wxString& aFileName ) 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; } @@ -105,12 +105,14 @@ bool KICADPCB::ReadFile( const wxString& aFileName ) } 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; } catch( ... ) { - ReportMessage( wxString::Format( "unexpected exception while reading file: %s\n", + ReportMessage( wxString::Format( wxT( "unexpected exception while reading file: %s\n" ), aFileName ) ); return false; } @@ -162,7 +164,7 @@ bool KICADPCB::parsePCB( SEXPR::SEXPR* data ) if( !child->IsList() ) { - ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n", + ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n" ), child->GetLineNumber() ) ); return false; } @@ -196,7 +198,7 @@ bool KICADPCB::parsePCB( SEXPR::SEXPR* data ) 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; } @@ -212,7 +214,7 @@ bool KICADPCB::parseGeneral( SEXPR::SEXPR* data ) if( !child->IsList() ) { - ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n", + ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n" ), child->GetLineNumber() ) ); return false; } @@ -225,8 +227,8 @@ bool KICADPCB::parseGeneral( SEXPR::SEXPR* data ) return true; } - ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n" - "no PCB thickness specified in general section\n", + ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n" + "no PCB thickness specified in general section\n" ), child->GetLineNumber() ) ); return false; } @@ -244,7 +246,7 @@ bool KICADPCB::parseLayers( SEXPR::SEXPR* data ) if( !child->IsList() ) { - ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n", + ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n" ), child->GetLineNumber() ) ); return false; } @@ -285,7 +287,7 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data ) if( !child->IsList() ) { - ReportMessage( wxString::Format( "corrupt PCB file (line %d)\n", + ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d)\n" ), child->GetLineNumber() ) ); return false; } @@ -295,8 +297,8 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data ) { if( child->GetNumberOfChildren() != 3 ) { - ReportMessage( wxString::Format( "corrupt PCB file (line %d): grid_origin has " - "%d children (expected: 3)\n", + ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d): grid_origin has " + "%d children (expected: 3)\n" ), child->GetLineNumber(), child->GetNumberOfChildren() ) ); return false; @@ -310,8 +312,8 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data ) { if( child->GetNumberOfChildren() != 3 ) { - ReportMessage( wxString::Format( "corrupt PCB file (line %d): aux_axis_origin has" - " %d children (expected: 3)\n", + ReportMessage( wxString::Format( wxT( "corrupt PCB file (line %d): aux_axis_origin " + "has %d children (expected: 3)\n" ), child->GetLineNumber(), child->GetNumberOfChildren() ) ); return false; @@ -449,7 +451,7 @@ bool KICADPCB::ComposePCB( bool aComposeVirtual, bool aSubstituteModels ) 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; } @@ -502,11 +504,11 @@ bool KICADPCB::ComposePCB( bool aComposeVirtual, bool aSubstituteModels ) for( auto i : m_footprints ) 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() ) { - ReportMessage( "could not create PCB solid model\n" ); + ReportMessage( wxT( "could not create PCB solid model\n" ) ); delete m_pcb_model; m_pcb_model = NULL; return false; diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index 0f4e145fe7..6047d526c8 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -185,7 +185,7 @@ FormatType fileType( const char* aFileName ) if( !lfile.FileExists() ) { wxString msg; - msg.Printf( " * fileType(): no such file: %s\n", + msg.Printf( wxT( " * fileType(): no such file: %s\n" ), wxString::FromUTF8Unchecked( aFileName ) ); ReportMessage( msg ); @@ -194,19 +194,19 @@ FormatType fileType( const char* aFileName ) wxString ext = lfile.GetExt().Lower(); - if( ext == "wrl" ) + if( ext == wxT( "wrl" ) ) return FMT_WRL; - if( ext == "wrz" ) + if( ext == wxT( "wrz" ) ) return FMT_WRZ; - if( ext == "idf" ) + if( ext == wxT( "idf" ) ) return FMT_IDF; // component outline - if( ext == "emn" ) + if( ext == wxT( "emn" ) ) return FMT_EMN; // PCB assembly - if( ext == "stpz" || ext == "gz" ) + if( ext == wxT( "stpz" ) || ext == wxT( "gz" ) ) return FMT_STEPZ; OPEN_ISTREAM( ifile, aFileName ); @@ -282,7 +282,8 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) if( distance < m_minDistance2 ) { 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 ); return false; } @@ -297,7 +298,8 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) if( rad < m_minDistance2 ) { 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 ); return false; } @@ -333,8 +335,8 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) if( rad < m_minDistance2 ) { - ReportMessage( wxString::Format( " * AddOutlineSegment() rejected an arc with " - "equivalent end points, %s\n", + ReportMessage( wxString::Format( wxT( " * AddOutlineSegment() rejected an arc " + "with equivalent end points, %s\n" ), aCurve->Describe() ) ); return false; } @@ -451,7 +453,8 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) do { 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 ); } while( 0 ); @@ -610,12 +613,12 @@ bool PCBMODEL::AddComponent( const std::string& aFileNameUTF8, const std::string { 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; } 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 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( errorMessage.IsEmpty() ) - ReportMessage( wxString::Format( "No model for filename '%s'.\n", fileName ) ); + ReportMessage( wxString::Format( wxT( "No model for filename '%s'.\n" ), fileName ) ); else ReportMessage( errorMessage ); @@ -636,7 +639,8 @@ bool PCBMODEL::AddComponent( const std::string& aFileNameUTF8, const std::string 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; } @@ -645,7 +649,7 @@ bool PCBMODEL::AddComponent( const std::string& aFileNameUTF8, const std::string 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 ) ); return false; } @@ -690,7 +694,7 @@ bool PCBMODEL::CreatePCB() if( m_curves.empty() || m_mincurve == m_curves.end() ) { m_hasPCB = true; - ReportMessage( "No valid board outline.\n" ); + ReportMessage( wxT( "No valid board outline.\n" ) ); return false; } @@ -701,7 +705,7 @@ bool PCBMODEL::CreatePCB() oln.AddSegment( *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() ) ); while( !m_curves.empty() ) @@ -712,7 +716,7 @@ bool PCBMODEL::CreatePCB() { if( !oln.MakeShape( board, m_thickness ) ) { - ReportMessage( "Could not create board extrusion.\n" ); + ReportMessage( wxT( "Could not create board extrusion.\n" ) ); return false; } } @@ -726,7 +730,7 @@ bool PCBMODEL::CreatePCB() } 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() ) { 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( oln.m_curves.size() ) ); for( const auto& c : oln.m_curves ) @@ -782,7 +786,7 @@ bool PCBMODEL::CreatePCB() { if( !oln.MakeShape( board, m_thickness ) ) { - ReportMessage( "Could not create board extrusion.\n" ); + ReportMessage( wxT( "Could not create board extrusion.\n" ) ); return false; } } @@ -796,21 +800,21 @@ bool PCBMODEL::CreatePCB() } else { - ReportMessage( "Could not create board cutout.\n" ); + ReportMessage( wxT( "Could not create board cutout.\n" ) ); } } } else { - ReportMessage( "Could not create closed board outlines.\n" ); + ReportMessage( wxT( "Could not create closed board outlines.\n" ) ); return false; } // subtract cutouts (if any) if( m_cutouts.size() ) { - ReportMessage( wxString::Format( "Build board cutouts and holes (%d holes).\n", - (int)m_cutouts.size() ) ); + ReportMessage( wxString::Format( wxT( "Build board cutouts and holes (%d holes).\n" ), + (int) m_cutouts.size() ) ); } #if 0 @@ -829,11 +833,11 @@ bool PCBMODEL::CreatePCB() char_count++; if( char_count < 80 ) - ReportMessage( "." ); + ReportMessage( wxT( "." ) ); else { 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 @@ -856,7 +860,7 @@ bool PCBMODEL::CreatePCB() #endif // 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 m_pcb_label = m_assy->AddComponent( m_assy_label, board, false ); @@ -876,7 +880,7 @@ bool PCBMODEL::CreatePCB() TDF_Label label = node->Father()->Label(); 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() ); TCollection_ExtendedString partname( pcbNameStdString.c_str() ); TDataStd_Name::Set( label, partname ); @@ -911,7 +915,8 @@ bool PCBMODEL::WriteIGES( const wxString& aFileName ) { 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 ) ); return false; } @@ -940,7 +945,8 @@ bool PCBMODEL::WriteSTEP( const wxString& aFileName ) { 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 ) ); return false; } @@ -956,7 +962,7 @@ bool PCBMODEL::WriteSTEP( const wxString& aFileName ) // 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 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 ) ) return false; @@ -991,7 +997,7 @@ bool PCBMODEL::WriteSTEP( const wxString& aFileName ) { 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, fn.GetFullName() ) ); success = false; @@ -1031,7 +1037,8 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale, case FMT_IGES: 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; } break; @@ -1039,7 +1046,8 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale, case FMT_STEP: 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; } break; @@ -1052,12 +1060,12 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale, wxFileName outFile( fileName ); outFile.SetPath( wxStandardPaths::Get().GetTempDir() ); - outFile.SetExt( "step" ); + outFile.SetExt( wxT( "step" ) ); wxFileOffset size = ifile.GetLength(); if( size == wxInvalidOffset ) { - ReportMessage( wxString::Format( "getModelLabel() failed on filename '%s'.\n", + ReportMessage( wxString::Format( wxT( "getModelLabel() failed on filename '%s'.\n" ), fileName ) ); return false; } @@ -1081,7 +1089,8 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale, } catch( ... ) { - ReportMessage( wxString::Format( "failed to decompress '%s'.\n", fileName ) ); + ReportMessage( wxString::Format( wxT( "failed to decompress '%s'.\n" ), + fileName ) ); } if( expanded.empty() ) @@ -1140,29 +1149,29 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale, wxArrayString alts; // Step files - alts.Add( "stp" ); - alts.Add( "step" ); - alts.Add( "STP" ); - alts.Add( "STEP" ); - alts.Add( "Stp" ); - alts.Add( "Step" ); - alts.Add( "stpz" ); - alts.Add( "stpZ" ); - alts.Add( "STPZ" ); - alts.Add( "step.gz" ); - alts.Add( "stp.gz" ); + alts.Add( wxT( "stp" ) ); + alts.Add( wxT( "step" ) ); + alts.Add( wxT( "STP" ) ); + alts.Add( wxT( "STEP" ) ); + alts.Add( wxT( "Stp" ) ); + alts.Add( wxT( "Step" ) ); + alts.Add( wxT( "stpz" ) ); + alts.Add( wxT( "stpZ" ) ); + alts.Add( wxT( "STPZ" ) ); + alts.Add( wxT( "step.gz" ) ); + alts.Add( wxT( "stp.gz" ) ); // IGES files - alts.Add( "iges" ); - alts.Add( "IGES" ); - alts.Add( "igs" ); - alts.Add( "IGS" ); + alts.Add( wxT( "iges" ) ); + alts.Add( wxT( "IGES" ) ); + alts.Add( wxT( "igs" ) ); + alts.Add( wxT( "IGS" ) ); //TODO - Other alternative formats? for( const auto& alt : alts ) { - wxFileName altFile( basePath, baseName + "." + alt ); + wxFileName altFile( basePath, baseName + wxT( "." ) + alt ); if( altFile.IsOk() && altFile.FileExists() ) { @@ -1187,7 +1196,7 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale, else // Substitution is not allowed { 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; } @@ -1204,7 +1213,7 @@ bool PCBMODEL::getModelLabel( const std::string& aFileNameUTF8, TRIPLET aScale, 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 ) ); return false; } @@ -1401,7 +1410,7 @@ TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source, } else { - ReportMessage( " * transfertModel(): failed to scale model\n" ); + ReportMessage( wxT( " * transfertModel(): failed to scale model\n" ) ); scaled_shape = shape; } @@ -1607,14 +1616,15 @@ bool OUTLINE::MakeShape( TopoDS_Shape& aShape, double aThickness ) } 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; } if( !success ) { - ReportMessage( wxString::Format( "failed to add edge: %s\n" - "last valid outline point: %f %f\n", + ReportMessage( wxString::Format( wxT( "failed to add edge: %s\n" + "last valid outline point: %f %f\n" ), i.Describe().c_str(), lastPoint.x, lastPoint.y ) ); @@ -1627,7 +1637,7 @@ bool OUTLINE::MakeShape( TopoDS_Shape& aShape, double aThickness ) if( aShape.IsNull() ) { - ReportMessage( "failed to create a prismatic shape\n" ); + ReportMessage( wxT( "failed to create a prismatic shape\n" ) ); return false; } @@ -1688,7 +1698,7 @@ bool OUTLINE::addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBL break; 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; } @@ -1700,7 +1710,7 @@ bool OUTLINE::addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBL if( BRepBuilderAPI_DisconnectedWire == aWire->Error() ) { - ReportMessage( "failed to add curve\n" ); + ReportMessage( wxT( "failed to add curve\n" ) ); return false; }