From 7b5318ff641bb984bf3d48710f754c3f79aa9258 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 31 Oct 2014 19:59:37 +0100 Subject: [PATCH] Fix minor issues about translated strings and coding style. Add comment relative to file function info in X1 gerber file format. --- common/common_plotGERBER_functions.cpp | 3 +-- eeschema/plot_schematic_DXF.cpp | 4 ++-- eeschema/plot_schematic_HPGL.cpp | 4 ++-- eeschema/plot_schematic_PDF.cpp | 4 ++-- eeschema/plot_schematic_PS.cpp | 4 ++-- eeschema/plot_schematic_SVG.cpp | 8 ++++---- pcbnew/pcbplot.cpp | 16 ++++++++++++---- pcbnew/pcbplot.h | 5 ++++- pcbnew/plot_board_layers.cpp | 8 ++++++-- pcbnew/tool_pcb.cpp | 4 ++-- 10 files changed, 37 insertions(+), 23 deletions(-) diff --git a/common/common_plotGERBER_functions.cpp b/common/common_plotGERBER_functions.cpp index 614e78520b..50d1802eb8 100644 --- a/common/common_plotGERBER_functions.cpp +++ b/common/common_plotGERBER_functions.cpp @@ -119,8 +119,7 @@ bool GERBER_PLOTTER::StartPlot() if( ! m_attribFunction.IsEmpty() ) { - fprintf( outputFile, "%%TF.FileFunction,%s*%%\n", - TO_UTF8( m_attribFunction ) ); + fprintf( outputFile, "%s\n", TO_UTF8( m_attribFunction ) ); } // Set coordinate format to 3.6 or 4.5 absolute, leading zero omitted diff --git a/eeschema/plot_schematic_DXF.cpp b/eeschema/plot_schematic_DXF.cpp index 17c25a309f..3786ee82de 100644 --- a/eeschema/plot_schematic_DXF.cpp +++ b/eeschema/plot_schematic_DXF.cpp @@ -98,9 +98,9 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef ) m_MessagesBox->AppendText( msg ); } - catch (IO_ERROR& e) + catch( IO_ERROR& e ) { - msg.Printf( _( "DXF Plotter Exception : '%s'"), wxString(e.errorText ) ); + msg.Printf( wxT( "DXF Plotter Exception : '%s'"), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); schframe->SetCurrentSheet( oldsheetpath ); schframe->GetCurrentSheet().UpdateAllScreenReferences(); diff --git a/eeschema/plot_schematic_HPGL.cpp b/eeschema/plot_schematic_HPGL.cpp index 89c6bea205..979e24f40f 100644 --- a/eeschema/plot_schematic_HPGL.cpp +++ b/eeschema/plot_schematic_HPGL.cpp @@ -195,9 +195,9 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef ) if( !aPlotAll ) break; } - catch (IO_ERROR& e) + catch( IO_ERROR& e ) { - msg.Printf( _( "HPGL Plotter Exception : '%s'"), wxString(e.errorText ) ); + msg.Printf( wxT( "HPGL Plotter Exception : '%s'"), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); } diff --git a/eeschema/plot_schematic_PDF.cpp b/eeschema/plot_schematic_PDF.cpp index f8fa9cc4c8..0d59493fc4 100644 --- a/eeschema/plot_schematic_PDF.cpp +++ b/eeschema/plot_schematic_PDF.cpp @@ -110,10 +110,10 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef ) first_page = false; } - catch (const IO_ERROR& e) + catch( const IO_ERROR& e ) { // Cannot plot PDF file - msg.Printf( _( "PDF Plotter Exception : <%s>"), wxString(e.errorText ) ); + msg.Printf( wxT( "PDF Plotter Exception : <%s>"), GetChars( e.errorText ) ); restoreEnvironment(plotter, oldsheetpath, msg); return; } diff --git a/eeschema/plot_schematic_PS.cpp b/eeschema/plot_schematic_PS.cpp index 6e97f31f08..ce221d6795 100644 --- a/eeschema/plot_schematic_PS.cpp +++ b/eeschema/plot_schematic_PS.cpp @@ -129,9 +129,9 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef ) m_MessagesBox->AppendText( msg ); } - catch (IO_ERROR& e) + catch( IO_ERROR& e ) { - msg.Printf( _( "PS Plotter Exception : '%s'"), wxString(e.errorText ) ); + msg.Printf( wxT( "PS Plotter Exception : '%s'"), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); } diff --git a/eeschema/plot_schematic_SVG.cpp b/eeschema/plot_schematic_SVG.cpp index a929b0271b..2f8a869678 100644 --- a/eeschema/plot_schematic_SVG.cpp +++ b/eeschema/plot_schematic_SVG.cpp @@ -101,10 +101,10 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef ) m_MessagesBox->AppendText( msg ); } - catch (const IO_ERROR& e) + catch( const IO_ERROR& e ) { // Cannot plot SVG file - msg.Printf( _( "SVG Plotter Exception : '%s'" ), wxString( e.errorText ) ); + msg.Printf( wxT( "SVG Plotter Exception : '%s'" ), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); m_parent->SetCurrentSheet( oldsheetpath ); @@ -143,10 +143,10 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef ) } m_MessagesBox->AppendText( msg ); } - catch (const IO_ERROR& e) + catch( const IO_ERROR& e ) { // Cannot plot SVG file - msg.Printf( _( "SVG Plotter Exception : <%s>"), wxString(e.errorText ) ); + msg.Printf( wxT( "SVG Plotter Exception : <%s>"), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); return; } diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index b252c882db..76028d145e 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -84,9 +84,10 @@ const wxString GetGerberExtension( LAYER_NUM aLayer ) } -wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer ) +wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer, + bool aUseX1CompatibilityMode ) { - wxString attrib = wxEmptyString; + wxString attrib; switch( aLayer ) { @@ -178,11 +179,18 @@ wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer ) attrib += wxString( wxT( ",Mixed" ) ); break; default: - ; // do nothing (but avoid a warning for unhandled LAYER_T values from GCC) + break; // do nothing (but avoid a warning for unhandled LAYER_T values from GCC) } } - return attrib; + wxString fileFct; + + if( aUseX1CompatibilityMode ) + fileFct.Printf( "G04 #@! TF.FileFunction,%s*", GetChars( attrib ) ); + else + fileFct.Printf( "%%TF.FileFunction,%s*%%", GetChars( attrib ) ); + + return fileFct; } diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 3ac861bbfa..3efcef7116 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -258,9 +258,12 @@ const wxString GetGerberExtension( LAYER_NUM aLayer ); * the "%TF.FileFunction" attribute prefix and the "*%" suffix. * @param aBoard = the board, needed to get the total count of copper layers * @param aLayer = the layer number to create the attribute for + * @param aUseX1CompatibilityMode = true to use a file function attribute like G04 comment + * , compatible with X1 (rx274) notation (G04#@!TF.FileFunction) * @return The attribute, as a text string */ -extern wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer ); +extern wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer, + bool aUseX1CompatibilityMode ); // PLOTGERB.CPP void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index e320209ece..865418f556 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -1005,8 +1005,12 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, if( plotter->OpenFile( aFullFileName ) ) { // For the Gerber "file function" attribute, set the layer number - if( plotter->GetPlotterType() == PLOT_FORMAT_GERBER && plotOpts.GetUseGerberAttributes() ) - plotter->SetLayerAttribFunction( GetGerberFileFunction( aBoard, aLayer ) ); + if( plotter->GetPlotterType() == PLOT_FORMAT_GERBER ) + { + bool useX2mode = plotOpts.GetUseGerberAttributes(); + plotter->SetLayerAttribFunction( GetGerberFileFunction( aBoard, aLayer, + useX2mode ? false : true ) ); + } plotter->StartPlot(); diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index e1ad70bd66..4ec9569bef 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -631,7 +631,7 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox() msg = _( "Track " ) + CoordinateToString( GetDesignSettings().m_TrackWidthList[ii], true ); if( ii == 0 ) - msg << _( " *" ); + msg << wxT( " *" ); m_SelTrackWidthBox->Append( msg ); } @@ -662,7 +662,7 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox() << CoordinateToString( GetDesignSettings().m_ViasDimensionsList[ii].m_Drill, true ); if( ii == 0 ) - msg << _( " *" ); + msg << wxT( " *" ); m_SelViaSizeBox->Append( msg ); }