diff --git a/common/jobs/job_export_pcb_plot.h b/common/jobs/job_export_pcb_plot.h index 2a25b641fa..81d1547f86 100644 --- a/common/jobs/job_export_pcb_plot.h +++ b/common/jobs/job_export_pcb_plot.h @@ -43,8 +43,8 @@ public: JOB_EXPORT_PCB_PLOT( PLOT_FORMAT aFormat, const std::string& aType, bool aOutputIsDirectory ); public: - wxString m_argLayers; - wxString m_argCommonLayers; + std::optional m_argLayers; + std::optional m_argCommonLayers; PLOT_FORMAT m_plotFormat; diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index f9c05afce8..0fb7c71a10 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -812,11 +812,11 @@ int PCBNEW_JOBS_HANDLER::JobExportSvg( JOB* aJob ) brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() ); brd->SynchronizeProperties(); - if( aSvgJob->m_plotLayerSequence.empty() ) - { - aSvgJob->m_plotLayerSequence = convertLayerArg( aSvgJob->m_argLayers, brd ); - aSvgJob->m_plotOnAllLayersSequence = convertLayerArg( aSvgJob->m_argCommonLayers, brd ); - } + if( aSvgJob->m_argLayers ) + aSvgJob->m_plotLayerSequence = convertLayerArg( aSvgJob->m_argLayers.value(), brd ); + + if( aSvgJob->m_argCommonLayers ) + aSvgJob->m_plotOnAllLayersSequence = convertLayerArg( aSvgJob->m_argCommonLayers.value(), brd ); if( aSvgJob->m_plotLayerSequence.size() < 1 ) { @@ -873,11 +873,11 @@ int PCBNEW_JOBS_HANDLER::JobExportDxf( JOB* aJob ) brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() ); brd->SynchronizeProperties(); - if( aDxfJob->m_plotLayerSequence.empty() ) - { - aDxfJob->m_plotLayerSequence = convertLayerArg( aDxfJob->m_argLayers, brd ); - aDxfJob->m_plotOnAllLayersSequence = convertLayerArg( aDxfJob->m_argCommonLayers, brd ); - } + if( aDxfJob->m_argLayers ) + aDxfJob->m_plotLayerSequence = convertLayerArg( aDxfJob->m_argLayers.value(), brd ); + + if( aDxfJob->m_argCommonLayers ) + aDxfJob->m_plotOnAllLayersSequence = convertLayerArg( aDxfJob->m_argCommonLayers.value(), brd ); if( aDxfJob->m_plotLayerSequence.size() < 1 ) { @@ -955,11 +955,11 @@ int PCBNEW_JOBS_HANDLER::JobExportPdf( JOB* aJob ) brd->GetProject()->ApplyTextVars( pdfJob->GetVarOverrides() ); brd->SynchronizeProperties(); - if( pdfJob->m_plotLayerSequence.empty() ) - { - pdfJob->m_plotLayerSequence = convertLayerArg( pdfJob->m_argLayers, brd ); - pdfJob->m_plotOnAllLayersSequence = convertLayerArg( pdfJob->m_argCommonLayers, brd ); - } + if( pdfJob->m_argLayers ) + pdfJob->m_plotLayerSequence = convertLayerArg( pdfJob->m_argLayers.value(), brd ); + + if( pdfJob->m_argCommonLayers ) + pdfJob->m_plotOnAllLayersSequence = convertLayerArg( pdfJob->m_argCommonLayers.value(), brd ); if( pdfJob->m_pdfGenMode == JOB_EXPORT_PCB_PDF::GEN_MODE::ALL_LAYERS_ONE_FILE ) plotAllLayersOneFile = true; @@ -1052,16 +1052,17 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob ) brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() ); brd->SynchronizeProperties(); - if( aGerberJob->m_plotLayerSequence.empty() ) + if( aGerberJob->m_argLayers ) { - if( !aGerberJob->m_argLayers.empty() ) - aGerberJob->m_plotLayerSequence = convertLayerArg( aGerberJob->m_argLayers, nullptr ); + if( !aGerberJob->m_argLayers.value().empty() ) + aGerberJob->m_plotLayerSequence = convertLayerArg( aGerberJob->m_argLayers.value(), nullptr ); else aGerberJob->m_plotLayerSequence = LSET::AllLayersMask().SeqStackupForPlotting(); - - aGerberJob->m_plotOnAllLayersSequence = convertLayerArg( aGerberJob->m_argCommonLayers, brd ); } + if( aGerberJob->m_argCommonLayers ) + aGerberJob->m_plotOnAllLayersSequence = convertLayerArg( aGerberJob->m_argCommonLayers.value(), brd ); + PCB_PLOT_PARAMS boardPlotOptions = brd->GetPlotOptions(); GERBER_JOBFILE_WRITER jobfile_writer( brd ); @@ -1280,11 +1281,11 @@ int PCBNEW_JOBS_HANDLER::JobExportGerber( JOB* aJob ) brd->GetProject()->ApplyTextVars( aJob->GetVarOverrides() ); brd->SynchronizeProperties(); - if( aGerberJob->m_plotLayerSequence.empty() ) - { - aGerberJob->m_plotLayerSequence = convertLayerArg( aGerberJob->m_argLayers, brd ); - aGerberJob->m_plotOnAllLayersSequence = convertLayerArg( aGerberJob->m_argCommonLayers, brd ); - } + if( aGerberJob->m_argLayers ) + aGerberJob->m_plotLayerSequence = convertLayerArg( aGerberJob->m_argLayers.value(), brd ); + + if( aGerberJob->m_argCommonLayers ) + aGerberJob->m_plotOnAllLayersSequence = convertLayerArg( aGerberJob->m_argCommonLayers.value(), brd ); if( aGerberJob->m_plotLayerSequence.size() < 1 ) { @@ -1768,10 +1769,10 @@ int PCBNEW_JOBS_HANDLER::JobExportFpSvg( JOB* aJob ) PCB_IO_KICAD_SEXPR pcb_io( CTL_FOR_LIBRARY ); FP_CACHE fpLib( &pcb_io, svgJob->m_libraryPath ); - if( svgJob->m_plotLayerSequence.empty() ) + if( svgJob->m_argLayers ) { - if( !svgJob->m_argLayers.empty() ) - svgJob->m_plotLayerSequence = convertLayerArg( svgJob->m_argLayers, nullptr ); + if( !svgJob->m_argLayers.value().empty() ) + svgJob->m_plotLayerSequence = convertLayerArg( svgJob->m_argLayers.value(), nullptr ); else svgJob->m_plotLayerSequence = LSET::AllLayersMask().SeqStackupForPlotting(); }