2012-01-09 08:35:06 +00:00
|
|
|
#ifndef PCB_PLOT_PARAMS_H_
|
|
|
|
#define PCB_PLOT_PARAMS_H_
|
2011-01-28 22:54:16 +00:00
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2011-01-28 22:54:16 +00:00
|
|
|
*
|
2011-09-30 18:15:37 +00:00
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors.
|
2011-01-28 22:54:16 +00:00
|
|
|
*
|
|
|
|
* 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 Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <wx/wx.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcb_plot_params_lexer.h>
|
2012-04-12 21:31:31 +00:00
|
|
|
#include <eda_text.h> // EDA_DRAW_MODE_T
|
2012-08-29 20:13:47 +00:00
|
|
|
#include <plot_common.h>
|
2013-03-30 17:24:04 +00:00
|
|
|
#include <layers_id_colors_and_visibility.h>
|
2011-01-28 22:54:16 +00:00
|
|
|
|
2012-11-05 20:20:34 +00:00
|
|
|
class PCB_PLOT_PARAMS;
|
2012-04-05 18:27:56 +00:00
|
|
|
class LINE_READER;
|
|
|
|
|
2011-01-28 22:54:16 +00:00
|
|
|
|
2012-11-05 20:20:34 +00:00
|
|
|
/**
|
|
|
|
* Class PCB_PLOT_PARAMS_PARSER
|
|
|
|
* is the parser class for PCB_PLOT_PARAMS.
|
|
|
|
*/
|
|
|
|
class PCB_PLOT_PARAMS_PARSER : public PCB_PLOT_PARAMS_LEXER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PCB_PLOT_PARAMS_PARSER( LINE_READER* aReader );
|
|
|
|
PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource );
|
2012-11-27 19:57:38 +00:00
|
|
|
|
2012-11-05 20:20:34 +00:00
|
|
|
LINE_READER* GetReader() { return reader; };
|
2012-11-27 19:57:38 +00:00
|
|
|
|
|
|
|
void Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( PARSE_ERROR, IO_ERROR );
|
2013-05-09 19:08:12 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool parseBool();
|
2012-11-05 20:20:34 +00:00
|
|
|
|
|
|
|
/**
|
2013-05-09 19:08:12 +00:00
|
|
|
* Function parseInt
|
2012-11-05 20:20:34 +00:00
|
|
|
* parses an integer and constrains it between two values.
|
|
|
|
* @param aMin is the smallest return value.
|
|
|
|
* @param aMax is the largest return value.
|
|
|
|
* @return int - the parsed integer.
|
|
|
|
*/
|
2013-05-09 19:08:12 +00:00
|
|
|
int parseInt( int aMin, int aMax );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function parseDouble
|
|
|
|
* parses a double
|
|
|
|
* @return double - the parsed double.
|
|
|
|
*/
|
|
|
|
double parseDouble();
|
2012-11-05 20:20:34 +00:00
|
|
|
};
|
|
|
|
|
2012-11-27 19:57:38 +00:00
|
|
|
|
2011-01-28 22:54:16 +00:00
|
|
|
/**
|
|
|
|
* Class PCB_PLOT_PARAMS
|
|
|
|
* handles plot parameters and options when plotting/printing a board.
|
|
|
|
*/
|
|
|
|
class PCB_PLOT_PARAMS
|
|
|
|
{
|
|
|
|
friend class PCB_PLOT_PARAMS_PARSER;
|
|
|
|
public:
|
2012-08-30 18:06:13 +00:00
|
|
|
enum DrillMarksType {
|
2011-01-28 22:54:16 +00:00
|
|
|
NO_DRILL_SHAPE = 0,
|
|
|
|
SMALL_DRILL_SHAPE = 1,
|
|
|
|
FULL_DRILL_SHAPE = 2
|
|
|
|
};
|
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
private:
|
2012-09-24 06:39:59 +00:00
|
|
|
// If true, do not plot NPTH pads
|
|
|
|
// (mainly used to disable NPTH pads plotting on copper layers)
|
|
|
|
bool m_skipNPTH_Pads;
|
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
/** LINE, FILLED or SKETCH selects how to plot filled objects.
|
|
|
|
* FILLED is not available with all drivers */
|
|
|
|
EDA_DRAW_MODE_T m_mode;
|
|
|
|
|
|
|
|
/// Plot format type (chooses the driver to be used)
|
|
|
|
PlotFormat m_format;
|
2012-01-09 08:35:06 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
/// Holes can be not plotted, have a small mark or plotted in actual size
|
|
|
|
DrillMarksType m_drillMarks;
|
2012-01-09 08:35:06 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
/// Choose how represent text with PS, PDF and DXF drivers
|
|
|
|
PlotTextMode m_textMode;
|
2011-01-28 22:54:16 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
/// The default line width (used for the frame and in LINE mode)
|
|
|
|
int m_lineWidth;
|
|
|
|
|
|
|
|
/// 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;
|
|
|
|
|
|
|
|
/// If false always plot (merge) the pcb edge layer on other layers
|
|
|
|
bool m_excludeEdgeLayer;
|
|
|
|
|
|
|
|
/// Set of layers to plot
|
2013-03-30 17:24:04 +00:00
|
|
|
LAYER_MSK m_layerSelection;
|
2012-08-30 18:06:13 +00:00
|
|
|
|
|
|
|
/** When plotting gerbers use a conventional set of extensions instead of
|
|
|
|
* appending a suffix to the board name */
|
|
|
|
bool m_useGerberExtensions;
|
|
|
|
|
|
|
|
/// Plot gerbers using auxiliary (drill) origin instead of page coordinates
|
|
|
|
bool m_useAuxOrigin;
|
|
|
|
|
|
|
|
/// On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
|
|
|
|
bool m_subtractMaskFromSilk;
|
|
|
|
|
|
|
|
/// Autoscale the plot to fit an A4 (landscape?) sheet
|
|
|
|
bool m_A4Output;
|
|
|
|
|
|
|
|
/// Scale ratio index (UI only)
|
|
|
|
int m_scaleSelection;
|
|
|
|
|
|
|
|
/// Output directory for plot files (usually relative to the board file)
|
|
|
|
wxString m_outputDirectory;
|
|
|
|
|
|
|
|
/// Enable plotting of part references
|
|
|
|
bool m_plotReference;
|
|
|
|
|
|
|
|
/// Enable plotting of part values
|
|
|
|
bool m_plotValue;
|
|
|
|
|
|
|
|
/// Force plotting of fields marked invisible
|
|
|
|
bool m_plotInvisibleText;
|
|
|
|
|
|
|
|
/// Allows pads outlines on silkscreen layer
|
|
|
|
/// (when pads are also on silk screen)
|
|
|
|
bool m_plotPadsOnSilkLayer;
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
2012-09-24 06:39:59 +00:00
|
|
|
/** 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;
|
2012-08-30 18:06:13 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
int m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas
|
|
|
|
int m_HPGLPenOvr; ///< HPGL only: pen overlay in MILS, useful only to fill areas
|
|
|
|
EDA_COLOR_T m_color; ///< Color for plotting the current layer
|
|
|
|
EDA_COLOR_T m_referenceColor; ///< Color for plotting references
|
|
|
|
EDA_COLOR_T m_valueColor; ///< Color for plotting values
|
2011-01-28 22:54:16 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
PCB_PLOT_PARAMS();
|
|
|
|
|
2012-09-24 06:39:59 +00:00
|
|
|
void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
|
|
|
|
bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
|
|
|
|
|
|
|
|
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 )
|
|
|
|
const throw( IO_ERROR );
|
2012-11-27 19:57:38 +00:00
|
|
|
void Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( PARSE_ERROR, IO_ERROR );
|
2011-01-28 22:54:16 +00:00
|
|
|
|
|
|
|
bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
|
|
|
|
bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
|
|
|
|
|
2012-12-08 23:58:03 +00:00
|
|
|
void SetColor( EDA_COLOR_T aVal ) { m_color = aVal; }
|
2012-08-30 18:06:13 +00:00
|
|
|
EDA_COLOR_T GetColor() const { return m_color; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-12-08 23:58:03 +00:00
|
|
|
void SetReferenceColor( EDA_COLOR_T aVal ) { m_referenceColor = aVal; }
|
2012-08-30 18:06:13 +00:00
|
|
|
EDA_COLOR_T GetReferenceColor() const { return m_referenceColor; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-12-08 23:58:03 +00:00
|
|
|
void SetValueColor( EDA_COLOR_T aVal ) { m_valueColor = aVal; }
|
2012-08-30 18:06:13 +00:00
|
|
|
EDA_COLOR_T GetValueColor() const { return m_valueColor; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; }
|
|
|
|
PlotTextMode GetTextMode() const { return m_textMode; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetMode( EDA_DRAW_MODE_T aVal ) { m_mode = aVal; }
|
|
|
|
EDA_DRAW_MODE_T GetMode() const { return m_mode; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; }
|
|
|
|
DrillMarksType GetDrillMarksType() const { return m_drillMarks; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetScale( double aVal ) { m_scale = aVal; }
|
|
|
|
double GetScale() const { return m_scale; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
|
|
|
|
double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
|
|
|
|
void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
|
|
|
|
double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
|
2012-09-24 06:39:59 +00:00
|
|
|
void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
|
|
|
|
int GetWidthAdjust() const { return m_widthAdjust; }
|
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
|
|
|
|
bool GetAutoScale() const { return m_autoScale; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetMirror( bool aFlag ) { m_mirror = aFlag; }
|
|
|
|
bool GetMirror() const { return m_mirror; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetPlotPadsOnSilkLayer( bool aFlag ) { m_plotPadsOnSilkLayer = aFlag; }
|
|
|
|
bool GetPlotPadsOnSilkLayer() const { return m_plotPadsOnSilkLayer; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
|
|
|
|
bool GetPlotInvisibleText() const { return m_plotInvisibleText; }
|
|
|
|
void SetPlotValue( bool aFlag ) { m_plotValue = aFlag; }
|
|
|
|
bool GetPlotValue() const { return m_plotValue; }
|
|
|
|
void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
|
|
|
|
bool GetPlotReference() const { return m_plotReference; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetNegative( bool aFlag ) { m_negative = aFlag; }
|
|
|
|
bool GetNegative() const { return m_negative; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
|
|
|
|
bool GetPlotViaOnMaskLayer() const { return m_plotViaOnMaskLayer; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; }
|
|
|
|
bool GetPlotFrameRef() const { return m_plotFrameRef; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
|
|
|
|
bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetFormat( PlotFormat aFormat ) { m_format = aFormat; };
|
|
|
|
PlotFormat GetFormat() const { return m_format; };
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; };
|
|
|
|
wxString GetOutputDirectory() const { return m_outputDirectory; };
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetUseGerberExtensions( bool aUse ) { m_useGerberExtensions = aUse; };
|
|
|
|
bool GetUseGerberExtensions() const { return m_useGerberExtensions; };
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; };
|
|
|
|
bool GetSubtractMaskFromSilk() const { return m_subtractMaskFromSilk; };
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetLayerSelection( long aSelection )
|
|
|
|
{ m_layerSelection = aSelection; };
|
|
|
|
long GetLayerSelection() const { return m_layerSelection; };
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; };
|
|
|
|
bool GetUseAuxOrigin() const { return m_useAuxOrigin; };
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; };
|
|
|
|
int GetScaleSelection() const { return m_scaleSelection; };
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
void SetA4Output( int aForce ) { m_A4Output = aForce; };
|
|
|
|
bool GetA4Output() const { return m_A4Output; };
|
|
|
|
|
|
|
|
int GetHPGLPenDiameter() const { return m_HPGLPenDiam; };
|
|
|
|
bool SetHPGLPenDiameter( int aValue );
|
|
|
|
int GetHPGLPenSpeed() const { return m_HPGLPenSpeed; };
|
|
|
|
bool SetHPGLPenSpeed( int aValue );
|
|
|
|
int GetHPGLPenOverlay() const { return m_HPGLPenOvr; };
|
|
|
|
bool SetHPGLPenOverlay( int aValue );
|
|
|
|
void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
|
|
|
|
int GetHPGLPenNum() const { return m_HPGLPenNum; }
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-08-30 18:06:13 +00:00
|
|
|
int GetLineWidth() const { return m_lineWidth; };
|
|
|
|
bool SetLineWidth( int aValue );
|
2011-01-28 22:54:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
/**
|
|
|
|
* Default line thickness in PCnew units used to draw or plot items having a
|
|
|
|
* default thickness line value (Frame references) (i.e. = 0 ).
|
|
|
|
* 0 = single pixel line width.
|
|
|
|
*/
|
|
|
|
extern int g_DrawDefaultLineThickness;
|
|
|
|
|
2011-01-28 22:54:16 +00:00
|
|
|
#endif // PCB_PLOT_PARAMS_H_
|