The REPORTER interface is inherently line-based.

Also fixes a bunch of error messages that were similar but not
identical (which just increases translation burden).

Fixes https://gitlab.com/kicad/code/kicad/issues/8723
This commit is contained in:
Jeff Young 2021-07-05 13:40:38 +01:00
parent 6cc564aead
commit ea6769b702
20 changed files with 71 additions and 76 deletions

View File

@ -411,7 +411,7 @@ void EDA_3D_CANVAS::DoRePaint()
if( !m_is_opengl_version_supported )
{
warningReporter.Report( _( "Your OpenGL version is not supported. Minimum required "
"is 1.5" ), RPT_SEVERITY_ERROR );
"is 1.5." ), RPT_SEVERITY_ERROR );
warningReporter.Finalize();
}

View File

@ -336,7 +336,7 @@ bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
{
if( aReporter )
{
msg.Printf( _( "Output directory '%s' created.\n" ), outputPath );
msg.Printf( _( "Output directory '%s' created." ), outputPath );
aReporter->Report( msg, RPT_SEVERITY_INFO );
return true;
}
@ -345,7 +345,7 @@ bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
{
if( aReporter )
{
msg.Printf( _( "Cannot create output directory '%s'.\n" ), outputPath );
msg.Printf( _( "Cannot create output directory '%s'." ), outputPath );
aReporter->Report( msg, RPT_SEVERITY_ERROR );
}

View File

@ -88,7 +88,7 @@ bool PROJECT_ARCHIVER::Unarchive( const wxString& aSrcFile, const wxString& aDes
if( !stream.IsOk() )
{
aReporter.Report( _( "Could not open archive file\n" ), RPT_SEVERITY_ERROR );
aReporter.Report( _( "Could not open archive file." ), RPT_SEVERITY_ERROR );
return false;
}
@ -97,7 +97,7 @@ bool PROJECT_ARCHIVER::Unarchive( const wxString& aSrcFile, const wxString& aDes
if( !archiveClassFactory )
{
aReporter.Report( _( "Invalid archive file format\n" ), RPT_SEVERITY_ERROR );
aReporter.Report( _( "Invalid archive file format." ), RPT_SEVERITY_ERROR );
return false;
}
@ -108,7 +108,7 @@ bool PROJECT_ARCHIVER::Unarchive( const wxString& aSrcFile, const wxString& aDes
for( wxArchiveEntry* entry = archiveStream->GetNextEntry(); entry;
entry = archiveStream->GetNextEntry() )
{
fileStatus.Printf( _( "Extracting file '%s'.\n" ), entry->GetName() );
fileStatus.Printf( _( "Extracting file '%s'." ), entry->GetName() );
aReporter.Report( fileStatus, RPT_SEVERITY_INFO );
wxString fullname = aDestDir + entry->GetName();
@ -148,10 +148,10 @@ bool PROJECT_ARCHIVER::Unarchive( const wxString& aSrcFile, const wxString& aDes
if( CopyStreamData( *archiveStream, outputFileStream, entry->GetSize() ) )
outputFileStream.Commit();
else
aReporter.Report( _( "Error extracting file!\n" ), RPT_SEVERITY_ERROR );
aReporter.Report( _( "Error extracting file!" ), RPT_SEVERITY_ERROR );
}
aReporter.Report( wxT( "Extracted project\n" ), RPT_SEVERITY_INFO );
aReporter.Report( wxT( "Extracted project." ), RPT_SEVERITY_INFO );
return true;
}
@ -205,7 +205,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
if( !ostream.IsOk() ) // issue to create the file. Perhaps not writable dir
{
msg.Printf( _( "Unable to create archive file '%s'.\n" ), aDestFile );
msg.Printf( _( "Failed to create file '%s'." ), aDestFile );
aReporter.Report( msg, RPT_SEVERITY_ERROR );
return false;
}
@ -251,7 +251,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
if( aVerbose )
{
msg.Printf( _( "Archived file '%s'.\n" ), currFilename );
msg.Printf( _( "Archived file '%s'." ), currFilename );
aReporter.Report( msg, RPT_SEVERITY_INFO );
}
@ -261,7 +261,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
{
if( aVerbose )
{
msg.Printf( _( "Failed to archive file '%s'.\n" ), currFilename );
msg.Printf( _( "Failed to archive file '%s'." ), currFilename );
aReporter.Report( msg, RPT_SEVERITY_ERROR );
}
@ -287,7 +287,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
if( zipstream.Close() )
{
msg.Printf( _( "Zip archive '%s' created (%s uncompressed, %s compressed).\n" ),
msg.Printf( _( "Zip archive '%s' created (%s uncompressed, %s compressed)." ),
aDestFile,
reportSize( uncompressedBytes ),
reportSize( zipBytesCnt ) );
@ -295,7 +295,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
}
else
{
msg.Printf( wxT( "Unable to create archive '%s'.\n" ), aDestFile );
msg.Printf( wxT( "Failed to create file '%s'." ), aDestFile );
aReporter.Report( msg, RPT_SEVERITY_ERROR );
success = false;
}

View File

@ -45,7 +45,7 @@ REPORTER& WX_TEXT_CTRL_REPORTER::Report( const wxString& aText, SEVERITY aSeveri
wxCHECK_MSG( m_textCtrl != NULL, *this,
wxT( "No wxTextCtrl object defined in WX_TEXT_CTRL_REPORTER." ) );
m_textCtrl->AppendText( aText );
m_textCtrl->AppendText( aText + wxS( "\n" ) );
return *this;
}
@ -59,7 +59,7 @@ REPORTER& WX_STRING_REPORTER::Report( const wxString& aText, SEVERITY aSeverity
wxCHECK_MSG( m_string != NULL, *this,
wxT( "No wxString object defined in WX_STRING_REPORTER." ) );
*m_string << aText;
*m_string << aText << wxS( "\n" );
return *this;
}

View File

@ -280,28 +280,36 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
continue;
if( symbol->GetUnitCount() > 1 )
msg.Printf( _( "Updated %s (unit %s) from %s to %s" ),
{
msg.Printf( _( "Updated %s (unit %s) from %s to %s." ),
symbol->GetValue( sheet, true ),
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
prevRef,
newRef );
}
else
msg.Printf( _( "Updated %s from %s to %s" ),
{
msg.Printf( _( "Updated %s from %s to %s." ),
symbol->GetValue( sheet, true ),
prevRef,
newRef );
}
}
else
{
if( symbol->GetUnitCount() > 1 )
msg.Printf( _( "Annotated %s (unit %s) as %s" ),
{
msg.Printf( _( "Annotated %s (unit %s) as %s." ),
symbol->GetValue( sheet, true ),
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
newRef );
}
else
msg.Printf( _( "Annotated %s as %s" ),
{
msg.Printf( _( "Annotated %s as %s." ),
symbol->GetValue( sheet, true ),
newRef );
}
}
aReporter.Report( msg, RPT_SEVERITY_ACTION );

View File

@ -752,12 +752,12 @@ void DIALOG_ERC::OnSaveReport( wxCommandEvent& aEvent )
if( writeReport( fn.GetFullPath() ) )
{
m_messages->Report( wxString::Format( _( "Report file '%s' created\n" ),
m_messages->Report( wxString::Format( _( "Report file '%s' created." ),
fn.GetFullPath() ) );
}
else
{
DisplayError( this, wxString::Format( _( "Unable to create report file '%s'" ),
DisplayError( this, wxString::Format( _( "Failed to create file '%s'." ),
fn.GetFullPath() ) );
}
}

View File

@ -115,12 +115,10 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
if( aReporter )
{
wxArrayString output, errors;
int diag = wxExecute( commandLine, output, errors, m_exec_flags );
int diag = wxExecute( commandLine, output, errors, m_exec_flags );
wxString msg;
wxString msg;
msg << _( "Run command:" ) << wxT( "\n" ) << commandLine << wxT( "\n\n" );
aReporter->ReportHead( msg, RPT_SEVERITY_ACTION );
aReporter->ReportHead( commandLine, RPT_SEVERITY_ACTION );
if( diag != 0 )
{
@ -134,22 +132,14 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
if( output.GetCount() )
{
msg.Empty();
msg << wxT( "\n" ) << _( "Info messages:" ) << wxT( "\n" );
aReporter->Report( msg, RPT_SEVERITY_INFO );
for( unsigned ii = 0; ii < output.GetCount(); ii++ )
aReporter->Report( output[ii] + wxT( "\n" ), RPT_SEVERITY_INFO );
aReporter->Report( output[ii], RPT_SEVERITY_INFO );
}
if( errors.GetCount() )
{
msg.Empty();
msg << wxT("\n") << _( "Error messages:" ) << wxT( "\n" );
aReporter->Report( msg, RPT_SEVERITY_INFO );
for( unsigned ii = 0; ii < errors.GetCount(); ii++ )
aReporter->Report( errors[ii] + wxT( "\n" ), RPT_SEVERITY_ERROR );
aReporter->Report( errors[ii], RPT_SEVERITY_ERROR );
}
}
else

View File

@ -201,7 +201,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
if( !SaveDrawingSheetFile( filename ) )
{
msg.Printf( _( "Unable to create \"%s\"" ), filename );
msg.Printf( _( "Failed to create file '%s'." ), filename );
DisplayErrorMessage( this, msg );
}

View File

@ -663,7 +663,7 @@ void DIALOG_DRC::OnSaveReport( wxCommandEvent& aEvent )
}
else
{
DisplayError( this, wxString::Format( _( "Unable to create report file '%s'<br>" ),
DisplayError( this, wxString::Format( _( "Failed to create file '%s'." ),
fn.GetFullPath() ) );
}
}

View File

@ -220,7 +220,7 @@ void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event )
if( !Export_IDF3( GetBoard(), fullFilename, thou, aXRef, aYRef ) )
{
wxString msg = wxString::Format( _( "Unable to create %s" ), fullFilename );
wxString msg = wxString::Format( _( "Failed to create file '%s'." ), fullFilename );
wxMessageBox( msg );
return;
}

View File

@ -293,7 +293,7 @@ void DIALOG_EXPORT_SVG::ExportSVGFile( bool aOnlyOneFile )
}
else // Error
{
reporter.Report( wxString::Format( _( "Unable to create '%s'." ), svgPath ),
reporter.Report( wxString::Format( _( "Failed to create file '%s'." ), svgPath ),
RPT_SEVERITY_ERROR );
}

View File

@ -463,12 +463,12 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
if( ! success )
{
msg.Printf( _( "** Unable to create %s **\n" ), dlg.GetPath() );
msg.Printf( _( "Failed to create file '%s'." ), dlg.GetPath() );
m_messagesBox->AppendText( msg );
}
else
{
msg.Printf( _( "Report file %s created\n" ), dlg.GetPath() );
msg.Printf( _( "Report file '%s' created." ), dlg.GetPath() );
m_messagesBox->AppendText( msg );
}
}

View File

@ -249,7 +249,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
if( !file )
{
DisplayError( this, wxString::Format( _( "Unable to create \"%s\"" ),
DisplayError( this, wxString::Format( _( "Failed to create file '%s'." ),
optionsDialog.GetFileName() ) );
return;
}

View File

@ -187,11 +187,12 @@ private:
if( m_reporter )
{
m_reporter->Report(
_( "File contains pad shapes that are not supported by the Hyperlynx exporter\n"
"(Supported shapes are oval, rectangle, circle.)\n"
"They have been exported as oval pads." ),
RPT_SEVERITY_WARNING );
m_reporter->Report( _( "File contains pad shapes that are not supported by the "
"Hyperlynx exporter (supported shapes are oval, rectangle "
"and circle)." ),
RPT_SEVERITY_WARNING );
m_reporter->Report( _( "They have been exported as oval pads." ),
RPT_SEVERITY_INFO );
}
break;
}

View File

@ -269,7 +269,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
if( fpcount < 0 )
{
msg.Printf( _( "Unable to create '%s'." ), fn.GetFullPath() );
msg.Printf( _( "Failed to create file '%s'." ), fn.GetFullPath() );
wxMessageBox( msg );
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
return false;
@ -301,14 +301,13 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
m_reporter->Report( msg, RPT_SEVERITY_INFO );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
fullcount += fpcount;
msg.Printf( _( "Full component count: %d.\n" ), fullcount );
msg.Printf( _( "Full component count: %d." ), fullcount );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
m_reporter->Report( _( "File generation successful." ), RPT_SEVERITY_ACTION );
m_reporter->Report( _( "File generation successful." ), RPT_SEVERITY_INFO );
return true;
}
@ -384,7 +383,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
useCSVfmt, useAuxOrigin );
if( fpcount < 0 )
{
msg.Printf( _( "Unable to create '%s'." ), fn.GetFullPath() );
msg.Printf( _( "Failed to create file '%s'." ), fn.GetFullPath() );
wxMessageBox( msg );
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
return false;
@ -393,8 +392,8 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
if( singleFile )
msg.Printf( _( "Placement file: '%s'." ), fn.GetFullPath() );
else
msg.Printf( _( "Front (top side) placement file: '%s'." ),
fn.GetFullPath() );
msg.Printf( _( "Front (top side) placement file: '%s'." ), fn.GetFullPath() );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
msg.Printf( _( "Component count: %d." ), fpcount );
@ -402,7 +401,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
if( singleFile )
{
m_reporter->Report( _( "File generation successful." ), RPT_SEVERITY_ACTION );
m_reporter->Report( _( "File generation successful." ), RPT_SEVERITY_INFO );
return true;
}
@ -440,18 +439,17 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
m_reporter->Report( msg, RPT_SEVERITY_INFO );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
}
if( !singleFile )
{
fullcount += fpcount;
msg.Printf( _( "Full component count: %d.\n" ), fullcount );
msg.Printf( _( "Full component count: %d." ), fullcount );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
}
m_reporter->Report( _( "File generation successful." ), RPT_SEVERITY_ACTION );
m_reporter->Report( _( "File generation successful." ), RPT_SEVERITY_INFO );
return true;
}
@ -529,7 +527,7 @@ void PCB_EDIT_FRAME::GenFootprintsReport( wxCommandEvent& event )
else
{
msg.Printf( _( "Unable to create '%s'." ), fn.GetFullPath() );
msg.Printf( _( "Failed to create file '%s'." ), fn.GetFullPath() );
DisplayError( this, msg );
}
}

View File

@ -112,8 +112,8 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
{
if( aReporter )
{
msg.Printf( _( "** Unable to create %s **\n" ), fullFilename );
aReporter->Report( msg );
msg.Printf( _( "Failed to create file '%s'." ), fullFilename );
aReporter->Report( msg, RPT_SEVERITY_ERROR );
}
break;
}
@ -122,7 +122,7 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
if( aReporter )
{
msg.Printf( _( "Created file '%s'" ), fullFilename );
aReporter->Report( msg );
aReporter->Report( msg, RPT_SEVERITY_INFO );
}
}

View File

@ -341,8 +341,8 @@ void GENDRILL_WRITER_BASE::CreateMapFilesSet( const wxString& aPlotDirectory,
{
if( aReporter )
{
msg.Printf( _( "** Unable to create %s **\n" ), fullfilename );
aReporter->Report( msg );
msg.Printf( _( "Failed to create file '%s'." ), fullfilename );
aReporter->Report( msg, RPT_SEVERITY_ERROR );
}
return;
@ -352,7 +352,7 @@ void GENDRILL_WRITER_BASE::CreateMapFilesSet( const wxString& aPlotDirectory,
if( aReporter )
{
msg.Printf( _( "Created file '%s'." ), fullfilename );
aReporter->Report( msg );
aReporter->Report( msg, RPT_SEVERITY_INFO );
}
}
}

View File

@ -101,8 +101,8 @@ void GERBER_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, b
{
if( aReporter )
{
msg.Printf( _( "** Unable to create %s **\n" ), fullFilename );
aReporter->Report( msg );
msg.Printf( _( "Failed to create file '%s'." ), fullFilename );
aReporter->Report( msg, RPT_SEVERITY_ERROR );
}
break;
}
@ -111,7 +111,7 @@ void GERBER_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, b
if( aReporter )
{
msg.Printf( _( "Created file '%s'." ), fullFilename );
aReporter->Report( msg );
aReporter->Report( msg, RPT_SEVERITY_INFO );
}
}

View File

@ -149,13 +149,13 @@ bool GERBER_JOBFILE_WRITER::CreateJobFile( const wxString& aFullFilename )
{
if( m_reporter )
{
msg.Printf( _( "Unable to create job file '%s'." ), aFullFilename );
msg.Printf( _( "Failed to create file '%s'." ), aFullFilename );
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
}
}
else if( m_reporter )
{
msg.Printf( _( "Create Gerber job file '%s'." ), aFullFilename );
msg.Printf( _( "Created Gerber job file '%s'." ), aFullFilename );
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
}
@ -572,9 +572,7 @@ void GERBER_JOBFILE_WRITER::addJSONMaterialStackup()
bool uptodate = not brd_stackup.SynchronizeWithBoard( &m_pcb->GetDesignSettings() );
if( !uptodate && m_pcb->GetDesignSettings().m_HasStackup )
m_reporter->Report( _( "Board stackup settings not up to date\n"
"Please fix the stackup" ),
RPT_SEVERITY_ERROR );
m_reporter->Report( _( "Board stackup settings not up to date." ), RPT_SEVERITY_ERROR );
PCB_LAYER_ID last_copper_layer = F_Cu;

View File

@ -152,7 +152,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
// The FPID is ok as long as there is a footprint portion coming from eeschema.
if( !component->GetFPID().GetLibItemName().size() )
{
msg.Printf( _( "No footprint defined for symbol %s.\n" ),
msg.Printf( _( "No footprint defined for symbol %s." ),
component->GetReference() );
aReporter.Report( msg, RPT_SEVERITY_ERROR );
@ -220,7 +220,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
else
{
msg.Printf( _( "%s footprint '%s' not found in any libraries in the footprint "
"library table.\n" ),
"library table." ),
component->GetReference(),
component->GetFPID().GetLibItemName().wx_str() );
aReporter.Report( msg, RPT_SEVERITY_ERROR );