Formatting and cleanup.

This commit is contained in:
Jeff Young 2023-04-30 13:43:25 +01:00
parent bc754df30f
commit 1c6b765ba5
2 changed files with 81 additions and 140 deletions

View File

@ -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 // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
m_svgPrecision = SVG_PRECISION_DEFAULT; m_svgPrecision = SVG_PRECISION_DEFAULT;
m_plotFrameRef = false; m_plotDrawingSheet = false;
m_plotViaOnMaskLayer = false; m_plotViaOnMaskLayer = false;
m_plotMode = FILLED; m_plotMode = FILLED;
m_DXFplotPolygonMode = true; m_DXFPolygonMode = true;
m_DXFplotUnits = DXF_UNITS::INCHES; m_DXFUnits = DXF_UNITS::INCHES;
m_useAuxOrigin = false; m_useAuxOrigin = false;
m_HPGLPenNum = 1; m_HPGLPenNum = 1;
m_HPGLPenSpeed = 20; // this param is always in cm/s m_HPGLPenSpeed = 20; // this param is always in cm/s
@ -207,7 +207,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
// SVG options // SVG options
aFormatter->Print( aNestLevel+1, "(svgprecision %d)\n", m_svgPrecision ); 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, "(viasonmask %s)\n", printBool( m_plotViaOnMaskLayer ) );
aFormatter->Print( aNestLevel+1, "(mode %d)\n", GetPlotMode() == SKETCH ? 2 : 1 ); aFormatter->Print( aNestLevel+1, "(mode %d)\n", GetPlotMode() == SKETCH ? 2 : 1 );
aFormatter->Print( aNestLevel+1, "(useauxorigin %s)\n", printBool( m_useAuxOrigin ) ); aFormatter->Print( aNestLevel+1, "(useauxorigin %s)\n", printBool( m_useAuxOrigin ) );
@ -219,9 +219,9 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
// DXF options // DXF options
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfpolygonmode ), 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 ), 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 ), aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfusepcbnewfont ),
printBool( m_textMode != PLOT_TEXT_MODE::NATIVE ) ); 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 ) if( m_dashedLineGapRatio != aPcbPlotParams.m_dashedLineGapRatio )
return false; return false;
if( m_plotFrameRef != aPcbPlotParams.m_plotFrameRef ) if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet )
return false; return false;
if( m_plotViaOnMaskLayer != aPcbPlotParams.m_plotViaOnMaskLayer ) 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 ) if( m_plotMode != aPcbPlotParams.m_plotMode )
return false; return false;
if( m_DXFplotPolygonMode != aPcbPlotParams.m_DXFplotPolygonMode ) if( m_DXFPolygonMode != aPcbPlotParams.m_DXFPolygonMode )
return false; return false;
if( m_DXFplotUnits != aPcbPlotParams.m_DXFplotUnits ) if( m_DXFUnits != aPcbPlotParams.m_DXFUnits )
return false; return false;
if( m_svgPrecision != aPcbPlotParams.m_svgPrecision ) if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
@ -518,7 +518,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
break; break;
case T_plotframeref: case T_plotframeref:
aPcbPlotParams->m_plotFrameRef = parseBool(); aPcbPlotParams->m_plotDrawingSheet = parseBool();
break; break;
case T_viasonmask: case T_viasonmask:
@ -551,11 +551,11 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
break; break;
case T_dxfpolygonmode: case T_dxfpolygonmode:
aPcbPlotParams->m_DXFplotPolygonMode = parseBool(); aPcbPlotParams->m_DXFPolygonMode = parseBool();
break; break;
case T_dxfimperialunits: case T_dxfimperialunits:
aPcbPlotParams->m_DXFplotUnits = parseBool() ? DXF_UNITS::INCHES aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::INCHES
: DXF_UNITS::MILLIMETERS; : DXF_UNITS::MILLIMETERS;
break; break;

View File

