From 3e4d5d776db8292e64911c73b4c1efacafab886f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 22 Oct 2023 12:33:31 +0100 Subject: [PATCH] Add --exclude-pdf-property-popups to schematic plotting CLI. --- common/jobs/job_export_sch_plot.cpp | 1 + common/jobs/job_export_sch_plot.h | 19 ++++++++++--------- eeschema/eeschema_jobs_handler.cpp | 1 + kicad/cli/command_sch_export_plot.cpp | 13 ++++++++++++- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/common/jobs/job_export_sch_plot.cpp b/common/jobs/job_export_sch_plot.cpp index fd03c907dc..81235fd661 100644 --- a/common/jobs/job_export_sch_plot.cpp +++ b/common/jobs/job_export_sch_plot.cpp @@ -33,6 +33,7 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aIsCli, SCH_PLOT_FORMAT aPlotForm m_useBackgroundColor( true ), m_HPGLPenSize( 1.0 ), m_HPGLPaperSizeSelect( JOB_HPGL_PAGE_SIZE::DEFAULT ), + m_PDFPropertyPopups( true ), m_theme(), m_outputDirectory(), m_outputFile(), diff --git a/common/jobs/job_export_sch_plot.h b/common/jobs/job_export_sch_plot.h index c91f06614f..5f1e8101c3 100644 --- a/common/jobs/job_export_sch_plot.h +++ b/common/jobs/job_export_sch_plot.h @@ -77,20 +77,21 @@ class KICOMMON_API JOB_EXPORT_SCH_PLOT : public JOB public: JOB_EXPORT_SCH_PLOT( bool aIsCli, SCH_PLOT_FORMAT aPlotFormat, wxString aFilename ); - SCH_PLOT_FORMAT m_plotFormat; - wxString m_filename; - wxString m_drawingSheet; + SCH_PLOT_FORMAT m_plotFormat; + wxString m_filename; + wxString m_drawingSheet; bool m_plotAll; bool m_plotDrawingSheet; std::vector m_plotPages; - bool m_blackAndWhite; - JOB_PAGE_SIZE m_pageSizeSelect; - bool m_useBackgroundColor; - double m_HPGLPenSize; // for HPGL format only: pen size - JOB_HPGL_PAGE_SIZE m_HPGLPaperSizeSelect; - wxString m_theme; + bool m_blackAndWhite; + JOB_PAGE_SIZE m_pageSizeSelect; + bool m_useBackgroundColor; + double m_HPGLPenSize; // for HPGL format only: pen size + JOB_HPGL_PAGE_SIZE m_HPGLPaperSizeSelect; + bool m_PDFPropertyPopups; + wxString m_theme; wxString m_outputDirectory; wxString m_outputFile; diff --git a/eeschema/eeschema_jobs_handler.cpp b/eeschema/eeschema_jobs_handler.cpp index 582b5bed7f..3f64b72f31 100644 --- a/eeschema/eeschema_jobs_handler.cpp +++ b/eeschema/eeschema_jobs_handler.cpp @@ -211,6 +211,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob ) settings.m_HPGLPaperSizeSelect = hpglPageSize; settings.m_HPGLPenSize = aPlotJob->m_HPGLPenSize; settings.m_HPGLPlotOrigin = hpglOrigin; + settings.m_PDFPropertyPopups = aPlotJob->m_PDFPropertyPopups; settings.m_outputDirectory = aPlotJob->m_outputDirectory; settings.m_outputFile = aPlotJob->m_outputFile; settings.m_pageSizeSelect = pageSizeSelect; diff --git a/kicad/cli/command_sch_export_plot.cpp b/kicad/cli/command_sch_export_plot.cpp index 384db3dde0..d372741069 100644 --- a/kicad/cli/command_sch_export_plot.cpp +++ b/kicad/cli/command_sch_export_plot.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -35,6 +35,7 @@ #define ARG_HPGL_PEN_SIZE "--pen-size" #define ARG_HPGL_ORIGIN "--origin" #define ARG_PAGES "--pages" +#define ARG_EXCLUDE_PDF_PROPERTY_POPUPS "--exclude-pdf-property-popups" const JOB_HPGL_PLOT_ORIGIN_AND_UNITS hpgl_origin_ops[4] = { JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT, @@ -71,6 +72,11 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName, .implicit_value( true ) .default_value( false ); + m_argParser.add_argument( ARG_EXCLUDE_PDF_PROPERTY_POPUPS ) + .help( UTF8STDSTR( _( "Do not generate property popups in PDF" ) ) ) + .implicit_value( true ) + .default_value( false ); + m_argParser.add_argument( "-n", ARG_NO_BACKGROUND_COLOR ) .help( UTF8STDSTR( _( "Avoid setting a background color (regardless of theme)" ) ) ) .implicit_value( true ) @@ -148,6 +154,11 @@ int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway ) } plotJob->m_HPGLPlotOrigin = hpgl_origin_ops[origin]; } + // PDF local options + else if( m_plotFormat == SCH_PLOT_FORMAT::PDF ) + { + plotJob->m_PDFPropertyPopups = !m_argParser.get( ARG_EXCLUDE_PDF_PROPERTY_POPUPS ); + } int exitCode = aKiway.ProcessJob( KIWAY::FACE_SCH, plotJob.get() );