From 1c6b765ba5509c1d3d6f0bb011a90ff2050b999f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 30 Apr 2023 13:43:25 +0100 Subject: [PATCH] Formatting and cleanup. --- pcbnew/pcb_plot_params.cpp | 24 ++--- pcbnew/pcb_plot_params.h | 197 +++++++++++++------------------------ 2 files changed, 81 insertions(+), 140 deletions(-) diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index be4ec8e2ab..c3c0bd5b67 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -101,11 +101,11 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm m_svgPrecision = SVG_PRECISION_DEFAULT; - m_plotFrameRef = false; + m_plotDrawingSheet = false; m_plotViaOnMaskLayer = false; m_plotMode = FILLED; - m_DXFplotPolygonMode = true; - m_DXFplotUnits = DXF_UNITS::INCHES; + m_DXFPolygonMode = true; + m_DXFUnits = DXF_UNITS::INCHES; m_useAuxOrigin = false; m_HPGLPenNum = 1; m_HPGLPenSpeed = 20; // this param is always in cm/s @@ -207,7 +207,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter, // SVG options aFormatter->Print( aNestLevel+1, "(svgprecision %d)\n", m_svgPrecision ); - aFormatter->Print( aNestLevel+1, "(plotframeref %s)\n", printBool( m_plotFrameRef ) ); + aFormatter->Print( aNestLevel+1, "(plotframeref %s)\n", printBool( m_plotDrawingSheet ) ); aFormatter->Print( aNestLevel+1, "(viasonmask %s)\n", printBool( m_plotViaOnMaskLayer ) ); aFormatter->Print( aNestLevel+1, "(mode %d)\n", GetPlotMode() == SKETCH ? 2 : 1 ); aFormatter->Print( aNestLevel+1, "(useauxorigin %s)\n", printBool( m_useAuxOrigin ) ); @@ -219,9 +219,9 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter, // DXF options aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfpolygonmode ), - printBool( m_DXFplotPolygonMode ) ); + printBool( m_DXFPolygonMode ) ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfimperialunits ), - printBool( m_DXFplotUnits == DXF_UNITS::INCHES ) ); + printBool( m_DXFUnits == DXF_UNITS::INCHES ) ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfusepcbnewfont ), printBool( m_textMode != PLOT_TEXT_MODE::NATIVE ) ); @@ -285,7 +285,7 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const if( m_dashedLineGapRatio != aPcbPlotParams.m_dashedLineGapRatio ) return false; - if( m_plotFrameRef != aPcbPlotParams.m_plotFrameRef ) + if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet ) return false; if( m_plotViaOnMaskLayer != aPcbPlotParams.m_plotViaOnMaskLayer ) @@ -294,10 +294,10 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const if( m_plotMode != aPcbPlotParams.m_plotMode ) return false; - if( m_DXFplotPolygonMode != aPcbPlotParams.m_DXFplotPolygonMode ) + if( m_DXFPolygonMode != aPcbPlotParams.m_DXFPolygonMode ) return false; - if( m_DXFplotUnits != aPcbPlotParams.m_DXFplotUnits ) + if( m_DXFUnits != aPcbPlotParams.m_DXFUnits ) return false; if( m_svgPrecision != aPcbPlotParams.m_svgPrecision ) @@ -518,7 +518,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) break; case T_plotframeref: - aPcbPlotParams->m_plotFrameRef = parseBool(); + aPcbPlotParams->m_plotDrawingSheet = parseBool(); break; case T_viasonmask: @@ -551,11 +551,11 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) break; case T_dxfpolygonmode: - aPcbPlotParams->m_DXFplotPolygonMode = parseBool(); + aPcbPlotParams->m_DXFPolygonMode = parseBool(); break; case T_dxfimperialunits: - aPcbPlotParams->m_DXFplotUnits = parseBool() ? DXF_UNITS::INCHES + aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::INCHES : DXF_UNITS::MILLIMETERS; break; diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index 3d5c430e53..5e7e3c4ae8 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -71,11 +71,11 @@ public: void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; } OUTLINE_MODE GetPlotMode() const { return m_plotMode; } - void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; } - bool GetDXFPlotPolygonMode() const { return m_DXFplotPolygonMode; } + void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFPolygonMode = aFlag; } + bool GetDXFPlotPolygonMode() const { return m_DXFPolygonMode; } - void SetDXFPlotUnits( DXF_UNITS aUnit ) { m_DXFplotUnits = aUnit; } - DXF_UNITS GetDXFPlotUnits() const { return m_DXFplotUnits; } + void SetDXFPlotUnits( DXF_UNITS aUnit ) { m_DXFUnits = aUnit; } + DXF_UNITS GetDXFPlotUnits() const { return m_DXFUnits; } void SetDrillMarksType( DRILL_MARKS aVal ) { m_drillMarks = aVal; } DRILL_MARKS GetDrillMarksType() const { return m_drillMarks; } @@ -114,8 +114,8 @@ public: void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; } bool GetPlotViaOnMaskLayer() const { return m_plotViaOnMaskLayer; } - void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; } - bool GetPlotFrameRef() const { return m_plotFrameRef; } + void SetPlotFrameRef( bool aFlag ) { m_plotDrawingSheet = aFlag; } + bool GetPlotFrameRef() const { return m_plotDrawingSheet; } void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; } PLOT_FORMAT GetFormat() const { return m_format; } @@ -147,14 +147,6 @@ public: void SetBlackAndWhite( bool blackAndWhite ) { m_blackAndWhite = blackAndWhite; } unsigned GetBlackAndWhite() const { return m_blackAndWhite; } - /** - * Default precision of coordinates in Gerber files. - * - * When units are in mm (7 in inches, but Pcbnew uses mm). - * 6 is the internal resolution of Pcbnew, so the default is 6. - */ - static int GetGerberDefaultPrecision() { return 6; } - void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; } bool GetSubtractMaskFromSilk() const { return m_subtractMaskFromSilk; } @@ -198,149 +190,98 @@ public: private: friend class PCB_PLOT_PARAMS_PARSER; - // If true, do not plot NPTH pads - // (mainly used to disable NPTH pads plotting on copper layers) - bool m_skipNPTH_Pads; + PLOT_FORMAT m_format; /// Plot format type (chooses the driver to be used) + LSET m_layerSelection; + LSET m_plotOnAllLayersSelection; - /** - * FILLED or SKETCH selects how to plot filled objects. - * - * FILLED or SKETCH not available with all drivers: some have fixed mode - */ - OUTLINE_MODE m_plotMode; + bool m_skipNPTH_Pads; /// Used to disable NPTH pads plotting on copper layers + OUTLINE_MODE m_plotMode; /// FILLED or SKETCH for filled objects. + DRILL_MARKS m_drillMarks; /// Holes can be not plotted, have a small mark, or be + /// plotted in actual size + PLOT_TEXT_MODE m_textMode; - /** - * DXF format: Plot items in outline (polygon) mode. - * - * In polygon mode, each item to plot is converted to a polygon and all polygons are merged. - */ - bool m_DXFplotPolygonMode; + DXF_UNITS m_DXFUnits; + bool m_DXFPolygonMode; /// In polygon mode, each item to plot is converted to a + /// polygon and all polygons are merged. - /** - * DXF format: Units to use when plotting the DXF - */ - DXF_UNITS m_DXFplotUnits; + bool m_A4Output; /// Autoscale the plot to fit an A4 (landscape?) sheet + bool m_autoScale; /// When true set the scale to fit the board in the page + double m_scale; /// Global scale factor, 1.0 plots a board at actual size + bool m_mirror; /// Mirror the plot around the X axis - /// Plot format type (chooses the driver to be used) - PLOT_FORMAT m_format; + bool m_negative; /// Plot in negative color (supported only by some drivers) + bool m_blackAndWhite; /// Plot in black and white only + bool m_plotDrawingSheet; - /// Holes can be not plotted, have a small mark or plotted in actual size - DRILL_MARKS m_drillMarks; - /// Choose how represent text with PS, PDF and DXF drivers - PLOT_TEXT_MODE m_textMode; + bool m_plotViaOnMaskLayer; /// True if vias are drawn on Mask layer (ie untented, + /// *exposed* by mask) + bool m_subtractMaskFromSilk; /// On gerbers 'scrape' away the solder mask from + /// silkscreen (trim silks) - /// When true set the scale to fit the board in the page - bool m_autoScale; - /// Global scale factor, 1.0 plots a board with its actual size. - double m_scale; - - /// Mirror the plot around the X axis - bool m_mirror; - - /// Plot in negative color (supported only by some drivers) - bool m_negative; - - /// True if vias are drawn on Mask layer (ie untented, *exposed* by mask) - bool m_plotViaOnMaskLayer; - - /// True to plot/print frame references - bool m_plotFrameRef; - - /// Set of layers to plot - LSET m_layerSelection; - - /// Set of layers that get plotted on each of the layers to plot. - LSET m_plotOnAllLayersSelection; - - /** When plotting gerber files, use a conventional set of Protel extensions - * instead of .gbr, that is now the official gerber file extension - * this is a deprecated feature - */ - bool m_useGerberProtelExtensions; + /// When plotting gerber files, use a conventional set of Protel extensions instead of .gbr, + /// that is now the official gerber file extension (this is a deprecated feature) + bool m_useGerberProtelExtensions; /// Include attributes from the Gerber X2 format (chapter 5 in revision J2) - bool m_useGerberX2format; + bool m_useGerberX2format; - /// Disable aperture macros in Gerber format (only for broken Gerber readers) - /// Ideally, should be never selected. - bool m_gerberDisableApertMacros; + /// Disable aperture macros in Gerber format (only for broken Gerber readers). Ideally, + /// should be never selected. + bool m_gerberDisableApertMacros; /// Include netlist info (only in Gerber X2 format) (chapter ? in revision ?) - bool m_includeGerberNetlistInfo; + bool m_includeGerberNetlistInfo; /// generate the auxiliary "job file" in gerber format - bool m_createGerberJobFile; + bool m_createGerberJobFile; - /// precision of coordinates in Gerber files: accepted 5 or 6 - /// when units are in mm (6 or 7 in inches, but Pcbnew uses mm). + /// Precision of coordinates in Gerber: accepted 5 or 6 when units are in mm, 6 or 7 in inches + /// (but Pcbnew uses mm). /// 6 is the internal resolution of Pcbnew, but not always accepted by board maker - /// 5 is the minimal value for professional boards. - int m_gerberPrecision; + /// 5 is the minimal value for professional boards + int m_gerberPrecision; - /// precision of coordinates in SVG files: accepted 3 - 6 - /// 6 is the internal resolution of Pcbnew - unsigned m_svgPrecision; + /// Precision of coordinates in SVG: accepted 3 - 6; 6 is the internal resolution of Pcbnew + unsigned m_svgPrecision; - /// Plot in black and white only - bool m_blackAndWhite; + bool m_useAuxOrigin; ///< Plot gerbers using auxiliary (drill) origin instead + ///< of absolute coordinates - /// Plot gerbers using auxiliary (drill) origin instead of absolute coordinates - bool m_useAuxOrigin; - /// On gerbers 'scrape' away the solder mask from silkscreen (trim silks) - bool m_subtractMaskFromSilk; + wxString m_outputDirectory; ///< Output directory for plot files (usually relative to + ///< the board file) + int m_scaleSelection; ///< Scale ratio index (UI only) - /// Autoscale the plot to fit an A4 (landscape?) sheet - bool m_A4Output; + bool m_plotReference; ///< Enable plotting of part references + bool m_plotValue; ///< Enable plotting of part values + bool m_plotInvisibleText; ///< Force plotting of fields marked invisible - /// Scale ratio index (UI only) - int m_scaleSelection; + bool m_sketchPadsOnFabLayers; ///< Plots pads outlines on fab layers + int m_sketchPadLineWidth; - /// Output directory for plot files (usually relative to the board file) - wxString m_outputDirectory; + double m_fineScaleAdjustX; ///< Compensation for printer scale errors (and therefore + double m_fineScaleAdjustY; ///< expected to be very near 1.0). Only X and Y + ///< dimensions are adjusted: circles are plotted as + ///< circles, even if X and Y fine scale differ. + ///< Because of this it is mostly useful for printers: + ///< postscript plots should use the prologue, which will + ///< change the whole output matrix. - /// Enable plotting of part references - bool m_plotReference; + int m_widthAdjust; ///< Compensation for PS printers/plotters that do not + ///< strictly obey line width settings. Only used to plot + ///< pads and tracks. - /// Enable plotting of part values - bool m_plotValue; - - /// Force plotting of fields marked invisible - bool m_plotInvisibleText; - - /// Plots pads outlines on fab layers - bool m_sketchPadsOnFabLayers; - int m_sketchPadLineWidth; - - /* These next two scale factors are intended to compensate plotters - * (mainly printers) X and Y scale error. Therefore they are expected very - * near 1.0; only X and Y dimensions are adjusted: circles are plotted as - * circles, even if X and Y fine scale differ; because of this it is mostly - * useful for printers: postscript plots would be best adjusted using - * the prologue (that would change the whole output matrix - */ - - double m_fineScaleAdjustX; ///< fine scale adjust X axis - double m_fineScaleAdjustY; ///< fine scale adjust Y axis - - /** - * This width factor is intended to compensate PS printers/ plotters that do - * not strictly obey line width settings. Only used to plot pads and tracks. - */ - int m_widthAdjust; - - int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9) - int m_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s) - double m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas + int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9) + int m_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s) + double m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas ///< However, it is in mm in hpgl files. - double m_dashedLineDashRatio; - double m_dashedLineGapRatio; + double m_dashedLineDashRatio; + double m_dashedLineGapRatio; - /// Pointer to active color settings to be used for plotting - COLOR_SETTINGS* m_colors; + COLOR_SETTINGS* m_colors; /// Pointer to color settings to be used for plotting /// Dummy colors object that can be created if there is no Pgm context std::shared_ptr m_default_colors;