@ -71,11 +71,11 @@ public:
void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; } void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; }
OUTLINE_MODE GetPlotMode() const { return m_plotMode; } OUTLINE_MODE GetPlotMode() const { return m_plotMode; }
void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; } void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFPolygonMode = aFlag; }
bool GetDXFPlotPolygonMode() const { return m_DXFplotPolygonMode; } bool GetDXFPlotPolygonMode() const { return m_DXFPolygonMode; }
void SetDXFPlotUnits( DXF_UNITS aUnit ) { m_DXFplotUnits = aUnit; } void SetDXFPlotUnits( DXF_UNITS aUnit ) { m_DXFUnits = aUnit; }
DXF_UNITS GetDXFPlotUnits() const { return m_DXFplotUnits; } DXF_UNITS GetDXFPlotUnits() const { return m_DXFUnits; }
void SetDrillMarksType( DRILL_MARKS aVal ) { m_drillMarks = aVal; } void SetDrillMarksType( DRILL_MARKS aVal ) { m_drillMarks = aVal; }
DRILL_MARKS GetDrillMarksType() const { return m_drillMarks; } DRILL_MARKS GetDrillMarksType() const { return m_drillMarks; }
@ -114,8 +114,8 @@ public:
void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; } void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
bool GetPlotViaOnMaskLayer() const { return m_plotViaOnMaskLayer; } bool GetPlotViaOnMaskLayer() const { return m_plotViaOnMaskLayer; }
void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; } void SetPlotFrameRef( bool aFlag ) { m_plotDrawingSheet = aFlag; }
bool GetPlotFrameRef() const { return m_plotFrameRef; } bool GetPlotFrameRef() const { return m_plotDrawingSheet; }
void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; } void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; }
PLOT_FORMAT GetFormat() const { return m_format; } PLOT_FORMAT GetFormat() const { return m_format; }
@ -147,14 +147,6 @@ public:
void SetBlackAndWhite( bool blackAndWhite ) { m_blackAndWhite = blackAndWhite; } void SetBlackAndWhite( bool blackAndWhite ) { m_blackAndWhite = blackAndWhite; }
unsigned GetBlackAndWhite() const { return m_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; } void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; }
bool GetSubtractMaskFromSilk() const { return m_subtractMaskFromSilk; } bool GetSubtractMaskFromSilk() const { return m_subtractMaskFromSilk; }
@ -198,149 +190,98 @@ public:
private: private:
friend class PCB_PLOT_PARAMS_PARSER; friend class PCB_PLOT_PARAMS_PARSER;
// If true, do not plot NPTH pads PLOT_FORMAT m_format; /// Plot format type (chooses the driver to be used)
// (mainly used to disable NPTH pads plotting on copper layers) LSET m_layerSelection;
bool m_skipNPTH_Pads; LSET m_plotOnAllLayersSelection;
/** bool m_skipNPTH_Pads; /// Used to disable NPTH pads plotting on copper layers
* FILLED or SKETCH selects how to plot filled objects. 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
* FILLED or SKETCH not available with all drivers: some have fixed mode /// plotted in actual size
*/ PLOT_TEXT_MODE m_textMode;
OUTLINE_MODE m_plotMode;
/** DXF_UNITS m_DXFUnits;
* DXF format: Plot items in outline (polygon) mode. bool m_DXFPolygonMode; /// In polygon mode, each item to plot is converted to a
* /// polygon and all polygons are merged.
* In polygon mode, each item to plot is converted to a polygon and all polygons are merged.
*/
bool m_DXFplotPolygonMode;
/** bool m_A4Output; /// Autoscale the plot to fit an A4 (landscape?) sheet
* DXF format: Units to use when plotting the DXF 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
DXF_UNITS m_DXFplotUnits; bool m_mirror; /// Mirror the plot around the X axis
/// Plot format type (chooses the driver to be used) bool m_negative; /// Plot in negative color (supported only by some drivers)
PLOT_FORMAT m_format; 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 bool m_plotViaOnMaskLayer; /// True if vias are drawn on Mask layer (ie untented,
PLOT_TEXT_MODE m_textMode; /// *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. /// When plotting gerber files, use a conventional set of Protel extensions instead of .gbr,
double m_scale; /// that is now the official gerber file extension (this is a deprecated feature)
bool m_useGerberProtelExtensions;
/// 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;
/// Include attributes from the Gerber X2 format (chapter 5 in revision J2) /// 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) /// Disable aperture macros in Gerber format (only for broken Gerber readers). Ideally,
/// Ideally, should be never selected. /// should be never selected.
bool m_gerberDisableApertMacros; bool m_gerberDisableApertMacros;
/// Include netlist info (only in Gerber X2 format) (chapter ? in revision ?) /// 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 /// generate the auxiliary "job file" in gerber format
bool m_createGerberJobFile; bool m_createGerberJobFile;
/// precision of coordinates in Gerber files: accepted 5 or 6 /// Precision of coordinates in Gerber: accepted 5 or 6 when units are in mm, 6 or 7 in inches
/// when units are in mm (6 or 7 in inches, but Pcbnew uses mm). /// (but Pcbnew uses mm).
/// 6 is the internal resolution of Pcbnew, but not always accepted by board maker /// 6 is the internal resolution of Pcbnew, but not always accepted by board maker
/// 5 is the minimal value for professional boards. /// 5 is the minimal value for professional boards
int m_gerberPrecision; int m_gerberPrecision;
/// precision of coordinates in SVG files: accepted 3 - 6 /// Precision of coordinates in SVG: accepted 3 - 6; 6 is the internal resolution of Pcbnew
/// 6 is the internal resolution of Pcbnew unsigned m_svgPrecision;
unsigned m_svgPrecision;
/// Plot in black and white only bool m_useAuxOrigin; ///< Plot gerbers using auxiliary (drill) origin instead
bool m_blackAndWhite; ///< 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) wxString m_outputDirectory; ///< Output directory for plot files (usually relative to
bool m_subtractMaskFromSilk; ///< the board file)
int m_scaleSelection; ///< Scale ratio index (UI only)
/// Autoscale the plot to fit an A4 (landscape?) sheet bool m_plotReference; ///< Enable plotting of part references
bool m_A4Output; bool m_plotValue; ///< Enable plotting of part values
bool m_plotInvisibleText; ///< Force plotting of fields marked invisible
/// Scale ratio index (UI only) bool m_sketchPadsOnFabLayers; ///< Plots pads outlines on fab layers
int m_scaleSelection; int m_sketchPadLineWidth;
/// Output directory for plot files (usually relative to the board file) double m_fineScaleAdjustX; ///< Compensation for printer scale errors (and therefore
wxString m_outputDirectory; 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 int m_widthAdjust; ///< Compensation for PS printers/plotters that do not
bool m_plotReference; ///< strictly obey line width settings. Only used to plot
///< pads and tracks.
/// Enable plotting of part values int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9)
bool m_plotValue; 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
/// 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
///< However, it is in mm in hpgl files. ///< However, it is in mm in hpgl files.
double m_dashedLineDashRatio; double m_dashedLineDashRatio;
double m_dashedLineGapRatio; double m_dashedLineGapRatio;
/// Pointer to active color settings to be used for plotting COLOR_SETTINGS* m_colors; /// Pointer to color settings to be used for plotting
COLOR_SETTINGS* m_colors;
/// Dummy colors object that can be created if there is no Pgm context /// Dummy colors object that can be created if there is no Pgm context
std::shared_ptr<COLOR_SETTINGS> m_default_colors; std::shared_ptr<COLOR_SETTINGS> m_default_colors;