diff --git a/common/jobs/job_sym_export_svg.h b/common/jobs/job_sym_export_svg.h index c3f85cccdf..2d341c34f3 100644 --- a/common/jobs/job_sym_export_svg.h +++ b/common/jobs/job_sym_export_svg.h @@ -32,7 +32,9 @@ public: m_libraryPath(), m_symbol(), m_outputDirectory(), - m_blackAndWhite( false ) + m_blackAndWhite( false ), + m_includeHiddenPins( false ), + m_includeHiddenFields( false ) { } @@ -44,6 +46,9 @@ public: wxString m_colorTheme; bool m_blackAndWhite; + + bool m_includeHiddenPins; + bool m_includeHiddenFields; }; #endif \ No newline at end of file diff --git a/eeschema/eeschema_jobs_handler.cpp b/eeschema/eeschema_jobs_handler.cpp index 35efb879b2..0234d57054 100644 --- a/eeschema/eeschema_jobs_handler.cpp +++ b/eeschema/eeschema_jobs_handler.cpp @@ -347,6 +347,19 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob, symbolToPlot = parent.get(); } + if( aSvgJob->m_includeHiddenPins ) + { + // horrible hack, TODO overhaul the Plot method to handle this + for( LIB_ITEM& item : symbolToPlot->GetDrawItems() ) + { + if( item.Type() != LIB_PIN_T ) + continue; + + LIB_PIN& pin = static_cast( item ); + pin.SetVisible( true ); + } + } + // iterate from unit 1, unit 0 would be "all units" which we don't want for( int unit = 1; unit < symbol->GetUnitCount() + 1; unit++ ) { @@ -410,10 +423,10 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob, // note, we want to use the fields from the original symbol pointer (in case of non-alias) symbolToPlot->Plot( plotter, unit, convert, background, plotPos, temp, false ); - symbol->PlotLibFields( plotter, unit, convert, background, plotPos, temp, false, false ); + symbol->PlotLibFields( plotter, unit, convert, background, plotPos, temp, false, aSvgJob->m_includeHiddenFields ); symbolToPlot->Plot( plotter, unit, convert, !background, plotPos, temp, false ); - symbol->PlotLibFields( plotter, unit, convert, !background, plotPos, temp, false, false ); + symbol->PlotLibFields( plotter, unit, convert, !background, plotPos, temp, false, aSvgJob->m_includeHiddenFields ); plotter->EndPlot(); delete plotter; diff --git a/kicad/cli/command_export_pcb_base.h b/kicad/cli/command_export_pcb_base.h index ae5ec5879a..69e3a86268 100644 --- a/kicad/cli/command_export_pcb_base.h +++ b/kicad/cli/command_export_pcb_base.h @@ -28,7 +28,10 @@ namespace CLI { #define ARG_OUTPUT "--output" #define ARG_INPUT "input" + #define ARG_BLACKANDWHITE "--black-and-white" +#define ARG_BLACKANDWHITE_DESC "Black and white only" + #define ARG_LAYERS "--layers" #define ARG_INCLUDE_REFDES "--include-refdes" #define ARG_INCLUDE_VALUE "--include-value" diff --git a/kicad/cli/command_export_pcb_pdf.cpp b/kicad/cli/command_export_pcb_pdf.cpp index 7d187ce95f..75f59ccd84 100644 --- a/kicad/cli/command_export_pcb_pdf.cpp +++ b/kicad/cli/command_export_pcb_pdf.cpp @@ -51,7 +51,7 @@ CLI::EXPORT_PCB_PDF_COMMAND::EXPORT_PCB_PDF_COMMAND() : EXPORT_PCB_BASE_COMMAND( .default_value( false ); m_argParser.add_argument( ARG_BLACKANDWHITE ) - .help( UTF8STDSTR( _( "Black and white only" ) ) ) + .help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) ) .implicit_value( true ) .default_value( false ); diff --git a/kicad/cli/command_export_pcb_svg.cpp b/kicad/cli/command_export_pcb_svg.cpp index b9ce987a1f..95f37d7096 100644 --- a/kicad/cli/command_export_pcb_svg.cpp +++ b/kicad/cli/command_export_pcb_svg.cpp @@ -49,7 +49,7 @@ CLI::EXPORT_PCB_SVG_COMMAND::EXPORT_PCB_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( .help( UTF8STDSTR( _( "Color theme to use (will default to pcbnew settings)" ) ) ); m_argParser.add_argument( ARG_BLACKANDWHITE ) - .help( UTF8STDSTR( _( "Black and white only" ) ) ) + .help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) ) .implicit_value( true ) .default_value( false ); diff --git a/kicad/cli/command_export_sch_pdf.cpp b/kicad/cli/command_export_sch_pdf.cpp index 8477b96f39..dea9902cf5 100644 --- a/kicad/cli/command_export_sch_pdf.cpp +++ b/kicad/cli/command_export_sch_pdf.cpp @@ -38,7 +38,7 @@ CLI::EXPORT_SCH_PDF_COMMAND::EXPORT_SCH_PDF_COMMAND() : EXPORT_PCB_BASE_COMMAND( .help( UTF8STDSTR( _( "Color theme to use (will default to pcbnew settings)" ) ) ); m_argParser.add_argument( ARG_BLACKANDWHITE ) - .help( UTF8STDSTR( _( "Black and white only" ) ) ) + .help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) ) .implicit_value( true ) .default_value( false ); diff --git a/kicad/cli/command_export_sch_svg.cpp b/kicad/cli/command_export_sch_svg.cpp index 8a418971a1..8dbf5f1eac 100644 --- a/kicad/cli/command_export_sch_svg.cpp +++ b/kicad/cli/command_export_sch_svg.cpp @@ -38,7 +38,7 @@ CLI::EXPORT_SCH_SVG_COMMAND::EXPORT_SCH_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( .help( UTF8STDSTR( _( "Color theme to use (will default to pcbnew settings)" ) ) ); m_argParser.add_argument( ARG_BLACKANDWHITE ) - .help( UTF8STDSTR( _( "Black and white only" ) ) ) + .help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) ) .implicit_value( true ) .default_value( false ); diff --git a/kicad/cli/command_fp_export_svg.cpp b/kicad/cli/command_fp_export_svg.cpp index 8fd00c378d..f4379049e7 100644 --- a/kicad/cli/command_fp_export_svg.cpp +++ b/kicad/cli/command_fp_export_svg.cpp @@ -42,7 +42,7 @@ CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( " .help( UTF8STDSTR( _( "Specific symbol to export within the library" ) ) ); m_argParser.add_argument( ARG_BLACKANDWHITE ) - .help( UTF8STDSTR( _( "Black and white only" ) ) ) + .help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) ) .implicit_value( true ) .default_value( false ); } diff --git a/kicad/cli/command_sym_export_svg.cpp b/kicad/cli/command_sym_export_svg.cpp index 077c939fa9..f05a82f61c 100644 --- a/kicad/cli/command_sym_export_svg.cpp +++ b/kicad/cli/command_sym_export_svg.cpp @@ -30,6 +30,8 @@ #define ARG_NO_BACKGROUND_COLOR "--no-background-color" #define ARG_SYMBOL "--symbol" +#define ARG_INC_HIDDEN_PINS "--include-hidden-pins" +#define ARG_INC_HIDDEN_FIELDS "--include-hidden-fields" CLI::SYM_EXPORT_SVG_COMMAND::SYM_EXPORT_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( "svg" ) { @@ -42,7 +44,17 @@ CLI::SYM_EXPORT_SVG_COMMAND::SYM_EXPORT_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( .help( UTF8STDSTR( _( "Specific symbol to export within the library" ) ) ); m_argParser.add_argument( ARG_BLACKANDWHITE ) - .help( UTF8STDSTR( _( "Black and white only" ) ) ) + .help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) ) + .implicit_value( true ) + .default_value( false ); + + m_argParser.add_argument( ARG_INC_HIDDEN_PINS ) + .help( UTF8STDSTR( _( "Include hidden pins" ) ) ) + .implicit_value( true ) + .default_value( false ); + + m_argParser.add_argument( ARG_INC_HIDDEN_FIELDS ) + .help( UTF8STDSTR( _( "Include hidden fields" ) ) ) .implicit_value( true ) .default_value( false ); } @@ -56,6 +68,8 @@ int CLI::SYM_EXPORT_SVG_COMMAND::doPerform( KIWAY& aKiway ) svgJob->m_outputDirectory = FROM_UTF8( m_argParser.get( ARG_OUTPUT ).c_str() ); svgJob->m_blackAndWhite = m_argParser.get( ARG_BLACKANDWHITE ); svgJob->m_symbol = FROM_UTF8( m_argParser.get( ARG_SYMBOL ).c_str() ); + svgJob->m_includeHiddenFields = m_argParser.get( ARG_INC_HIDDEN_FIELDS ); + svgJob->m_includeHiddenPins = m_argParser.get( ARG_INC_HIDDEN_PINS ); if( !wxFile::Exists( svgJob->m_libraryPath ) ) {