diff --git a/common/plugins/altium/altium_parser.cpp b/common/plugins/altium/altium_parser.cpp index 080d3e851b..dd1269c651 100644 --- a/common/plugins/altium/altium_parser.cpp +++ b/common/plugins/altium/altium_parser.cpp @@ -29,6 +29,7 @@ #include #include #include +#include const CFB::COMPOUND_FILE_ENTRY* FindStream( const CFB::CompoundFileReader& aReader, const char* aStreamName ) @@ -108,8 +109,9 @@ std::map ALTIUM_PARSER::ReadProperties() bool hasNullByte = m_pos[length - 1] == '\0'; if( !hasNullByte ) { - wxLogError( "For Altium import, we assumes a null byte at the end of a list of properties. " - "Because this is missing, imported data might be malformed or missing." ); + wxLogError( _( "For Altium import, we assumes a null byte at the end of a list of " + "properties. Because this is missing, imported data might be malformed or " + "missing." ) ); } // we use std::string because std::string can handle NULL-bytes @@ -220,16 +222,18 @@ int32_t ALTIUM_PARSER::PropertiesReadKicadUnit( const std::map buffer( new unsigned char[len] ); @@ -269,7 +269,7 @@ void SCH_ALTIUM_PLUGIN::ParseAltiumSch( const wxString& aFileName ) fclose( fp ); if( static_cast( len ) != bytesRead ) - THROW_IO_ERROR( "Reading error" ); + THROW_IO_ERROR( "Read error." ); try { @@ -311,9 +311,10 @@ void SCH_ALTIUM_PLUGIN::ParseStorage( const CFB::CompoundFileReader& aReader ) // TODO pointhi: is it possible to have multiple headers in one Storage file? Otherwise // throw IO Error. if( reader.GetRemainingBytes() != 0 ) - wxLogError( - wxString::Format( "Storage file was not fully parsed as %d bytes are remaining.", - reader.GetRemainingBytes() ) ); + { + wxLogError( _( "Storage file was not fully parsed as %d bytes are remaining." ), + reader.GetRemainingBytes() ); + } } @@ -1365,10 +1366,10 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map& aPr ASCH_SHEET_ENTRY elem( aProperties ); const auto& sheet = m_sheets.find( elem.ownerindex ); + if( sheet == m_sheets.end() ) { - wxLogError( wxString::Format( "Sheet Entry has non-existent ownerindex %d", - elem.ownerindex ) ); + wxLogError( _( "Sheet entry's owner (%d) not found." ), elem.ownerindex ); return; } @@ -1770,10 +1771,7 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem ) || endIsBusTerminal; if( !connectionFound ) - { - wxLogError( wxString::Format( "There is a Port for \"%s\", but no connections towards it?", - aElem.name ) ); - } + wxLogError( _( "There is a port for '%s', but no connections to it." ), aElem.name ); // Select label position. In case both match, we will add a line later. wxPoint position = ( startIsWireTerminal || startIsBusTerminal ) ? start : end; @@ -1946,8 +1944,7 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map& aPropert if( !storageFile ) { - wxLogError( - wxString::Format( "Embedded file not found in storage: %s", elem.filename ) ); + wxLogError( _( "Embedded file %s not found in storage." ), elem.filename ); return; } @@ -1962,7 +1959,7 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map& aPropert if( !bitmap->ReadImageFile( storagePath ) ) { - wxLogError( wxString::Format( "Error while reading image: %s", storagePath ) ); + wxLogError( _( "Error reading image %s." ), storagePath ); return; } @@ -1973,13 +1970,13 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map& aPropert { if( !wxFileExists( elem.filename ) ) { - wxLogError( wxString::Format( "File not found on disk: %s", elem.filename ) ); + wxLogError( _( "File not found %s." ), elem.filename ); return; } if( !bitmap->ReadImageFile( elem.filename ) ) { - wxLogError( wxString::Format( "Error while reading image: %s", elem.filename ) ); + wxLogError( _( "Error reading image %s." ), elem.filename ); return; } } @@ -2096,8 +2093,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheetName( const std::map& aPro const auto& sheet = m_sheets.find( elem.ownerindex ); if( sheet == m_sheets.end() ) { - wxLogError( wxString::Format( "Sheet Name has non-existent ownerindex %d", - elem.ownerindex ) ); + wxLogError( _( "Sheet name's owner (%d) not found." ), elem.ownerindex ); return; } @@ -2121,8 +2117,7 @@ void SCH_ALTIUM_PLUGIN::ParseFileName( const std::map& aProp const auto& sheet = m_sheets.find( elem.ownerindex ); if( sheet == m_sheets.end() ) { - wxLogError( wxString::Format( "File Name has non-existent ownerindex %d", - elem.ownerindex ) ); + wxLogError( _( "File name's owner (%d) not found." ), elem.ownerindex ); return; } diff --git a/eeschema/symbol_editor/symbol_library_manager.cpp b/eeschema/symbol_editor/symbol_library_manager.cpp index 030a175349..7779eea36d 100644 --- a/eeschema/symbol_editor/symbol_library_manager.cpp +++ b/eeschema/symbol_editor/symbol_library_manager.cpp @@ -1048,7 +1048,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( wxCHECK( libSymbol && originalSymbol, false ); wxCHECK( !aFileName.IsEmpty(), false ); - wxString errorMsg = _( "An error \"%s\" occurred saving symbol \"%s\" to library \"%s\"" ); + wxString errorMsg = _( "Error saving symbol %s to library '%s'." ) + wxS( "\n%s" ); // set properties to prevent save file on every symbol save PROPERTIES properties; @@ -1090,7 +1090,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( } catch( const IO_ERROR& ioe ) { - wxLogError( errorMsg, ioe.What(), cachedParent->GetName() ); + wxLogError( errorMsg, cachedParent->GetName(), aFileName, ioe.What() ); return false; } @@ -1100,7 +1100,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( } catch( const IO_ERROR& ioe ) { - wxLogError( errorMsg, ioe.What(), newCachedSymbol->GetName() ); + wxLogError( errorMsg, newCachedSymbol->GetName(), aFileName, ioe.What() ); return false; } @@ -1120,7 +1120,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( } catch( const IO_ERROR& ioe ) { - wxLogError( errorMsg, ioe.What(), newCachedSymbol->GetName() ); + wxLogError( errorMsg, newCachedSymbol->GetName(), aFileName, ioe.What() ); return false; } @@ -1145,7 +1145,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( } catch( const IO_ERROR& ioe ) { - wxLogError( errorMsg, ioe.What(), libSymbol->GetName() ); + wxLogError( errorMsg, libSymbol->GetName(), aFileName, ioe.What() ); return false; } @@ -1162,7 +1162,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( } catch( const IO_ERROR& ioe ) { - wxLogError( errorMsg, ioe.What(), libSymbol->GetName() ); + wxLogError( errorMsg, libSymbol->GetName(), aFileName, ioe.What() ); return false; } @@ -1182,7 +1182,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( } catch( const IO_ERROR& ioe ) { - wxLogError( errorMsg, ioe.What(), derivedSymbol->GetName() ); + wxLogError( errorMsg, derivedSymbol->GetName(), aFileName, ioe.What() ); return false; } } diff --git a/eeschema/symbol_tree_model_adapter.cpp b/eeschema/symbol_tree_model_adapter.cpp index 73ab2e3db6..5876c8cb0c 100644 --- a/eeschema/symbol_tree_model_adapter.cpp +++ b/eeschema/symbol_tree_model_adapter.cpp @@ -150,9 +150,9 @@ void SYMBOL_TREE_MODEL_ADAPTER::AddLibrary( wxString const& aLibNickname ) } catch( const IO_ERROR& ioe ) { - wxLogError( wxString::Format( _( "Error loading symbol library %s.\n\n%s" ), - aLibNickname, - ioe.What() ) ); + wxLogError( _( "Error loading symbol library '%s'." ) + wxS( "\n%s" ), + aLibNickname, + ioe.What() ); return; } diff --git a/eeschema/widgets/symbol_preview_widget.cpp b/eeschema/widgets/symbol_preview_widget.cpp index a8597de4fb..7de60ac242 100644 --- a/eeschema/widgets/symbol_preview_widget.cpp +++ b/eeschema/widgets/symbol_preview_widget.cpp @@ -178,10 +178,10 @@ void SYMBOL_PREVIEW_WIDGET::DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, i } catch( const IO_ERROR& ioe ) { - wxLogError( wxString::Format( _( "Error loading symbol %s from library '%s'.\n\n%s" ), - aSymbolID.GetLibItemName().wx_str(), - aSymbolID.GetLibNickname().wx_str(), - ioe.What() ) ); + wxLogError( _( "Error loading symbol %s from library '%s'." ) + wxS( "\n%s" ), + aSymbolID.GetLibItemName().wx_str(), + aSymbolID.GetLibNickname().wx_str(), + ioe.What() ); } if( m_previewItem ) diff --git a/pcbnew/generate_footprint_info.cpp b/pcbnew/generate_footprint_info.cpp index 97830d71f1..98b5629486 100644 --- a/pcbnew/generate_footprint_info.cpp +++ b/pcbnew/generate_footprint_info.cpp @@ -78,10 +78,10 @@ public: } catch( const IO_ERROR& ioe ) { - wxLogError( wxString::Format( _( "Error loading footprint %s from library '%s'.\n\n%s" ), - m_lib_id.GetLibItemName().wx_str(), - m_lib_id.GetLibNickname().wx_str(), - ioe.What() ) ); + wxLogError( _( "Error loading footprint %s from library '%s'." ) + wxS( "\n%s" ), + m_lib_id.GetLibItemName().wx_str(), + m_lib_id.GetLibNickname().wx_str(), + ioe.What() ); return; } diff --git a/pcbnew/plugins/altium/altium_parser_pcb.cpp b/pcbnew/plugins/altium/altium_parser_pcb.cpp index 4d15355246..4faecd5b3a 100644 --- a/pcbnew/plugins/altium/altium_parser_pcb.cpp +++ b/pcbnew/plugins/altium/altium_parser_pcb.cpp @@ -128,10 +128,10 @@ ALTIUM_LAYER altium_layer_from_name( const wxString& aName ) }; auto it = hash_map.find( std::string( aName.c_str() ) ); + if( it == hash_map.end() ) { - wxLogError( wxString::Format( - "Unknown mapping of the Altium layer '%s'. Please report as issue.", aName ) ); + wxLogError( _( "Unknown mapping of the Altium layer '%s'." ), aName ); return ALTIUM_LAYER::UNKNOWN; } else @@ -785,8 +785,7 @@ APAD6::APAD6( ALTIUM_PARSER& aReader ) } else if( subrecord6 != 0 ) { - wxLogError( wxString::Format( - "Pads6 stream has unexpected length for subrecord 6: %d", subrecord6 ) ); + wxLogError( _( "Pads6 stream has unexpected length for subrecord 6: %d." ), subrecord6 ); } aReader.SkipSubrecord(); diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index 2a918fc4f1..6def840e59 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -62,7 +62,7 @@ void ParseAltiumPcb( BOARD* aBoard, const wxString& aFileName, PROGRESS_REPORTER if( fp == nullptr ) { - wxLogError( wxString::Format( _( "Cannot open file '%s'" ), aFileName ) ); + wxLogError( _( "Cannot open file '%s'." ), aFileName ); return; } @@ -72,7 +72,7 @@ void ParseAltiumPcb( BOARD* aBoard, const wxString& aFileName, PROGRESS_REPORTER if( len < 0 ) { fclose( fp ); - THROW_IO_ERROR( "Reading error, cannot determine length of file" ); + THROW_IO_ERROR( _( "Error reading file: cannot determine length." ) ); } std::unique_ptr buffer( new unsigned char[len] ); @@ -83,7 +83,7 @@ void ParseAltiumPcb( BOARD* aBoard, const wxString& aFileName, PROGRESS_REPORTER if( static_cast( len ) != bytesRead ) { - THROW_IO_ERROR( "Reading error" ); + THROW_IO_ERROR( _( "Error reading file." ) ); } try @@ -459,15 +459,18 @@ void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader, ALTIUM_PARSER reader( aReader, file ); uint32_t numOfRecords = reader.Read(); + if( reader.HasParsingError() ) { - wxLogError( "'%s' was not parsed correctly", mappedFile ); + wxLogError( _( "'%s' was not parsed correctly." ), mappedFile ); continue; } + m_totalCount += numOfRecords; + if( reader.GetRemainingBytes() != 0 ) { - wxLogError( "'%s' is not fully parsed", mappedFile ); + wxLogError( _( "'%s' was not fully parsed." ), mappedFile ); continue; } } @@ -503,7 +506,7 @@ void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader, } else if( isRequired ) { - wxLogError( wxString::Format( _( "File not found: '%s'" ), mappedFile ) ); + wxLogError( _( "File not found: '%s'." ), mappedFile ); } } @@ -1004,9 +1007,9 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem ) if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Dimension on Altium layer %d has no KiCad equivalent. " - "Put it on Eco1_User instead" ), - aElem.layer ) ); + wxLogWarning( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + aElem.layer ); klayer = Eco1_User; } @@ -1079,11 +1082,12 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem ) void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem ) { PCB_LAYER_ID klayer = GetKicadLayer( aElem.layer ); + if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Dimension on Altium layer %d has no KiCad equivalent. " - "Put it on Eco1_User instead" ), - aElem.layer ) ); + wxLogWarning( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + aElem.layer ); klayer = Eco1_User; } @@ -1157,11 +1161,12 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem ) void ALTIUM_PCB::HelperParseDimensions6Datum( const ADIMENSION6& aElem ) { PCB_LAYER_ID klayer = GetKicadLayer( aElem.layer ); + if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Dimension on Altium layer %d has no KiCad equivalent. " - "Put it on Eco1_User instead" ), - aElem.layer ) ); + wxLogWarning( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + aElem.layer ); klayer = Eco1_User; } @@ -1180,11 +1185,12 @@ void ALTIUM_PCB::HelperParseDimensions6Datum( const ADIMENSION6& aElem ) void ALTIUM_PCB::HelperParseDimensions6Center( const ADIMENSION6& aElem ) { PCB_LAYER_ID klayer = GetKicadLayer( aElem.layer ); + if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Dimension on Altium layer %d has no KiCad equivalent. " - "Put it on Eco1_User instead" ), - aElem.layer ) ); + wxLogWarning( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + aElem.layer ); klayer = Eco1_User; } @@ -1222,14 +1228,16 @@ void ALTIUM_PCB::ParseDimensions6Data( const CFB::CompoundFileReader& aReader, HelperParseDimensions6Leader( elem ); break; case ALTIUM_DIMENSION_KIND::DATUM: - wxLogWarning( wxString::Format( "Ignore dimension object of kind %d", elem.kind ) ); + wxLogError( _( "Ignored dimension of kind %d (not yet supported)." ), + elem.kind ); // HelperParseDimensions6Datum( elem ); break; case ALTIUM_DIMENSION_KIND::CENTER: HelperParseDimensions6Center( elem ); break; default: - wxLogWarning( wxString::Format( "Ignore dimension object of kind %d", elem.kind ) ); + wxLogError( _( "Ignored dimension of kind %d (not yet supported)." ), + elem.kind ); break; } } @@ -1273,9 +1281,8 @@ void ALTIUM_PCB::ParseModelsData( const CFB::CompoundFileReader& aReader, { if( !altiumModelsPath.Mkdir() ) { - wxLogError( wxString::Format( - _( "Cannot create directory \"%s\" -> no 3D-models will be imported." ), - altiumModelsPath.GetFullPath() ) ); + wxLogError( _( "Cannot create directory '%s'. No 3D-models will be imported." ), + altiumModelsPath.GetFullPath() ); return; } } @@ -1291,8 +1298,7 @@ void ALTIUM_PCB::ParseModelsData( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* stepEntry = FindStream( aReader, stepPath.c_str() ); if( stepEntry == nullptr ) { - wxLogError( wxString::Format( _( "File not found: '%s' -> 3D-model not imported." ), - stepPath ) ); + wxLogError( _( "File not found: '%s'. 3D-model not imported." ), stepPath ); continue; } @@ -1305,9 +1311,8 @@ void ALTIUM_PCB::ParseModelsData( const CFB::CompoundFileReader& aReader, wxFileName storagePath( altiumModelsPath.GetPath(), elem.name ); if( !storagePath.IsDirWritable() ) { - wxLogError( - wxString::Format( _( "You do not have write permissions to save file \"%s\"." ), - storagePath.GetFullPath() ) ); + wxLogError( _( "You do not have write permissions to save file '%s'." ), + storagePath.GetFullPath() ); continue; } @@ -1332,7 +1337,7 @@ void ALTIUM_PCB::ParseNets6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading nets..." ); + m_progressReporter->Report( _( "Loading nets..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -1355,7 +1360,7 @@ void ALTIUM_PCB::ParsePolygons6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading polygons..." ); + m_progressReporter->Report( _( "Loading polygons..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -1365,13 +1370,13 @@ void ALTIUM_PCB::ParsePolygons6Data( const CFB::CompoundFileReader& aReader, APOLYGON6 elem( reader ); PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); + if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Polygon on Altium layer %d has no KiCad equivalent. " - "Ignore it instead" ), - elem.layer ) ); - m_polygons.emplace_back( nullptr ); - continue; + wxLogWarning( _( "Polygon found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + elem.layer ); + klayer = Eco1_User; } SHAPE_LINE_CHAIN linechain; @@ -1379,10 +1384,10 @@ void ALTIUM_PCB::ParsePolygons6Data( const CFB::CompoundFileReader& aReader, if( linechain.PointCount() < 2 ) { - wxLogError( wxString::Format( _( "Polygon has only %d point extracted from %ld vertices. " - "At least 2 points are required." ), - linechain.PointCount(), - elem.vertices.size() ) ); + wxLogError( _( "Polygon has only %d point extracted from %ld vertices. At least 2 " + "points are required." ), + linechain.PointCount(), + elem.vertices.size() ); m_polygons.emplace_back( nullptr ); continue; } @@ -1406,9 +1411,7 @@ void ALTIUM_PCB::ParsePolygons6Data( const CFB::CompoundFileReader& aReader, const ARULE6* clearanceRule = GetRuleDefault( ALTIUM_RULE_KIND::PLANE_CLEARANCE ); if( clearanceRule != nullptr ) - { zone->SetLocalClearance( clearanceRule->planeclearanceClearance ); - } const ARULE6* polygonConnectRule = GetRuleDefault( ALTIUM_RULE_KIND::POLYGON_CONNECT ); @@ -1488,7 +1491,7 @@ void ALTIUM_PCB::ParseRules6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading rules..." ); + m_progressReporter->Report( _( "Loading rules..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -1520,7 +1523,7 @@ void ALTIUM_PCB::ParseBoardRegionsData( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading board regions..." ); + m_progressReporter->Report( _( "Loading board regions..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -1542,7 +1545,7 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( const CFB::CompoundFileReader& aRe const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading zones..." ); + m_progressReporter->Report( _( "Loading zones..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -1562,9 +1565,10 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( const CFB::CompoundFileReader& aRe if( linechain.PointCount() < 2 ) { - wxLogError( wxString::Format( - _( "ShapeBasedRegion has only %d point extracted from %ld vertices. At least 2 points are required." ), - linechain.PointCount(), elem.outline.size() ) ); + wxLogError( _( "ShapeBasedRegion has only %d point extracted from %ld vertices. " + "At least 2 points are required." ), + linechain.PointCount(), + elem.outline.size() ); continue; } @@ -1590,11 +1594,12 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( const CFB::CompoundFileReader& aRe else { PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); + if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Zone on Altium layer %d has no KiCad " - "equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( _( "Zone found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + elem.layer ); klayer = Eco1_User; } zone->SetLayer( klayer ); @@ -1608,11 +1613,12 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( const CFB::CompoundFileReader& aRe if( elem.subpolyindex == ALTIUM_POLYGON_NONE ) { PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); + if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Polygon on Altium layer %d has no KiCad " - "equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( _( "Polygon found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + elem.layer ); klayer = Eco1_User; } @@ -1621,9 +1627,10 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( const CFB::CompoundFileReader& aRe if( linechain.PointCount() < 2 ) { - wxLogError( wxString::Format( _( "Polygon has only %d point extracted from %ld " - "vertices. At least 2 points are required." ), - linechain.PointCount(), elem.outline.size() ) ); + wxLogError( _( "Polygon has only %d point extracted from %ld vertices. At " + "least 2 points are required." ), + linechain.PointCount(), + elem.outline.size() ); continue; } @@ -1639,10 +1646,7 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( const CFB::CompoundFileReader& aRe } else { - wxLogError( wxString::Format( "Ignore polygon shape of kind %d on layer %s, because " - "not implemented yet", - elem.kind, - LSET::Name( GetKicadLayer( elem.layer ) ) ) ); + wxLogError( _( "Ignored polygon shape of kind %d (not yet supported)." ), elem.kind ); } } @@ -1656,7 +1660,7 @@ void ALTIUM_PCB::ParseRegions6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading zone fills..." ); + m_progressReporter->Report( _( "Loading zone fills..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -1675,9 +1679,10 @@ void ALTIUM_PCB::ParseRegions6Data( const CFB::CompoundFileReader& aReader, { if( m_polygons.size() <= elem.subpolyindex ) { - THROW_IO_ERROR( wxString::Format( - "Region stream tries to access polygon id %d of %d existing polygons", - elem.subpolyindex, m_polygons.size() ) ); + THROW_IO_ERROR( wxString::Format( "Region stream tries to access polygon id %d " + "of %d existing polygons.", + elem.subpolyindex, + m_polygons.size() ) ); } ZONE *zone = m_polygons.at( elem.subpolyindex ); @@ -1744,7 +1749,7 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading arcs..." ); + m_progressReporter->Report( _( "Loading arcs..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -1803,11 +1808,12 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, else { PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); + if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Arc Keepout on Altium layer %d has no " - "KiCad equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( _( "Arc keepout found on an Altium layer (%d) with no KiCad " + "equivalent. It has been moved to KiCad layer Eco1_User." ), + elem.layer ); klayer = Eco1_User; } zone->SetLayer( klayer ); @@ -1824,9 +1830,9 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Arc on Altium layer %d has no KiCad equivalent. " - "Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( _( "Arc found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + elem.layer ); klayer = Eco1_User; } @@ -1883,7 +1889,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading pads..." ); + m_progressReporter->Report( _( "Loading pads..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -1943,9 +1949,9 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, if( elem.layer != ALTIUM_LAYER::MULTI_LAYER ) { // TODO: I assume other values are possible as well? - wxLogError( wxString::Format( - "Pad '%s' of Footprint %s is not marked as multilayer, but it is an THT pad", - elem.name, footprint->GetReference() ) ); + wxLogError( _( "Footprint %s pad %s is not marked as multilayer, but is a TH pad." ), + footprint->GetReference(), + elem.name ); } pad->SetAttribute( elem.plated ? PAD_ATTRIB::PTH : PAD_ATTRIB::NPTH ); @@ -1963,10 +1969,9 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, break; case ALTIUM_PAD_HOLE_SHAPE::SQUARE: - wxLogWarning( wxString::Format( _( "Pad '%s' of Footprint %s has a square hole. " - "KiCad does not support this yet" ), - elem.name, - footprint->GetReference() ) ); + wxLogWarning( _( "Footprint %s pad %s has a square hole (not yet supported)." ), + footprint->GetReference(), + elem.name ); pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); pad->SetDrillSize( wxSize( elem.holesize, elem.holesize ) ); // Workaround // TODO: elem.sizeAndShape->slotsize was 0 in testfile. Either use holesize in this case or rect holes have a different id @@ -1977,6 +1982,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_OBLONG ); double normalizedSlotrotation = NormalizeAngleDegreesPos( elem.sizeAndShape->slotrotation ); + if( normalizedSlotrotation == 0. || normalizedSlotrotation == 180. ) { pad->SetDrillSize( wxSize( elem.sizeAndShape->slotsize, elem.holesize ) ); @@ -1985,12 +1991,11 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, { if( normalizedSlotrotation != 90. && normalizedSlotrotation != 270. ) { - wxLogWarning( wxString::Format( _( "Pad '%s' of Footprint %s has a " - "hole-rotation of %f degree. KiCad " - "only supports 90 degree angles" ), - elem.name, - footprint->GetReference(), - normalizedSlotrotation ) ); + wxLogWarning( _( "Footprint %s pad %s has a hole-rotation of %f " + "degrees. KiCad only supports 90 degree rotations." ), + footprint->GetReference(), + elem.name, + normalizedSlotrotation ); } pad->SetDrillSize( wxSize( elem.holesize, elem.sizeAndShape->slotsize ) ); @@ -2000,9 +2005,10 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, default: case ALTIUM_PAD_HOLE_SHAPE::UNKNOWN: - wxLogError( wxString::Format( - "Pad '%s' of Footprint %s uses a hole of unknown kind %d", elem.name, - footprint->GetReference(), elem.sizeAndShape->holeshape ) ); + wxLogError( _( "Footprint %s pad %s uses a hole of unknown kind %d." ), + footprint->GetReference(), + elem.name, + elem.sizeAndShape->holeshape ); pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); pad->SetDrillSize( wxSize( elem.holesize, elem.holesize ) ); // Workaround break; @@ -2017,9 +2023,9 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, if( elem.padmode != ALTIUM_PAD_MODE::SIMPLE ) { - wxLogWarning( wxString::Format( - _( "Pad '%s' of Footprint %s uses a complex pad stack (kind %d), which is not supported yet" ), - elem.name, footprint->GetReference(), elem.padmode ) ); + wxLogError( _( "Footprint %s pad %s uses a complex pad stack (not yet supported.)" ), + footprint->GetReference(), + elem.name ); } switch( elem.topshape ) @@ -2051,8 +2057,9 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, break; case ALTIUM_PAD_SHAPE::UNKNOWN: default: - wxLogError( wxString::Format( "Pad '%s' of Footprint %s uses a unknown pad-shape", - elem.name, footprint->GetReference() ) ); + wxLogError( _( "Footprint %s pad %s uses an unknown pad-shape." ), + footprint->GetReference(), + elem.name ); break; } @@ -2109,31 +2116,28 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem ) if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Non-Copper Pad on Altium layer %d has no KiCad " - "equivalent. Put it on Eco1_User instead" ), - aElem.layer ) ); + wxLogWarning( _( "Non-copper pad %s found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + aElem.name, + aElem.layer ); klayer = Eco1_User; } if( aElem.net != ALTIUM_NET_UNCONNECTED ) { - wxLogError( wxString::Format( "Non-Copper Pad '%s' is connected to a net. This is not " - "supported", - aElem.name ) ); + wxLogError( _( "Non-copper pad %s is connected to a net, which is not supported." ), + aElem.name ); } if( aElem.holesize != 0 ) { - wxLogError( wxString::Format( _( "Non-Copper Pad '%s' has a hole. This should not happen" ), - aElem.name ) ); + wxLogError( _( "Non-copper pad %s has a hole, which is not supported." ), aElem.name ); } if( aElem.padmode != ALTIUM_PAD_MODE::SIMPLE ) { - wxLogWarning( wxString::Format( _( "Non-Copper Pad '%s' uses a complex pad stack (kind %d). " - "This should not happen" ), - aElem.name, - aElem.padmode ) ); + wxLogWarning( _( "Non-copper pad %s has a complex pad stack (not yet supported)." ), + aElem.name ); } switch( aElem.topshape ) @@ -2286,8 +2290,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem ) case ALTIUM_PAD_SHAPE::UNKNOWN: default: - wxLogError( - wxString::Format( "Non-Copper Pad '%s' uses a unknown pad-shape", aElem.name ) ); + wxLogError( _( "Non-copper pad %s uses an unknown pad-shape." ), aElem.name ); break; } } @@ -2296,7 +2299,7 @@ void ALTIUM_PCB::ParseVias6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading vias..." ); + m_progressReporter->Report( _( "Loading vias..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -2334,11 +2337,13 @@ void ALTIUM_PCB::ParseVias6Data( const CFB::CompoundFileReader& aReader, PCB_LAYER_ID start_klayer = GetKicadLayer( elem.layer_start ); PCB_LAYER_ID end_klayer = GetKicadLayer( elem.layer_end ); + if( !IsCopperLayer( start_klayer ) || !IsCopperLayer( end_klayer ) ) { - wxLogError( wxString::Format( - "Via from layer %d <-> %d uses non-copper layer. This should not happen.", - elem.layer_start, elem.layer_end ) ); + wxLogError( _( "Via from layer %d to %d uses a non-copper layer, which is not " + "supported." ), + elem.layer_start, + elem.layer_end ); continue; // just assume through-hole instead. } @@ -2356,7 +2361,7 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading tracks..." ); + m_progressReporter->Report( _( "Loading tracks..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -2401,11 +2406,12 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader, else { PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); + if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Track Keepout on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( _( "Track keepout found on an Altium layer (%d) with no KiCad " + "equivalent. It has been moved to KiCad layer Eco1_User." ), + elem.layer ); klayer = Eco1_User; } zone->SetLayer( klayer ); @@ -2421,9 +2427,9 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader, if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Track on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( _( "Track found on an Altium layer (%d) with no KiCadequivalent. " + "It has been moved to KiCad layer Eco1_User." ), + elem.layer ); klayer = Eco1_User; } @@ -2462,7 +2468,7 @@ void ALTIUM_PCB::ParseTexts6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading text..." ); + m_progressReporter->Report( _( "Loading text..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -2473,9 +2479,8 @@ void ALTIUM_PCB::ParseTexts6Data( const CFB::CompoundFileReader& aReader, if( elem.fonttype == ALTIUM_TEXT_TYPE::BARCODE ) { - wxLogWarning( wxString::Format( - _( "Ignore Barcode on Altium layer %d because it is not supported right now." ), - elem.layer ) ); + wxLogError( _( "Ignored barcode on Altium layer %d (not yet supported)." ), + elem.layer ); continue; } @@ -2562,9 +2567,9 @@ void ALTIUM_PCB::ParseTexts6Data( const CFB::CompoundFileReader& aReader, if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Text on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( _( "Text found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + elem.layer ); klayer = Eco1_User; } @@ -2648,7 +2653,7 @@ void ALTIUM_PCB::ParseFills6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) { if( m_progressReporter ) - m_progressReporter->Report( "Loading rectangles..." ); + m_progressReporter->Report( _( "Loading rectangles..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); @@ -2665,11 +2670,12 @@ void ALTIUM_PCB::ParseFills6Data( const CFB::CompoundFileReader& aReader, wxPoint center( ( elem.pos1.x + elem.pos2.x ) / 2, ( elem.pos1.y + elem.pos2.y ) / 2 ); PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); + if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( _( "Fill on Altium layer %d has no KiCad equivalent. " - "Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( _( "Fill found on an Altium layer (%d) with no KiCad equivalent. " + "It has been moved to KiCad layer Eco1_User." ), + elem.layer ); klayer = Eco1_User; } diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 4bac908eee..38435975ef 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -1171,9 +1171,9 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, //log warnings: if( m_padcodesTested.find( csPadcode.ID ) == m_padcodesTested.end() && !errorMSG.IsEmpty() ) { - wxLogError( wxString::Format( - _( "The CADSTAR pad definition '%s' has import errors: %s" ), - csPadcode.Name, errorMSG) ); + wxLogError( _( "The CADSTAR pad definition '%s' has import errors: %s" ), + csPadcode.Name, + errorMSG ); m_padcodesTested.insert( csPadcode.ID ); } @@ -1361,9 +1361,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions() default: // Radius and diameter dimensions are LEADERDIM (even if not actually leader) // Angular dimensions are always ANGLEDIM - wxLogError( wxString::Format( - _( "Unexpected Dimension type (ID %s). This was not imported" ), - csDim.ID ) ); + wxLogError( _( "Unexpected Dimension type (ID %s). This was not imported." ), + csDim.ID ); continue; } break; @@ -1497,10 +1496,9 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions() case DIMENSION::TYPE::ANGLEDIM: //TODO: update import when KiCad supports angular dimensions - wxLogError( wxString::Format( - _( "Dimension ID %s is an angular dimension which has no KiCad equivalent. " - "The object was not imported." ), - csDim.ID ) ); + wxLogError( _( "Dimension %s is an angular dimension which has no KiCad equivalent. " + "The object was not imported." ), + csDim.ID ); break; } } @@ -1915,11 +1913,10 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates() if( netid.IsEmpty() ) { - wxLogError( wxString::Format( - _( "The CADSTAR layer '%s' is defined as a power plane layer. However no " - "net with such name exists. The layer has been loaded but no copper zone " - "was created." ), - powerPlaneLayerName ) ); + wxLogError( _( "The CADSTAR layer '%s' is defined as a power plane layer. However no " + "net with such name exists. The layer has been loaded but no copper " + "zone was created." ), + powerPlaneLayerName ); } else { @@ -2387,12 +2384,13 @@ int CADSTAR_PCB_ARCHIVE_LOADER::loadNetVia( via->SetLocked( aCadstarVia.Fixed ); if( csViaCode.Shape.ShapeType != PAD_SHAPE_TYPE::CIRCLE ) - wxLogError( wxString::Format( - _( "The CADSTAR via code '%s' has different shape from a circle defined. " - "KiCad only supports circular vias so this via type has been changed to " - "be a via with circular shape of %.2f mm diameter." ), - csViaCode.Name, - (double) ( (double) getKiCadLength( csViaCode.Shape.Size ) / 1E6 ) ) ); + { + wxLogError( _( "The CADSTAR via code '%s' has different shape from a circle defined. " + "KiCad only supports circular vias so this via type has been changed to " + "be a via with circular shape of %.2f mm diameter." ), + csViaCode.Name, + (double) ( (double) getKiCadLength( csViaCode.Shape.Size ) / 1E6 ) ); + } via->SetWidth( getKiCadLength( csViaCode.Shape.Size ) ); diff --git a/pcbnew/plugins/fabmaster/import_fabmaster.cpp b/pcbnew/plugins/fabmaster/import_fabmaster.cpp index 969d8f6128..96c979a0d4 100644 --- a/pcbnew/plugins/fabmaster/import_fabmaster.cpp +++ b/pcbnew/plugins/fabmaster/import_fabmaster.cpp @@ -251,10 +251,10 @@ FABMASTER::section_type FABMASTER::detectType( size_t aOffset ) if( row1 == "LAYERSORT" ) return EXTRACT_FULL_LAYERS; - wxLogError - ( - wxString::Format( _( "Unknown FABMASTER section %s:%s at row %zu." ), row1.c_str(), - row2.c_str(), aOffset ) ); + wxLogError( _( "Unknown FABMASTER section %s:%s at row %zu." ), + row1.c_str(), + row2.c_str(), + aOffset ); return UNKNOWN_EXTRACT; } @@ -268,8 +268,9 @@ double FABMASTER::processScaleFactor( size_t aRow ) if( rows[aRow].size() < 11 ) { - wxLogError( wxString::Format( _( "Invalid row size in J row %zu. " - "Expecting 11 elements but found %zu" ), aRow, rows[aRow].size() ) ); + wxLogError( _( "Invalid row size in J row %zu. Expecting 11 elements but found %zu." ), + aRow, + rows[aRow].size() ); return -1.0; } @@ -290,7 +291,7 @@ double FABMASTER::processScaleFactor( size_t aRow ) if( retval < 1.0 ) { - wxLogError( _( "Could not find units value, defaulting to Mils" ) ); + wxLogError( _( "Could not find units value, defaulting to mils." ) ); retval = IU_PER_MILS; } @@ -315,7 +316,7 @@ int FABMASTER::getColFromName( size_t aRow, const std::string& aStr ) return i; } - THROW_IO_ERROR( wxString::Format( _( "Could not find column label %s" ), aStr.c_str() ) ); + THROW_IO_ERROR( wxString::Format( _( "Could not find column label %s." ), aStr.c_str() ) ); return -1; } @@ -359,8 +360,10 @@ size_t FABMASTER::processPadStackLayers( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -440,8 +443,10 @@ size_t FABMASTER::processPadStacks( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -490,9 +495,11 @@ size_t FABMASTER::processPadStacks( size_t aRow ) } catch( ... ) { - wxLogError( wxString::Format( _( "Expecting drill size value " - "but found %s!%s!%s at line %zu" ), - pad_shape.c_str(), pad_width.c_str(), pad_height.c_str(), rownum ) ); + wxLogError( _( "Expecting drill size value but found %s!%s!%s in row %zu." ), + pad_shape.c_str(), + pad_width.c_str(), + pad_height.c_str(), + rownum ); continue; } @@ -536,8 +543,10 @@ size_t FABMASTER::processPadStacks( size_t aRow ) } catch( ... ) { - wxLogError( wxString::Format( _( "Expecting pad size values " - "but found %s : %s at line %zu" ), pad_width.c_str(), pad_height.c_str(), rownum ) ); + wxLogError( _( "Expecting pad size values but found %s : %s in row %zu." ), + pad_width.c_str(), + pad_height.c_str(), + rownum ); continue; } @@ -556,7 +565,7 @@ size_t FABMASTER::processPadStacks( size_t aRow ) if( w > std::numeric_limits::max() || h > std::numeric_limits::max() ) { - wxLogError( wxString::Format( _( "Invalid pad size on line %zu" ), rownum ) ); + wxLogError( _( "Invalid pad size in row %zu." ), rownum ); continue; } @@ -591,8 +600,10 @@ size_t FABMASTER::processPadStacks( size_t aRow ) } catch( ... ) { - wxLogError( wxString::Format( _( "Expecting pad offset values " - "but found %s : %s at line %zu" ), pad_xoff.c_str(), pad_yoff.c_str(), rownum ) ); + wxLogError( _( "Expecting pad offset values but found %s:%s in row %zu." ), + pad_xoff.c_str(), + pad_yoff.c_str(), + rownum ); continue; } @@ -634,8 +645,10 @@ size_t FABMASTER::processPadStacks( size_t aRow ) } else { - wxLogError( wxString::Format( _( "Unknown pad shape name '%s' on layer '%s' at line %zu" ), - pad_shape.c_str(), pad_layer.c_str(), rownum ) ); + wxLogError( _( "Unknown pad shape name '%s' on layer '%s' in row %zu." ), + pad_shape.c_str(), + pad_layer.c_str(), + rownum ); continue; } } @@ -670,8 +683,10 @@ size_t FABMASTER::processSimpleLayers( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -819,8 +834,10 @@ size_t FABMASTER::processLayers( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -904,8 +921,10 @@ size_t FABMASTER::processCustomPads( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -948,9 +967,9 @@ size_t FABMASTER::processCustomPads( size_t aRow ) if( std::sscanf( pad_record_tag.c_str(), "%d %d", &id, &seq ) != 2 ) { - wxLogError( wxString::Format( _( "Invalid format for id string \"%s\" " - "in custom pad row %zu" ), - pad_record_tag.c_str(), rownum ) ); + wxLogError( _( "Invalid format for id string '%s' in custom pad row %zu." ), + pad_record_tag.c_str(), + rownum ); continue; } @@ -989,14 +1008,16 @@ size_t FABMASTER::processCustomPads( size_t aRow ) if( !retval.second ) { - wxLogError( wxString::Format( _( "Could not insert graphical item %d into padstack \"%s\"" ), - seq, pad_stack_name.c_str() ) ); + wxLogError( _( "Could not insert graphical item %d into padstack '%s'." ), + seq, + pad_stack_name.c_str() ); } } else { - wxLogError( wxString::Format( _( "Unrecognized pad shape primitive \"%s\" in line %zu." ), - gr_data.graphic_dataname, rownum ) ); + wxLogError( _( "Unrecognized pad shape primitive '%s' in row %zu." ), + gr_data.graphic_dataname, + rownum ); } } @@ -1101,8 +1122,7 @@ FABMASTER::GRAPHIC_TEXT* FABMASTER::processText( const FABMASTER::GRAPHIC_DATA& if( toks.size() < 8 ) { // We log the error here but continue in the case of too few tokens - wxLogError( wxString::Format( _( "Invalid token count." - " Expected 8 but found %zu" ), toks.size() ) ); + wxLogError( _( "Invalid token count. Expected 8 but found %zu." ), toks.size() ); new_text->height = 0; new_text->width = 0; new_text->ital = false; @@ -1205,8 +1225,10 @@ size_t FABMASTER::processGeometry( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -1235,9 +1257,9 @@ size_t FABMASTER::processGeometry( size_t aRow ) if( std::sscanf( geo_tag.c_str(), "%d %d %d", &id, &seq, &subseq ) < 2 ) { - wxLogError( wxString::Format( _( "Invalid format for record_tag string \"%s\" " - "in Geometric definition row %zu" ), - geo_tag.c_str(), rownum ) ); + wxLogError( _( "Invalid format for record_tag string '%s' in row %zu." ), + geo_tag.c_str(), + rownum ); continue; } @@ -1245,9 +1267,10 @@ size_t FABMASTER::processGeometry( size_t aRow ) if( !gr_item ) { - wxLogDebug( wxString::Format( _( "Unhandled graphic item '%s' " - "in Geometric definition row %zu" ), - gr_data.graphic_dataname.c_str(), geo_tag.c_str(), rownum ) ); + wxLogDebug( "Unhandled graphic item '%s' in row %zu.", + gr_data.graphic_dataname.c_str(), + geo_tag.c_str(), + rownum ); continue; } @@ -1327,8 +1350,10 @@ size_t FABMASTER::processVias( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -1392,8 +1417,10 @@ size_t FABMASTER::processTraces( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -1419,9 +1446,9 @@ size_t FABMASTER::processTraces( size_t aRow ) if( std::sscanf( geo_tag.c_str(), "%d %d %d", &id, &seq, &subseq ) < 2 ) { - wxLogError( wxString::Format( _( "Invalid format for record_tag string \"%s\" " - "in Traces definition row %zu" ), - geo_tag.c_str(), rownum ) ); + wxLogError( _( "Invalid format for record_tag string '%s' in row %zu." ), + geo_tag.c_str(), + rownum ); continue; } @@ -1429,9 +1456,9 @@ size_t FABMASTER::processTraces( size_t aRow ) if( !gr_item ) { - wxLogDebug( wxString::Format( _( "Unhandled graphic item '%s' " - "in Traces definition row %zu" ), - gr_data.graphic_dataname.c_str(), rownum ) ); + wxLogDebug( _( "Unhandled graphic item '%s' in row %zu." ), + gr_data.graphic_dataname.c_str(), + rownum ); continue; } @@ -1460,8 +1487,10 @@ size_t FABMASTER::processTraces( size_t aRow ) if( !gr_result.second ) { - wxLogError( wxString::Format( _( "Duplicate item for ID %d and sequence %d " - "in Traces definition row %zu \n" ), id, seq, rownum ) ); + wxLogError( _( "Duplicate item for ID %d and sequence %d in row %zu." ), + id, + seq, + rownum ); } } @@ -1473,8 +1502,10 @@ size_t FABMASTER::processTraces( size_t aRow ) if( !gr_result.second ) { - wxLogError( wxString::Format( _( "Duplicate item for ID %d and sequence %d " - "in Traces definition row %zu \n" ), id, seq, rownum ) ); + wxLogError( _( "Duplicate item for ID %d and sequence %d in row %zu." ), + id, + seq, + rownum ); } } } @@ -1555,8 +1586,10 @@ size_t FABMASTER::processFootprints( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -1632,8 +1665,10 @@ size_t FABMASTER::processPins( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -1697,8 +1732,10 @@ size_t FABMASTER::processNets( size_t aRow ) if( row.size() != header.size() ) { - wxLogError( wxString::Format( _( "Invalid row size in row %zu. " - "Expecting %zu elements but found %zu" ), rownum, header.size(), row.size() ) ); + wxLogError( _( "Invalid row size in row %zu. Expecting %zu elements but found %zu." ), + rownum, + header.size(), + row.size() ); continue; } @@ -2278,9 +2315,9 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) if( poly_outline.OutlineCount() < 1 || poly_outline.Outline( 0 ).PointCount() < 3 ) { - wxLogError( wxString::Format( - _( "Invalid custom pad named '%s'. Replacing with circular pad." ), - custom_name.c_str() ) ); + wxLogError( _( "Invalid custom pad '%s'. Replacing with " + "circular pad." ), + custom_name.c_str() ); newpad->SetShape( PAD_SHAPE::CIRCLE ); } else @@ -2307,16 +2344,16 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) if( mergedPolygon.OutlineCount() > 1 ) { - wxLogError( wxString::Format( - _( "Invalid custom pad named '%s'. Replacing with circular pad." ), - custom_name.c_str() ) ); + wxLogError( _( "Invalid custom pad '%s'. Replacing with " + "circular pad." ), + custom_name.c_str() ); newpad->SetShape( PAD_SHAPE::CIRCLE ); } } else { - wxLogError( wxString::Format( _( "Could not find custom pad named %s" ), - custom_name.c_str() ) ); + wxLogError( _( "Could not find custom pad '%s'." ), + custom_name.c_str() ); } } else @@ -2515,8 +2552,8 @@ bool FABMASTER::loadEtch( BOARD* aBoard, const std::unique_ptr } else { - wxLogError( wxString::Format( _( "Expecting etch data to be on copper layer. " - "Row found on layer '%s'" ), seg->layer.c_str() ) ); + wxLogError( _( "Expecting etch data to be on copper layer. Row found on layer '%s'" ), + seg->layer.c_str() ); } } diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 94a0b867b8..28b9ee7041 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -3990,13 +3990,10 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) case T_net: if( ! pad->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) ) { - wxLogError( wxString::Format( _( "Invalid net ID in\n" - "file: '%s'\n" - "line: %d\n" - "offset: %d" ), - CurSource(), - CurLineNumber(), - CurOffset() ) ); + wxLogError( _( "Invalid net ID in\nfile: %s\nline: %d offset: %d" ), + CurSource(), + CurLineNumber(), + CurOffset() ); } NeedSYMBOLorNUMBER(); @@ -4014,13 +4011,10 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) if( netName != m_board->FindNet( pad->GetNetCode() )->GetNetname() ) { pad->SetNetCode( NETINFO_LIST::ORPHANED, /* aNoAssert */ true ); - wxLogError( wxString::Format( _( "Net name doesn't match net ID in\n" - "file: '%s'\n" - "line: %d\n" - "offset: %d" ), - CurSource(), - CurLineNumber(), - CurOffset() ) ); + wxLogError( _( "Net name doesn't match ID in\nfile: %s\nline: %d offset: %d" ), + CurSource(), + CurLineNumber(), + CurOffset() ); } } diff --git a/pcbnew/router/pns_solid.cpp b/pcbnew/router/pns_solid.cpp index da5d39985d..4dc357be5d 100644 --- a/pcbnew/router/pns_solid.cpp +++ b/pcbnew/router/pns_solid.cpp @@ -82,8 +82,9 @@ static const SHAPE_LINE_CHAIN buildHullForPrimitiveShape( const SHAPE* aShape, i } default: { - wxLogError( "Unsupported hull shape: %d (%s)", aShape->Type(), - SHAPE_TYPE_asString( aShape->Type() ) ); + wxFAIL_MSG( wxString::Format( "Unsupported hull shape: %d (%s).", + aShape->Type(), + SHAPE_TYPE_asString( aShape->Type() ) ) ); break; } } diff --git a/scripting/python_scripting.cpp b/scripting/python_scripting.cpp index 8bf3ac8b06..454e1d4a13 100644 --- a/scripting/python_scripting.cpp +++ b/scripting/python_scripting.cpp @@ -205,7 +205,7 @@ bool SCRIPTING::scriptingSetup() // Ensure the user plugin path exists, and create it if not. // However, if it cannot be created, this is not a fatal error. if( !path.DirExists() && !path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) ) - wxLogError( "Warning: could not create user scripting path %s", path.GetPath() ); + wxLogError( _( "Could not create user scripting path %s." ), path.GetPath() ); return true; } @@ -324,7 +324,7 @@ void UpdatePythonEnvVar( const wxString& aVar, const wxString& aValue ) int retv = PyRun_SimpleString( cmd ); if( retv != 0 ) - wxLogError( "Python error %d occurred running command:\n\n`%s`", retv, cmd ); + wxLogError( "Python error %d running command:\n\n`%s`", retv, cmd ); }