Commit cc47e88b authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew, plot functions: fix bug in SVG plotter, fix a minor other bug when...

Pcbnew, plot functions: fix bug in SVG plotter, fix a minor other bug when using PS plotter (trcak width fine adjust not working)
and plot code cleaning continued
parent 160560c9
...@@ -430,7 +430,6 @@ void PS_PLOTTER::SetCurrentLineWidth( int width ) ...@@ -430,7 +430,6 @@ void PS_PLOTTER::SetCurrentLineWidth( int width )
currentPenWidth = pen_width; currentPenWidth = pen_width;
} }
void PS_PLOTTER::emitSetRGBColor( double r, double g, double b ) void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
......
...@@ -228,15 +228,21 @@ void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w ...@@ -228,15 +228,21 @@ void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w
{ {
EDA_RECT rect( p1, wxSize( p2.x -p1.x, p2.y -p1.y ) ); EDA_RECT rect( p1, wxSize( p2.x -p1.x, p2.y -p1.y ) );
rect.Normalize(); rect.Normalize();
DPOINT pos_dev = userToDeviceCoordinates( rect.GetOrigin() ); DPOINT org_dev = userToDeviceCoordinates( rect.GetOrigin() );
DPOINT size_dev = userToDeviceSize( rect.GetSize() ); DPOINT end_dev = userToDeviceCoordinates( rect.GetEnd() );
DSIZE size_dev = end_dev - org_dev;
// Ensure size of rect in device coordinates is > 0
// Inkscape has problems with negative values for width and/or height
DBOX rect_dev( org_dev, size_dev);
rect_dev.Normalize();
setFillMode( fill ); setFillMode( fill );
SetCurrentLineWidth( width ); SetCurrentLineWidth( width );
fprintf( outputFile, fprintf( outputFile,
"<rect x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\" rx=\"%g\" />\n", "<rect x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\" rx=\"%g\" />\n",
pos_dev.x, pos_dev.y, size_dev.x, size_dev.y, rect_dev.GetPosition().x, rect_dev.GetPosition().y,
rect_dev.GetSize().x, rect_dev.GetSize().y,
0.0 // radius of rounded corners 0.0 // radius of rounded corners
); );
} }
......
...@@ -17,9 +17,6 @@ enum PAD_SHAPE_T ...@@ -17,9 +17,6 @@ enum PAD_SHAPE_T
PAD_RECT, PAD_RECT,
PAD_OVAL, PAD_OVAL,
PAD_TRAPEZOID, PAD_TRAPEZOID,
PAD_RRECT,
PAD_OCTAGON,
PAD_SQUARE,
}; };
......
...@@ -119,21 +119,6 @@ public: ...@@ -119,21 +119,6 @@ public:
virtual void SetDash( bool dashed ) = 0; virtual void SetDash( bool dashed ) = 0;
/** PLEASE NOTE: the plot width adjustment is actually done by the
* pcbnew routines, the plotter class only carry it along!
* XXX In fact it's only used during postscript plot, I'd move this
* variable as a static in pcbnew/plot_rtn.cpp. Also: why it's double?
* it's added to pad/track size and it's specified in IU, so it should
* be an int */
virtual void SetPlotWidthAdj( double width )
{
}
virtual double GetPlotWidthAdj()
{
return 0.;
}
virtual void SetCreator( const wxString& _creator ) virtual void SetCreator( const wxString& _creator )
{ {
creator = _creator; creator = _creator;
...@@ -452,7 +437,7 @@ protected: ...@@ -452,7 +437,7 @@ protected:
class PSLIKE_PLOTTER : public PLOTTER class PSLIKE_PLOTTER : public PLOTTER
{ {
public: public:
PSLIKE_PLOTTER() : plotScaleAdjX( 1 ), plotScaleAdjY( 1 ), plotWidthAdj( 0 ), PSLIKE_PLOTTER() : plotScaleAdjX( 1 ), plotScaleAdjY( 1 ),
m_textMode( PLOTTEXTMODE_PHANTOM ) m_textMode( PLOTTEXTMODE_PHANTOM )
{ {
} }
...@@ -476,20 +461,6 @@ public: ...@@ -476,20 +461,6 @@ public:
plotScaleAdjY = scaleY; plotScaleAdjY = scaleY;
} }
/**
* Set the 'width adjustment' for the postscript engine
* (useful for controlling toner bleeding during direct transfer)
*/
virtual void SetPlotWidthAdj( double width )
{
plotWidthAdj = width;
}
virtual double GetPlotWidthAdj() const
{
return plotWidthAdj;
}
// Pad routines are handled with lower level primitives // Pad routines are handled with lower level primitives
virtual void FlashPadCircle( const wxPoint& pos, int diametre, virtual void FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode ); EDA_DRAW_MODE_T trace_mode );
...@@ -538,14 +509,9 @@ protected: ...@@ -538,14 +509,9 @@ protected:
int returnPostscriptTextWidth( const wxString& aText, int aXSize, int returnPostscriptTextWidth( const wxString& aText, int aXSize,
bool aItalic, bool aBold ); bool aItalic, bool aBold );
/// Fine user scale /// Fine user scale adjust ( = 1.0 if no correction)
double plotScaleAdjX, plotScaleAdjY; double plotScaleAdjX, plotScaleAdjY;
/** Plot width adjust XXX should be moved in the PCB plotting
* routines!
*/
double plotWidthAdj;
/// How to draw text /// How to draw text
PlotTextMode m_textMode; PlotTextMode m_textMode;
}; };
......
...@@ -248,7 +248,11 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName ) ...@@ -248,7 +248,11 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
PCB_PLOT_PARAMS m_plotOpts; PCB_PLOT_PARAMS m_plotOpts;
m_plotOpts.SetPlotFrameRef( PrintPageRef() ); m_plotOpts.SetPlotFrameRef( PrintPageRef() );
// Adding drill marks
m_plotOpts.SetDrillMarksType( PCB_PLOT_PARAMS::FULL_DRILL_SHAPE ); m_plotOpts.SetDrillMarksType( PCB_PLOT_PARAMS::FULL_DRILL_SHAPE );
m_plotOpts.SetSkipPlotNPTH_Pads( false );
m_plotOpts.SetMirror( m_printMirror ); m_plotOpts.SetMirror( m_printMirror );
m_plotOpts.SetFormat( PLOT_FORMAT_SVG ); m_plotOpts.SetFormat( PLOT_FORMAT_SVG );
EDA_COLOR_T color = UNSPECIFIED_COLOR; // Used layer color to plot ref and value EDA_COLOR_T color = UNSPECIFIED_COLOR; // Used layer color to plot ref and value
...@@ -278,10 +282,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName ) ...@@ -278,10 +282,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
if( plotter ) if( plotter )
{ {
plotter->SetColorMode( m_ModeColorOption->GetSelection() == 0 ); plotter->SetColorMode( m_ModeColorOption->GetSelection() == 0 );
PlotStandardLayer( brd, plotter, m_PrintMaskLayer, m_plotOpts, true, false ); PlotStandardLayer( brd, plotter, m_PrintMaskLayer, m_plotOpts );
// Adding drill marks, if required and if the plotter is able to plot them:
if( m_plotOpts.GetDrillMarksType() != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
PlotDrillMarks( brd, plotter, m_plotOpts );
} }
plotter->EndPlot(); plotter->EndPlot();
......
...@@ -61,12 +61,16 @@ void DIALOG_PLOT::Init_Dialog() ...@@ -61,12 +61,16 @@ void DIALOG_PLOT::Init_Dialog()
m_config->Read( OPTKEY_PLOT_X_FINESCALE_ADJ, &m_XScaleAdjust ); m_config->Read( OPTKEY_PLOT_X_FINESCALE_ADJ, &m_XScaleAdjust );
m_config->Read( OPTKEY_PLOT_Y_FINESCALE_ADJ, &m_YScaleAdjust ); m_config->Read( OPTKEY_PLOT_Y_FINESCALE_ADJ, &m_YScaleAdjust );
m_config->Read( CONFIG_PS_FINEWIDTH_ADJ, &m_PSWidthAdjust );
// m_PSWidthAdjust is stored in mm in user config
double dtmp;
m_config->Read( CONFIG_PS_FINEWIDTH_ADJ, &dtmp, 0 );
m_PSWidthAdjust = KiROUND( dtmp * IU_PER_MM );
// The reasonable width correction value must be in a range of // The reasonable width correction value must be in a range of
// [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils. // [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
m_WidthAdjustMinValue = -(m_board->GetDesignSettings().m_TrackMinWidth - 1); m_widthAdjustMinValue = -(m_board->GetDesignSettings().m_TrackMinWidth - 1);
m_WidthAdjustMaxValue = m_board->GetSmallestClearanceValue() - 1; m_widthAdjustMaxValue = m_board->GetSmallestClearanceValue() - 1;
switch( m_plotOpts.GetFormat() ) switch( m_plotOpts.GetFormat() )
{ {
...@@ -130,7 +134,7 @@ void DIALOG_PLOT::Init_Dialog() ...@@ -130,7 +134,7 @@ void DIALOG_PLOT::Init_Dialog()
m_fineAdjustYscaleOpt->AppendText( msg ); m_fineAdjustYscaleOpt->AppendText( msg );
// Test for a reasonable PS width correction value. Set to 0 if problem. // Test for a reasonable PS width correction value. Set to 0 if problem.
if( m_PSWidthAdjust < m_WidthAdjustMinValue || m_PSWidthAdjust > m_WidthAdjustMaxValue ) if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue )
m_PSWidthAdjust = 0.; m_PSWidthAdjust = 0.;
msg.Printf( wxT( "%f" ), To_User_Unit( g_UserUnit, m_PSWidthAdjust ) ); msg.Printf( wxT( "%f" ), To_User_Unit( g_UserUnit, m_PSWidthAdjust ) );
...@@ -289,7 +293,8 @@ PlotFormat DIALOG_PLOT::GetPlotFormat() ...@@ -289,7 +293,8 @@ PlotFormat DIALOG_PLOT::GetPlotFormat()
return plotFmt[ m_plotFormatOpt->GetSelection() ]; return plotFmt[ m_plotFormatOpt->GetSelection() ];
} }
// Enable or disable widgets according to the plot format selected
// and clear also some optional values
void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
{ {
switch( GetPlotFormat() ) switch( GetPlotFormat() )
...@@ -311,11 +316,13 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) ...@@ -311,11 +316,13 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_useGerberExtensions->Enable( false ); m_useGerberExtensions->Enable( false );
m_useGerberExtensions->SetValue( false ); m_useGerberExtensions->SetValue( false );
m_scaleOpt->Enable( false ); m_scaleOpt->Enable( false );
m_scaleOpt->SetSelection( 1 );
m_fineAdjustXscaleOpt->Enable( false ); m_fineAdjustXscaleOpt->Enable( false );
m_fineAdjustYscaleOpt->Enable( false ); m_fineAdjustYscaleOpt->Enable( false );
m_PSFineAdjustWidthOpt->Enable( false ); m_PSFineAdjustWidthOpt->Enable( false );
m_plotPSNegativeOpt->Enable( false ); m_plotPSNegativeOpt->Enable( true );
m_forcePSA4OutputOpt->Enable( false ); m_forcePSA4OutputOpt->Enable( false );
m_forcePSA4OutputOpt->SetValue( false );
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer ); m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer ); m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
...@@ -469,6 +476,22 @@ static bool setDouble( double* aResult, double aValue, double aMin, double aMax ...@@ -469,6 +476,22 @@ static bool setDouble( double* aResult, double aValue, double aMin, double aMax
*aResult = aValue; *aResult = aValue;
return true; return true;
} }
static bool setInt( int* aResult, int aValue, int aMin, int aMax )
{
if( aValue < aMin )
{
*aResult = aMin;
return false;
}
else if( aValue > aMax )
{
*aResult = aMax;
return false;
}
*aResult = aValue;
return true;
}
void DIALOG_PLOT::applyPlotSettings() void DIALOG_PLOT::applyPlotSettings()
...@@ -476,22 +499,15 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -476,22 +499,15 @@ void DIALOG_PLOT::applyPlotSettings()
PCB_PLOT_PARAMS tempOptions; PCB_PLOT_PARAMS tempOptions;
tempOptions.SetExcludeEdgeLayer( m_excludeEdgeLayerOpt->GetValue() ); tempOptions.SetExcludeEdgeLayer( m_excludeEdgeLayerOpt->GetValue() );
tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() ); tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() ); tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
tempOptions.SetPlotPadsOnSilkLayer( m_plotPads_on_Silkscreen->GetValue() ); tempOptions.SetPlotPadsOnSilkLayer( m_plotPads_on_Silkscreen->GetValue() );
tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() ); tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() ); tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() ); tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );
tempOptions.SetPlotOtherText( m_plotTextOther->GetValue() ); tempOptions.SetPlotOtherText( m_plotTextOther->GetValue() );
tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() ); tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() ); tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
tempOptions.SetDrillMarksType( static_cast<PCB_PLOT_PARAMS::DrillMarksType> tempOptions.SetDrillMarksType( static_cast<PCB_PLOT_PARAMS::DrillMarksType>
( m_drillShapeOpt->GetSelection() ) ); ( m_drillShapeOpt->GetSelection() ) );
tempOptions.SetMirror( m_plotMirrorOpt->GetValue() ); tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
...@@ -581,22 +597,23 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -581,22 +597,23 @@ void DIALOG_PLOT::applyPlotSettings()
// PS Width correction // PS Width correction
msg = m_PSFineAdjustWidthOpt->GetValue(); msg = m_PSFineAdjustWidthOpt->GetValue();
tmpDouble = ReturnValueFromString( g_UserUnit, msg ); int itmp = ReturnValueFromString( g_UserUnit, msg );
if( !setDouble( &m_PSWidthAdjust, tmpDouble, m_WidthAdjustMinValue, m_WidthAdjustMaxValue ) ) if( !setInt( &m_PSWidthAdjust, itmp, m_widthAdjustMinValue, m_widthAdjustMaxValue ) )
{ {
msg = ReturnStringFromValue( g_UserUnit, m_PSWidthAdjust ); msg = ReturnStringFromValue( g_UserUnit, m_PSWidthAdjust );
m_PSFineAdjustWidthOpt->SetValue( msg ); m_PSFineAdjustWidthOpt->SetValue( msg );
msg.Printf( _( "Width correction constrained!\n" msg.Printf( _( "Width correction constrained!\n"
"The reasonable width correction value must be in a range of\n" "The reasonable width correction value must be in a range of\n"
" [%+f; %+f] (%s) for current design rules!\n" ), " [%+f; %+f] (%s) for current design rules!\n" ),
To_User_Unit( g_UserUnit, m_WidthAdjustMinValue ), To_User_Unit( g_UserUnit, m_widthAdjustMinValue ),
To_User_Unit( g_UserUnit, m_WidthAdjustMaxValue ), To_User_Unit( g_UserUnit, m_widthAdjustMaxValue ),
( g_UserUnit == INCHES ) ? wxT( "\"" ) : wxT( "mm" ) ); ( g_UserUnit == INCHES ) ? wxT( "\"" ) : wxT( "mm" ) );
m_messagesBox->AppendText( msg ); m_messagesBox->AppendText( msg );
} }
m_config->Write( CONFIG_PS_FINEWIDTH_ADJ, m_PSWidthAdjust ); // Store m_PSWidthAdjust in mm in user config
m_config->Write( CONFIG_PS_FINEWIDTH_ADJ, (double)m_PSWidthAdjust / IU_PER_MM );
tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
......
...@@ -47,12 +47,12 @@ private: ...@@ -47,12 +47,12 @@ private:
// plotter X scaling error // plotter X scaling error
double m_YScaleAdjust; // X scale factor adjust to compensate double m_YScaleAdjust; // X scale factor adjust to compensate
// plotter Y scaling error // plotter Y scaling error
double m_PSWidthAdjust; // Global width correction for exact line width int m_PSWidthAdjust; // Global width correction for exact line width
// in postscript output. // in postscript output.
// this is a correction factor for tracks width // this is a correction factor for tracks width
// when plotted // when plotted
double m_WidthAdjustMinValue; // Global track width limits int m_widthAdjustMinValue; // Global track width limits
double m_WidthAdjustMaxValue; // tracks width will be "clipped" whenever the int m_widthAdjustMaxValue; // tracks width will be "clipped" whenever the
// m_PSWidthAdjust to these limits. // m_PSWidthAdjust to these limits.
PCB_PLOT_PARAMS m_plotOpts; PCB_PLOT_PARAMS m_plotOpts;
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -116,13 +116,16 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr ...@@ -116,13 +116,16 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizerPlotItems->Add( m_plotNoViaOnMaskOpt, 0, wxALL, 2 ); bSizerPlotItems->Add( m_plotNoViaOnMaskOpt, 0, wxALL, 2 );
m_plotMirrorOpt = new wxCheckBox( this, ID_MIROR_OPT, _("Mirrored plot"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotMirrorOpt, 0, wxALL, 2 );
m_excludeEdgeLayerOpt = new wxCheckBox( this, wxID_ANY, _("Exclude PCB edge layer from other layers"), wxDefaultPosition, wxDefaultSize, 0 ); m_excludeEdgeLayerOpt = new wxCheckBox( this, wxID_ANY, _("Exclude PCB edge layer from other layers"), wxDefaultPosition, wxDefaultSize, 0 );
m_excludeEdgeLayerOpt->SetToolTip( _("Exclude contents of the pcb edge layer from all other layers") ); m_excludeEdgeLayerOpt->SetToolTip( _("Exclude contents of the pcb edge layer from all other layers") );
bSizerPlotItems->Add( m_excludeEdgeLayerOpt, 0, wxTOP|wxRIGHT|wxLEFT, 2 ); bSizerPlotItems->Add( m_excludeEdgeLayerOpt, 0, wxALL, 2 );
m_plotMirrorOpt = new wxCheckBox( this, ID_MIROR_OPT, _("Mirrored plot"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotMirrorOpt, 0, wxALL, 2 );
m_plotPSNegativeOpt = new wxCheckBox( this, wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotPSNegativeOpt, 0, wxALL, 2 );
bSizer192->Add( bSizerPlotItems, 0, wxEXPAND, 5 ); bSizer192->Add( bSizerPlotItems, 0, wxEXPAND, 5 );
...@@ -301,9 +304,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr ...@@ -301,9 +304,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_PSOptionsSizer->Add( bSizer17, 1, wxEXPAND, 5 ); m_PSOptionsSizer->Add( bSizer17, 1, wxEXPAND, 5 );
m_plotPSNegativeOpt = new wxCheckBox( this, wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 );
m_PSOptionsSizer->Add( m_plotPSNegativeOpt, 0, wxALL, 2 );
m_forcePSA4OutputOpt = new wxCheckBox( this, wxID_ANY, _("Force A4 output"), wxDefaultPosition, wxDefaultSize, 0 ); m_forcePSA4OutputOpt = new wxCheckBox( this, wxID_ANY, _("Force A4 output"), wxDefaultPosition, wxDefaultSize, 0 );
m_PSOptionsSizer->Add( m_forcePSA4OutputOpt, 0, wxALL, 2 ); m_PSOptionsSizer->Add( m_forcePSA4OutputOpt, 0, wxALL, 2 );
......
...@@ -1344,6 +1344,94 @@ ...@@ -1344,6 +1344,94 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Exclude PCB edge layer from other layers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_excludeEdgeLayerOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Exclude contents of the pcb edge layer from all other layers</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">2</property> <property name="border">2</property>
<property name="flag">wxALL</property> <property name="flag">wxALL</property>
...@@ -1434,7 +1522,7 @@ ...@@ -1434,7 +1522,7 @@
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">2</property> <property name="border">2</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="0"> <object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -1465,7 +1553,7 @@ ...@@ -1465,7 +1553,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Exclude PCB edge layer from other layers</property> <property name="label">Negative plot</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
...@@ -1473,7 +1561,7 @@ ...@@ -1473,7 +1561,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_excludeEdgeLayerOpt</property> <property name="name">m_plotPSNegativeOpt</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
...@@ -1486,7 +1574,7 @@ ...@@ -1486,7 +1574,7 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">Exclude contents of the pcb edge layer from all other layers</property> <property name="tooltip"></property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
...@@ -3103,7 +3191,7 @@ ...@@ -3103,7 +3191,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="0"> <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -3288,7 +3376,7 @@ ...@@ -3288,7 +3376,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="0"> <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -3473,7 +3561,7 @@ ...@@ -3473,7 +3561,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property> <property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -3649,94 +3737,6 @@ ...@@ -3649,94 +3737,6 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Negative plot</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_plotPSNegativeOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">2</property> <property name="border">2</property>
<property name="flag">wxALL</property> <property name="flag">wxALL</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -61,8 +61,9 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM ...@@ -61,8 +61,9 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
wxCheckBox* m_plotTextOther; wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText; wxCheckBox* m_plotInvisibleText;
wxCheckBox* m_plotNoViaOnMaskOpt; wxCheckBox* m_plotNoViaOnMaskOpt;
wxCheckBox* m_plotMirrorOpt;
wxCheckBox* m_excludeEdgeLayerOpt; wxCheckBox* m_excludeEdgeLayerOpt;
wxCheckBox* m_plotMirrorOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxStaticText* m_staticText11; wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt; wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12; wxStaticText* m_staticText12;
...@@ -89,7 +90,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM ...@@ -89,7 +90,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
wxTextCtrl* m_fineAdjustYscaleOpt; wxTextCtrl* m_fineAdjustYscaleOpt;
wxStaticText* m_textPSFineAdjustWidth; wxStaticText* m_textPSFineAdjustWidth;
wxTextCtrl* m_PSFineAdjustWidthOpt; wxTextCtrl* m_PSFineAdjustWidthOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxCheckBox* m_forcePSA4OutputOpt; wxCheckBox* m_forcePSA4OutputOpt;
wxTextCtrl* m_messagesBox; wxTextCtrl* m_messagesBox;
wxButton* m_plotButton; wxButton* m_plotButton;
......
...@@ -756,7 +756,6 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR ) ...@@ -756,7 +756,6 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as setup." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as setup." ) );
T token; T token;
int lastTraceWidth;
NETCLASS* defaultNetclass = m_board->m_NetClasses.GetDefault(); NETCLASS* defaultNetclass = m_board->m_NetClasses.GetDefault();
BOARD_DESIGN_SETTINGS designSettings = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS designSettings = m_board->GetDesignSettings();
ZONE_SETTINGS zoneSettings = m_board->GetZoneSettings(); ZONE_SETTINGS zoneSettings = m_board->GetZoneSettings();
...@@ -770,8 +769,8 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR ) ...@@ -770,8 +769,8 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
switch( token ) switch( token )
{ {
case T_last_trace_width: case T_last_trace_width: // not used now
lastTraceWidth = parseBoardUnits( T_last_trace_width ); /* lastTraceWidth =*/ parseBoardUnits( T_last_trace_width );
NeedRIGHT(); NeedRIGHT();
break; break;
......
...@@ -112,6 +112,10 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() ...@@ -112,6 +112,10 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_referenceColor = BLACK; m_referenceColor = BLACK;
m_valueColor = BLACK; m_valueColor = BLACK;
m_textMode = PLOTTEXTMODE_PHANTOM; m_textMode = PLOTTEXTMODE_PHANTOM;
// This parameter controls if the NPTH pads will be plotted or not
// it is are "local" parameters
m_skipNPTH_Pads = false;
} }
......
...@@ -47,6 +47,10 @@ public: ...@@ -47,6 +47,10 @@ public:
}; };
private: private:
// If true, do not plot NPTH pads
// (mainly used to disable NPTH pads plotting on copper layers)
bool m_skipNPTH_Pads;
/** LINE, FILLED or SKETCH selects how to plot filled objects. /** LINE, FILLED or SKETCH selects how to plot filled objects.
* FILLED is not available with all drivers */ * FILLED is not available with all drivers */
EDA_DRAW_MODE_T m_mode; EDA_DRAW_MODE_T m_mode;
...@@ -132,10 +136,10 @@ private: ...@@ -132,10 +136,10 @@ private:
double m_fineScaleAdjustX; ///< fine scale adjust X axis double m_fineScaleAdjustX; ///< fine scale adjust X axis
double m_fineScaleAdjustY; ///< fine scale adjust Y axis double m_fineScaleAdjustY; ///< fine scale adjust Y axis
/** This width factor is intended to compensate printers and plotters that do /** This width factor is intended to compensate PS printers/ plotters that do
* not strictly obey line width settings. Only used for pads and zone * not strictly obey line width settings. Only used to plot pads and tracks
* filling AFAIK */ */
double m_widthAdjust; int m_widthAdjust;
int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9) 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_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
...@@ -148,7 +152,11 @@ private: ...@@ -148,7 +152,11 @@ private:
public: public:
PCB_PLOT_PARAMS(); PCB_PLOT_PARAMS();
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const throw( IO_ERROR ); 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 );
void Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( IO_ERROR, PARSE_ERROR ); void Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( IO_ERROR, PARSE_ERROR );
bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const; bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
...@@ -156,30 +164,41 @@ public: ...@@ -156,30 +164,41 @@ public:
void SetColor( EDA_COLOR_T aVal ) { m_color = aVal; } void SetColor( EDA_COLOR_T aVal ) { m_color = aVal; }
EDA_COLOR_T GetColor() const { return m_color; } EDA_COLOR_T GetColor() const { return m_color; }
void SetReferenceColor( EDA_COLOR_T aVal ) { m_referenceColor = aVal; } void SetReferenceColor( EDA_COLOR_T aVal ) { m_referenceColor = aVal; }
EDA_COLOR_T GetReferenceColor() const { return m_referenceColor; } EDA_COLOR_T GetReferenceColor() const { return m_referenceColor; }
void SetValueColor( EDA_COLOR_T aVal ) { m_valueColor = aVal; } void SetValueColor( EDA_COLOR_T aVal ) { m_valueColor = aVal; }
EDA_COLOR_T GetValueColor() const { return m_valueColor; } EDA_COLOR_T GetValueColor() const { return m_valueColor; }
void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; } void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; }
PlotTextMode GetTextMode() const { return m_textMode; } PlotTextMode GetTextMode() const { return m_textMode; }
void SetMode( EDA_DRAW_MODE_T aVal ) { m_mode = aVal; } void SetMode( EDA_DRAW_MODE_T aVal ) { m_mode = aVal; }
EDA_DRAW_MODE_T GetMode() const { return m_mode; } EDA_DRAW_MODE_T GetMode() const { return m_mode; }
void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; } void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; }
DrillMarksType GetDrillMarksType() const { return m_drillMarks; } DrillMarksType GetDrillMarksType() const { return m_drillMarks; }
void SetScale( double aVal ) { m_scale = aVal; } void SetScale( double aVal ) { m_scale = aVal; }
double GetScale() const { return m_scale; } double GetScale() const { return m_scale; }
void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; } void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; } double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; } void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; } double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
void SetWidthAdjust( double aVal ) { m_widthAdjust = aVal; } void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
double GetWidthAdjust() const { return m_widthAdjust; } int GetWidthAdjust() const { return m_widthAdjust; }
void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; } void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
bool GetAutoScale() const { return m_autoScale; } bool GetAutoScale() const { return m_autoScale; }
void SetMirror( bool aFlag ) { m_mirror = aFlag; } void SetMirror( bool aFlag ) { m_mirror = aFlag; }
bool GetMirror() const { return m_mirror; } bool GetMirror() const { return m_mirror; }
void SetPlotPadsOnSilkLayer( bool aFlag ) { m_plotPadsOnSilkLayer = aFlag; } void SetPlotPadsOnSilkLayer( bool aFlag ) { m_plotPadsOnSilkLayer = aFlag; }
bool GetPlotPadsOnSilkLayer() const { return m_plotPadsOnSilkLayer; } bool GetPlotPadsOnSilkLayer() const { return m_plotPadsOnSilkLayer; }
void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; } void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
bool GetPlotInvisibleText() const { return m_plotInvisibleText; } bool GetPlotInvisibleText() const { return m_plotInvisibleText; }
void SetPlotOtherText( bool aFlag ) { m_plotOtherText = aFlag; } void SetPlotOtherText( bool aFlag ) { m_plotOtherText = aFlag; }
...@@ -188,29 +207,41 @@ public: ...@@ -188,29 +207,41 @@ public:
bool GetPlotValue() const { return m_plotValue; } bool GetPlotValue() const { return m_plotValue; }
void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; } void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
bool GetPlotReference() const { return m_plotReference; } bool GetPlotReference() const { return m_plotReference; }
void SetNegative( bool aFlag ) { m_negative = aFlag; } void SetNegative( bool aFlag ) { m_negative = aFlag; }
bool GetNegative() const { return m_negative; } bool GetNegative() const { return m_negative; }
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_plotFrameRef = aFlag; }
bool GetPlotFrameRef() const { return m_plotFrameRef; } bool GetPlotFrameRef() const { return m_plotFrameRef; }
void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; } void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; } bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
void SetFormat( PlotFormat aFormat ) { m_format = aFormat; }; void SetFormat( PlotFormat aFormat ) { m_format = aFormat; };
PlotFormat GetFormat() const { return m_format; }; PlotFormat GetFormat() const { return m_format; };
void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; }; void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; };
wxString GetOutputDirectory() const { return m_outputDirectory; }; wxString GetOutputDirectory() const { return m_outputDirectory; };
void SetUseGerberExtensions( bool aUse ) { m_useGerberExtensions = aUse; }; void SetUseGerberExtensions( bool aUse ) { m_useGerberExtensions = aUse; };
bool GetUseGerberExtensions() const { return m_useGerberExtensions; }; bool GetUseGerberExtensions() const { return m_useGerberExtensions; };
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; };
void SetLayerSelection( long aSelection ) void SetLayerSelection( long aSelection )
{ m_layerSelection = aSelection; }; { m_layerSelection = aSelection; };
long GetLayerSelection() const { return m_layerSelection; }; long GetLayerSelection() const { return m_layerSelection; };
void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; }; void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; };
bool GetUseAuxOrigin() const { return m_useAuxOrigin; }; bool GetUseAuxOrigin() const { return m_useAuxOrigin; };
void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; }; void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; };
int GetScaleSelection() const { return m_scaleSelection; }; int GetScaleSelection() const { return m_scaleSelection; };
void SetA4Output( int aForce ) { m_A4Output = aForce; }; void SetA4Output( int aForce ) { m_A4Output = aForce; };
bool GetA4Output() const { return m_A4Output; }; bool GetA4Output() const { return m_A4Output; };
...@@ -222,6 +253,7 @@ public: ...@@ -222,6 +253,7 @@ public:
bool SetHPGLPenOverlay( int aValue ); bool SetHPGLPenOverlay( int aValue );
void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; } void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
int GetHPGLPenNum() const { return m_HPGLPenNum; } int GetHPGLPenNum() const { return m_HPGLPenNum; }
int GetLineWidth() const { return m_lineWidth; }; int GetLineWidth() const { return m_lineWidth; };
bool SetLineWidth( int aValue ); bool SetLineWidth( int aValue );
}; };
......
...@@ -274,7 +274,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -274,7 +274,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
wxString msg; wxString msg;
if( plotter ) if( plotter )
{ {
PlotBoardLayer( board, plotter, layer, m_plotOpts ); PlotOneBoardLayer( board, plotter, layer, m_plotOpts );
plotter->EndPlot(); plotter->EndPlot();
delete plotter; delete plotter;
...@@ -372,7 +372,7 @@ bool PLOT_CONTROLLER::PlotLayer( int aLayer )/*{{{*/ ...@@ -372,7 +372,7 @@ bool PLOT_CONTROLLER::PlotLayer( int aLayer )/*{{{*/
return false; return false;
// Fully delegated to the parent // Fully delegated to the parent
PlotBoardLayer( m_board, m_plotter, aLayer, m_plotOpts ); PlotOneBoardLayer( m_board, m_plotter, aLayer, m_plotOpts );
return true; return true;
}/*}}}*/ }/*}}}*/
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef PCBPLOT_H_ #ifndef PCBPLOT_H_
#define PCBPLOT_H_ #define PCBPLOT_H_
#include <pad_shapes.h>
#include <pcb_plot_params.h> #include <pcb_plot_params.h>
class PLOTTER; class PLOTTER;
...@@ -52,6 +53,7 @@ class BRDITEMS_PLOTTER: public PCB_PLOT_PARAMS ...@@ -52,6 +53,7 @@ class BRDITEMS_PLOTTER: public PCB_PLOT_PARAMS
BOARD* m_board; BOARD* m_board;
int m_layerMask; int m_layerMask;
public: public:
BRDITEMS_PLOTTER( PLOTTER* aPlotter, BOARD* aBoard, const PCB_PLOT_PARAMS& aPlotOpts ) BRDITEMS_PLOTTER( PLOTTER* aPlotter, BOARD* aBoard, const PCB_PLOT_PARAMS& aPlotOpts )
: PCB_PLOT_PARAMS( aPlotOpts ) : PCB_PLOT_PARAMS( aPlotOpts )
...@@ -61,6 +63,18 @@ public: ...@@ -61,6 +63,18 @@ public:
m_layerMask = 0; m_layerMask = 0;
} }
/**
* @return a 'width adjustment' for the postscript engine
* (useful for controlling toner bleeding during direct transfer)
* addded to track width and via/pads size
*/
int getFineWidthAdj()
{
if( GetFormat() == PLOT_FORMAT_POST )
return GetWidthAdjust();
else
return 0;
}
// Basic functions to plot a board item // Basic functions to plot a board item
void SetLayerMask( int aLayerMask ){ m_layerMask = aLayerMask; } void SetLayerMask( int aLayerMask ){ m_layerMask = aLayerMask; }
void Plot_Edges_Modules(); void Plot_Edges_Modules();
...@@ -73,6 +87,20 @@ public: ...@@ -73,6 +87,20 @@ public:
void PlotTextePcb( TEXTE_PCB* pt_texte ); void PlotTextePcb( TEXTE_PCB* pt_texte );
void PlotDrawSegment( DRAWSEGMENT* PtSegm ); void PlotDrawSegment( DRAWSEGMENT* PtSegm );
/**
* lot items like text and graphics,
* but not tracks and modules
*/
void PlotBoardGraphicItems();
/** Function PlotDrillMarks
* Draw a drill mark for pads and vias.
* Must be called after all drawings, because it
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in
* FILLED plot mode (for PS and PDF outputs)
*/
void PlotDrillMarks();
/** /**
* Function getColor * Function getColor
* @return the layer color * @return the layer color
...@@ -82,6 +110,16 @@ public: ...@@ -82,6 +110,16 @@ public:
* so the returned color is LIGHTGRAY when the layer color is WHITE * so the returned color is LIGHTGRAY when the layer color is WHITE
*/ */
EDA_COLOR_T getColor( int aLayer ); EDA_COLOR_T getColor( int aLayer );
private:
/** Helper function to plot a single drill mark. It compensate and clamp
* the drill mark size depending on the current plot options
*/
void plotOneDrillMark( PAD_SHAPE_T aDrillShape,
const wxPoint &aDrillPos, wxSize aDrillSize,
const wxSize &aPadSize,
double aOrientation, int aSmallDrill );
}; };
PLOTTER *StartPlotBoard( BOARD *aBoard, PLOTTER *StartPlotBoard( BOARD *aBoard,
...@@ -90,34 +128,41 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, ...@@ -90,34 +128,41 @@ PLOTTER *StartPlotBoard( BOARD *aBoard,
const wxString& aSheetDesc ); const wxString& aSheetDesc );
/** /**
* Function PlotBoardLayer * Function PlotOneBoardLayer
* main function to plot copper or technical layers. * main function to plot one copper or technical layer.
* It calls the specilize plot function, according to the layer type * It prepare options and calls the specilized plot function,
* according to the layer type
* @param aBoard = the board to plot * @param aBoard = the board to plot
* @param aPlotter = the plotter to use * @param aPlotter = the plotter to use
* @param aLayer = the layer id to plot * @param aLayer = the layer id to plot
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only * @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
*/ */
void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer, void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
const PCB_PLOT_PARAMS& aPlotOpt ); const PCB_PLOT_PARAMS& aPlotOpt );
/** /**
* Function Plot_Standard_Layer * Function PlotStandardLayer
* plot copper or technical layers. * plot copper or technical layers.
* not used for silk screen layers, because these layers have specific * not used for silk screen layers, because these layers have specific
* requirements, mainly for pads * requirements, mainly for pads
* @param aBoard = the board to plot * @param aBoard = the board to plot
* @param aPlotter = the plotter to use * @param aPlotter = the plotter to use
* @param aLayerMask = the mask to define the layers to plot * @param aLayerMask = the mask to define the layers to plot
* @param aPlotVia = true to plot vias, false to skip vias (has meaning
* only for solder mask layers).
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only * @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
* @param aSkipNPTH_Pads = true to skip NPTH Pads, when the pad size and the pad hole *
* aPlotOpt has 3 important options to controle this plot,
* which are set, depending on the layer typpe to plot
* SetEnablePlotVia( bool aEnable )
* aEnable = true to plot vias, false to skip vias (has meaning
* only for solder mask layers).
* SetSkipPlotNPTH_Pads( bool aSkip )
* aSkip = true to skip NPTH Pads, when the pad size and the pad hole
* have the same size. Used in GERBER format only. * have the same size. Used in GERBER format only.
* SetDrillMarksType( DrillMarksType aVal ) controle the actual hole:
* no hole, small hole, actual hole
*/ */
void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt, const PCB_PLOT_PARAMS& aPlotOpt );
bool aPlotVia, bool aSkipNPTH_Pads );
/** /**
* Function PlotSilkScreen * Function PlotSilkScreen
...@@ -131,18 +176,6 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, ...@@ -131,18 +176,6 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt ); const PCB_PLOT_PARAMS& aPlotOpt );
/**
* Function PlotDrillMarks
* Draw a drill mark for pads and vias.
* Must be called after all drawings, because it
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape
* in FILLED plot mode
* @param aBoard = the board to plot
* @param aPlotter = the PLOTTER
* @param aPlotOpts = plot options
*/
void PlotDrillMarks( BOARD *aBoard, PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts );
// PLOTGERB.CPP // PLOTGERB.CPP
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize ); void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
......
...@@ -112,44 +112,48 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) ...@@ -112,44 +112,48 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
return true; return true;
} }
/* Creates the plot for silkscreen layers
*/
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt )
{
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
itemplotter.SetLayerMask( aLayerMask );
// Plot edge layer and graphic items // plot items like text and graphics, but not tracks and module
for( EDA_ITEM* item = aBoard->m_Drawings; item; item = item->Next() ) void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
{
for( BOARD_ITEM* item = m_board->m_Drawings; item; item = item->Next() )
{ {
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_LINE_T: case PCB_LINE_T:
itemplotter.PlotDrawSegment( (DRAWSEGMENT*) item); PlotDrawSegment( (DRAWSEGMENT*) item);
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
itemplotter.PlotTextePcb( (TEXTE_PCB*) item ); PlotTextePcb( (TEXTE_PCB*) item );
break; break;
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
itemplotter.PlotDimension( (DIMENSION*) item ); PlotDimension( (DIMENSION*) item );
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
itemplotter.PlotPcbTarget( (PCB_TARGET*) item ); PlotPcbTarget( (PCB_TARGET*) item );
break; break;
case PCB_MARKER_T: case PCB_MARKER_T:
break;
default: default:
wxLogMessage( wxT( "PlotSilkScreen() error: unexpected Type(%d)" ),
item->Type() );
break; break;
} }
} }
}
/* Creates the plot for silkscreen layers
*/
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt )
{
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
itemplotter.SetLayerMask( aLayerMask );
// Plot edge layer and graphic items
itemplotter.PlotBoardGraphicItems();
// Plot footprint outlines : // Plot footprint outlines :
itemplotter.Plot_Edges_Modules(); itemplotter.Plot_Edges_Modules();
...@@ -682,9 +686,10 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) ...@@ -682,9 +686,10 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
} }
void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer, void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
const PCB_PLOT_PARAMS& aPlotOpt ) const PCB_PLOT_PARAMS& aPlotOpt )
{ {
PCB_PLOT_PARAMS plotOpt = aPlotOpt;
// Set a default color and the text mode for this layer // Set a default color and the text mode for this layer
aPlotter->SetColor( aPlotOpt.GetColor() ); aPlotter->SetColor( aPlotOpt.GetColor() );
aPlotter->SetTextMode( aPlotOpt.GetTextMode() ); aPlotter->SetTextMode( aPlotOpt.GetTextMode() );
...@@ -715,48 +720,53 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer, ...@@ -715,48 +720,53 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
case LAYER_N_15: case LAYER_N_15:
case LAST_COPPER_LAYER: case LAST_COPPER_LAYER:
// Skip NPTH pads on copper layers ( only if hole size == pad size ): // Skip NPTH pads on copper layers ( only if hole size == pad size ):
PlotStandardLayer( aBoard, aPlotter, layer_mask, aPlotOpt, true, true ); plotOpt.SetSkipPlotNPTH_Pads( true );
// Drill mark will be plotted,
// Adding drill marks, if required and if the plotter is able to plot them: // if drill mark is SMALL_DRILL_SHAPE or FULL_DRILL_SHAPE
if( aPlotOpt.GetDrillMarksType() != PCB_PLOT_PARAMS::NO_DRILL_SHAPE ) PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
PlotDrillMarks( aBoard, aPlotter, aPlotOpt );
break; break;
case SOLDERMASK_N_BACK: case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT: case SOLDERMASK_N_FRONT:
PlotStandardLayer( aBoard, aPlotter, layer_mask, aPlotOpt, plotOpt.SetSkipPlotNPTH_Pads( false );
aPlotOpt.GetPlotViaOnMaskLayer(), false ); // Disable plot pad holes
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
break; break;
case SOLDERPASTE_N_BACK: case SOLDERPASTE_N_BACK:
case SOLDERPASTE_N_FRONT: case SOLDERPASTE_N_FRONT:
PlotStandardLayer( aBoard, aPlotter, layer_mask, aPlotOpt, plotOpt.SetSkipPlotNPTH_Pads( false );
false, false ); // Disable plot pad holes
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
break; break;
case SILKSCREEN_N_FRONT: case SILKSCREEN_N_FRONT:
case SILKSCREEN_N_BACK: case SILKSCREEN_N_BACK:
PlotSilkScreen( aBoard, aPlotter, layer_mask, aPlotOpt ); PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt );
// Gerber: Subtract soldermask from silkscreen if enabled // Gerber: Subtract soldermask from silkscreen if enabled
if( aPlotter->GetPlotterType() == PLOT_FORMAT_GERBER if( aPlotter->GetPlotterType() == PLOT_FORMAT_GERBER
&& aPlotOpt.GetSubtractMaskFromSilk() ) && plotOpt.GetSubtractMaskFromSilk() )
{ {
plotOpt.SetPlotViaOnMaskLayer( true );
if( aLayer == SILKSCREEN_N_FRONT ) if( aLayer == SILKSCREEN_N_FRONT )
layer_mask = GetLayerMask( SOLDERMASK_N_FRONT ); layer_mask = GetLayerMask( SOLDERMASK_N_FRONT );
else else
layer_mask = GetLayerMask( SOLDERMASK_N_BACK ); layer_mask = GetLayerMask( SOLDERMASK_N_BACK );
// Set layer polarity to negative // Create the mask to substract by creating a negative layer polarity
aPlotter->SetLayerPolarity( false ); aPlotter->SetLayerPolarity( false );
PlotStandardLayer( aBoard, aPlotter, layer_mask, aPlotOpt, // Disable plot pad holes
aPlotOpt.GetPlotViaOnMaskLayer(), false ); plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
// Plot the mask
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
} }
break; break;
default: default:
PlotSilkScreen( aBoard, aPlotter, layer_mask, aPlotOpt ); PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt );
break; break;
} }
} }
...@@ -766,48 +776,16 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer, ...@@ -766,48 +776,16 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
* Silk screen layers are not plotted here. * Silk screen layers are not plotted here.
*/ */
void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt, long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt )
bool aPlotVia, bool aSkipNPTH_Pads )
{ {
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
itemplotter.SetLayerMask( aLayerMask ); itemplotter.SetLayerMask( aLayerMask );
wxPoint pos; EDA_DRAW_MODE_T plotMode = aPlotOpt.GetMode();
wxSize size;
EDA_DRAW_MODE_T aPlotMode = aPlotOpt.GetMode();
// Plot pcb draw items. // Plot edge layer and graphic items
for( BOARD_ITEM* item = aBoard->m_Drawings; item; item = item->Next() ) itemplotter.PlotBoardGraphicItems();
{
switch( item->Type() )
{
case PCB_LINE_T:
itemplotter.PlotDrawSegment( (DRAWSEGMENT*) item );
break;
case PCB_TEXT_T:
itemplotter.PlotTextePcb( (TEXTE_PCB*) item );
break;
case PCB_DIMENSION_T:
itemplotter.PlotDimension( (DIMENSION*) item );
break;
case PCB_TARGET_T:
itemplotter.PlotPcbTarget( (PCB_TARGET*) item );
break;
case PCB_MARKER_T:
break;
default:
wxLogMessage( wxT( "Plot_Standard_Layer() error : Unexpected Draw Type %d" ),
item->Type() );
break;
}
}
// Draw footprint shapes without pads (pads will plotted later) // Draw footprint shapes without pads (pads will plotted later)
// We plot here module texts, but they are usually on silkscreen layer, // We plot here module texts, but they are usually on silkscreen layer,
...@@ -851,14 +829,12 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -851,14 +829,12 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
wxPoint shape_pos = pad->ReturnShapePos(); wxPoint shape_pos = pad->ReturnShapePos();
pos = shape_pos;
wxSize margin; wxSize margin;
double width_adj = 0; double width_adj = 0;
if( aLayerMask & ALL_CU_LAYERS ) if( aLayerMask & ALL_CU_LAYERS )
{ {
width_adj = aPlotter->GetPlotWidthAdj(); width_adj = itemplotter.getFineWidthAdj();
} }
switch( aLayerMask & switch( aLayerMask &
...@@ -879,6 +855,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -879,6 +855,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
break; break;
} }
wxSize size;
size.x = pad->GetSize().x + ( 2 * margin.x ) + width_adj; size.x = pad->GetSize().x + ( 2 * margin.x ) + width_adj;
size.y = pad->GetSize().y + ( 2 * margin.y ) + width_adj; size.y = pad->GetSize().y + ( 2 * margin.y ) + width_adj;
...@@ -886,7 +863,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -886,7 +863,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
if( size.x <= 0 || size.y <= 0 ) if( size.x <= 0 || size.y <= 0 )
continue; continue;
EDA_COLOR_T color = ColorFromInt(0); EDA_COLOR_T color = BLACK;
if( (pad->GetLayerMask() & LAYER_BACK) ) if( (pad->GetLayerMask() & LAYER_BACK) )
color = aBoard->GetVisibleElementColor( PAD_BK_VISIBLE ); color = aBoard->GetVisibleElementColor( PAD_BK_VISIBLE );
...@@ -901,42 +878,41 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -901,42 +878,41 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
switch( pad->GetShape() ) switch( pad->GetShape() )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
if( aSkipNPTH_Pads && if( aPlotOpt.GetSkipPlotNPTH_Pads() &&
(pad->GetSize() == pad->GetDrillSize()) && (pad->GetSize() == pad->GetDrillSize()) &&
(pad->GetAttribute() == PAD_HOLE_NOT_PLATED) ) (pad->GetAttribute() == PAD_HOLE_NOT_PLATED) )
break; break;
aPlotter->FlashPadCircle( pos, size.x, aPlotMode ); aPlotter->FlashPadCircle( shape_pos, size.x, plotMode );
break; break;
case PAD_OVAL: case PAD_OVAL:
if( aSkipNPTH_Pads && if( aPlotOpt.GetSkipPlotNPTH_Pads() &&
(pad->GetSize() == pad->GetDrillSize()) && (pad->GetSize() == pad->GetDrillSize()) &&
(pad->GetAttribute() == PAD_HOLE_NOT_PLATED) ) (pad->GetAttribute() == PAD_HOLE_NOT_PLATED) )
break; break;
aPlotter->FlashPadOval( pos, size, pad->GetOrientation(), aPlotMode ); aPlotter->FlashPadOval( shape_pos, size, pad->GetOrientation(), plotMode );
break; break;
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
{ {
wxPoint coord[4]; wxPoint coord[4];
pad->BuildPadPolygon( coord, margin, 0 ); pad->BuildPadPolygon( coord, margin, 0 );
aPlotter->FlashPadTrapez( pos, coord, pad->GetOrientation(), aPlotMode ); aPlotter->FlashPadTrapez( shape_pos, coord, pad->GetOrientation(), plotMode );
} }
break; break;
case PAD_RECT: case PAD_RECT:
default: default:
aPlotter->FlashPadRect( pos, size, pad->GetOrientation(), aPlotMode ); aPlotter->FlashPadRect( shape_pos, size, pad->GetOrientation(), plotMode );
break; break;
} }
} }
} }
// Plot vias : // Plot vias on copper layers, and if aPlotOpt.GetPlotViaOnMaskLayer() is true,
if( aPlotVia ) // plot them on solder mask
{
for( TRACK* track = aBoard->m_Track; track; track = track->Next() ) for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
{ {
if( track->Type() != PCB_VIA_T ) if( track->Type() != PCB_VIA_T )
...@@ -946,14 +922,17 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -946,14 +922,17 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
// vias are not plotted if not on selected layer, but if layer // vias are not plotted if not on selected layer, but if layer
// is SOLDERMASK_LAYER_BACK or SOLDERMASK_LAYER_FRONT,vias are drawn, // is SOLDERMASK_LAYER_BACK or SOLDERMASK_LAYER_FRONT,vias are drawn,
// if they are on an external copper layer // only if they are on the corresponding external copper layer
int via_mask_layer = Via->ReturnMaskLayer(); int via_mask_layer = Via->ReturnMaskLayer();
if( aPlotOpt.GetPlotViaOnMaskLayer() )
{
if( via_mask_layer & LAYER_BACK ) if( via_mask_layer & LAYER_BACK )
via_mask_layer |= SOLDERMASK_LAYER_BACK; via_mask_layer |= SOLDERMASK_LAYER_BACK;
if( via_mask_layer & LAYER_FRONT ) if( via_mask_layer & LAYER_FRONT )
via_mask_layer |= SOLDERMASK_LAYER_FRONT; via_mask_layer |= SOLDERMASK_LAYER_FRONT;
}
if( ( via_mask_layer & aLayerMask ) == 0 ) if( ( via_mask_layer & aLayerMask ) == 0 )
continue; continue;
...@@ -967,60 +946,44 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -967,60 +946,44 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
via_margin = aBoard->GetDesignSettings().m_SolderMaskMargin; via_margin = aBoard->GetDesignSettings().m_SolderMaskMargin;
if( aLayerMask & ALL_CU_LAYERS ) if( aLayerMask & ALL_CU_LAYERS )
width_adj = aPlotter->GetPlotWidthAdj(); width_adj = itemplotter.getFineWidthAdj();
pos = Via->m_Start; int diameter = Via->m_Width + 2 * via_margin + width_adj;
size.x = size.y = Via->m_Width + 2 * via_margin + width_adj;
// Don't draw a null size item : // Don't draw a null size item :
if( size.x <= 0 ) if( diameter <= 0 )
continue; continue;
EDA_COLOR_T color = aBoard->GetVisibleElementColor(VIAS_VISIBLE + Via->m_Shape); EDA_COLOR_T color = aBoard->GetVisibleElementColor(VIAS_VISIBLE + Via->m_Shape);
// Set plot color (change WHITE to LIGHTGRAY because // Set plot color (change WHITE to LIGHTGRAY because
// the white items are not seen on a white paper or screen // the white items are not seen on a white paper or screen
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY); aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
aPlotter->FlashPadCircle( Via->m_Start, diameter, plotMode );
aPlotter->FlashPadCircle( pos, size.x, aPlotMode );
}
} }
// Plot tracks (not vias) : // Plot tracks (not vias) :
for( TRACK* track = aBoard->m_Track; track; track = track->Next() ) for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
{ {
wxPoint end;
if( track->Type() == PCB_VIA_T ) if( track->Type() == PCB_VIA_T )
continue; continue;
if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 ) if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 )
continue; continue;
size.x = size.y = track->m_Width + aPlotter->GetPlotWidthAdj(); int width = track->m_Width + itemplotter.getFineWidthAdj();
pos = track->m_Start; aPlotter->SetColor( itemplotter.getColor( track->GetLayer() ) );
end = track->m_End; aPlotter->ThickSegment( track->m_Start, track->m_End, width, plotMode );
EDA_COLOR_T color = aBoard->GetLayerColor( track->GetLayer() );
// Set plot color (change WHITE to LIGHTGRAY because
// the white items are not seen on a white paper or screen
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
aPlotter->ThickSegment( pos, end, size.x, aPlotMode );
} }
// Plot zones (outdated, for old boards compatibility): // Plot zones (outdated, for old boards compatibility):
for( TRACK* track = aBoard->m_Zone; track; track = track->Next() ) for( TRACK* track = aBoard->m_Zone; track; track = track->Next() )
{ {
wxPoint end;
if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 ) if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 )
continue; continue;
size.x = size.y = track->m_Width + aPlotter->GetPlotWidthAdj(); int width = track->m_Width + itemplotter.getFineWidthAdj();
pos = track->m_Start; aPlotter->SetColor( itemplotter.getColor( track->GetLayer() ) );
end = track->m_End; aPlotter->ThickSegment( track->m_Start, track->m_End, width, plotMode );
aPlotter->ThickSegment( pos, end, size.x, aPlotMode );
} }
// Plot filled ares // Plot filled ares
...@@ -1033,31 +996,35 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -1033,31 +996,35 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
itemplotter.PlotFilledAreas( zone ); itemplotter.PlotFilledAreas( zone );
} }
// Adding drill marks, if required and if the plotter is able to plot them:
if( aPlotOpt.GetDrillMarksType() != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
itemplotter.PlotDrillMarks();
} }
/** Helper function to plot a single drill mark. It compensate and clamp /** Helper function to plot a single drill mark. It compensate and clamp
the drill mark size depending on the current plot options */ * the drill mark size depending on the current plot options
static void PlotDrillMark( PLOTTER *aPlotter, PAD_SHAPE_T aDrillShape, */
void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_SHAPE_T aDrillShape,
const wxPoint &aDrillPos, wxSize aDrillSize, const wxPoint &aDrillPos, wxSize aDrillSize,
const wxSize &aPadSize, const wxSize &aPadSize,
double aOrientation, int aSmallDrill, double aOrientation, int aSmallDrill )
EDA_DRAW_MODE_T aTraceMode )
{ {
// Small drill marks have no significance when applied to slots // Small drill marks have no significance when applied to slots
if( aSmallDrill && aDrillShape == PAD_ROUND ) if( aSmallDrill && aDrillShape == PAD_ROUND )
aDrillSize.x = std::min( aSmallDrill, aDrillSize.x ); aDrillSize.x = std::min( aSmallDrill, aDrillSize.x );
// Round holes only have x diameter, slots have both // Round holes only have x diameter, slots have both
aDrillSize.x -= aPlotter->GetPlotWidthAdj(); aDrillSize.x -= getFineWidthAdj();
aDrillSize.x = Clamp( 1, aDrillSize.x, aPadSize.x - 1 ); aDrillSize.x = Clamp( 1, aDrillSize.x, aPadSize.x - 1 );
if( aDrillShape == PAD_OVAL ) if( aDrillShape == PAD_OVAL )
{ {
aDrillSize.y -= aPlotter->GetPlotWidthAdj(); aDrillSize.y -= getFineWidthAdj();
aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 ); aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 );
aPlotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, aTraceMode ); m_plotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, GetMode() );
} }
else else
aPlotter->FlashPadCircle( aDrillPos, aDrillSize.x, aTraceMode ); m_plotter->FlashPadCircle( aDrillPos, aDrillSize.x, GetMode() );
} }
/* Function PlotDrillMarks /* Function PlotDrillMarks
...@@ -1066,14 +1033,11 @@ static void PlotDrillMark( PLOTTER *aPlotter, PAD_SHAPE_T aDrillShape, ...@@ -1066,14 +1033,11 @@ static void PlotDrillMark( PLOTTER *aPlotter, PAD_SHAPE_T aDrillShape,
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in * redraw the drill mark on a pad or via, as a negative (i.e. white) shape in
* FILLED plot mode (for PS and PDF outputs) * FILLED plot mode (for PS and PDF outputs)
*/ */
void PlotDrillMarks( BOARD *aBoard, PLOTTER* aPlotter, void BRDITEMS_PLOTTER::PlotDrillMarks()
const PCB_PLOT_PARAMS& aPlotOpts )
{ {
EDA_DRAW_MODE_T trace_mode = aPlotOpts.GetMode();
/* If small drills marks were requested prepare a clamp value to pass /* If small drills marks were requested prepare a clamp value to pass
to the helper function */ to the helper function */
int small_drill = (aPlotOpts.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE) ? int small_drill = (GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE) ?
SMALL_DRILL : 0; SMALL_DRILL : 0;
/* In the filled trace mode drill marks are drawn white-on-black to scrape /* In the filled trace mode drill marks are drawn white-on-black to scrape
...@@ -1087,40 +1051,35 @@ void PlotDrillMarks( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -1087,40 +1051,35 @@ void PlotDrillMarks( BOARD *aBoard, PLOTTER* aPlotter,
you could start a layer with negative polarity to scrape the film. you could start a layer with negative polarity to scrape the film.
- In DXF they go into the 'WHITE' layer. This could be useful. - In DXF they go into the 'WHITE' layer. This could be useful.
*/ */
if( trace_mode == FILLED ) if( GetMode() == FILLED )
{ m_plotter->SetColor( WHITE );
aPlotter->SetColor( WHITE );
}
for( TRACK *pts = aBoard->m_Track; pts != NULL; pts = pts->Next() ) for( TRACK *pts = m_board->m_Track; pts != NULL; pts = pts->Next() )
{ {
if( pts->Type() != PCB_VIA_T ) if( pts->Type() != PCB_VIA_T )
continue; continue;
PlotDrillMark( aPlotter, PAD_CIRCLE, plotOneDrillMark(PAD_CIRCLE,
pts->m_Start, wxSize( pts->GetDrillValue(), 0 ), pts->m_Start, wxSize( pts->GetDrillValue(), 0 ),
wxSize( pts->m_Width, 0 ), 0, small_drill, wxSize( pts->m_Width, 0 ), 0, small_drill );
trace_mode );
} }
for( MODULE *Module = aBoard->m_Modules; Module != NULL; Module = Module->Next() ) for( MODULE *Module = m_board->m_Modules; Module != NULL; Module = Module->Next() )
{ {
for( D_PAD *pad = Module->m_Pads; pad != NULL; pad = pad->Next() ) for( D_PAD *pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
{ {
if( pad->GetDrillSize().x == 0 ) if( pad->GetDrillSize().x == 0 )
continue; continue;
PlotDrillMark( aPlotter, pad->GetDrillShape(), plotOneDrillMark( pad->GetDrillShape(),
pad->GetPosition(), pad->GetDrillSize(), pad->GetPosition(), pad->GetDrillSize(),
pad->GetSize(), pad->GetOrientation(), pad->GetSize(), pad->GetOrientation(),
small_drill, trace_mode ); small_drill );
} }
} }
if( trace_mode == FILLED ) if( GetMode() == FILLED )
{ m_plotter->SetColor( GetColor() );
aPlotter->SetColor( aPlotOpts.GetColor() );
}
} }
/** Set up most plot options for plotting a board (especially the viewport) /** Set up most plot options for plotting a board (especially the viewport)
...@@ -1202,7 +1161,7 @@ static void PlotSetupPlotter( PLOTTER *aPlotter, PCB_PLOT_PARAMS *aPlotOpts, ...@@ -1202,7 +1161,7 @@ static void PlotSetupPlotter( PLOTTER *aPlotter, PCB_PLOT_PARAMS *aPlotOpts,
/* Configure the plotter object with all the stuff computed and /* Configure the plotter object with all the stuff computed and
most of that taken from the options */ most of that taken from the options */
aPlotter->SetPageSettings( *sheet_info ); aPlotter->SetPageSettings( *sheet_info );
aPlotter->SetPlotWidthAdj( aPlotOpts->GetWidthAdjust() );
aPlotter->SetViewport( offset, IU_PER_DECIMILS, compound_scale, aPlotter->SetViewport( offset, IU_PER_DECIMILS, compound_scale,
aPlotOpts->GetMirror() ); aPlotOpts->GetMirror() );
aPlotter->SetDefaultLineWidth( aPlotOpts->GetLineWidth() ); aPlotter->SetDefaultLineWidth( aPlotOpts->GetLineWidth() );
...@@ -1214,14 +1173,14 @@ static void PlotSetupPlotter( PLOTTER *aPlotter, PCB_PLOT_PARAMS *aPlotOpts, ...@@ -1214,14 +1173,14 @@ static void PlotSetupPlotter( PLOTTER *aPlotter, PCB_PLOT_PARAMS *aPlotOpts,
/** Prefill in black an area a little bigger than the board to prepare for the /** Prefill in black an area a little bigger than the board to prepare for the
* negative plot */ * negative plot */
static void FillNegativeKnockout(PLOTTER *aPlotter, const EDA_RECT &aBbbox ) static void FillNegativeKnockout( PLOTTER *aPlotter, const EDA_RECT &aBbbox )
{ {
static const int margin = 5 * IU_PER_MM; // Add a 5 mm margin around the board const int margin = 5 * IU_PER_MM; // Add a 5 mm margin around the board
aPlotter->SetNegative( true ); aPlotter->SetNegative( true );
aPlotter->SetColor( WHITE ); // Which will be plotted as black aPlotter->SetColor( WHITE ); // Which will be plotted as black
aPlotter->Rect( wxPoint( aBbbox.GetX() - margin, aBbbox.GetY() - margin ), EDA_RECT area = aBbbox;
wxPoint( aBbbox.GetRight() + margin, aBbbox.GetBottom() + margin ), area.Inflate( margin );
FILLED_SHAPE ); aPlotter->Rect( area.GetOrigin(), area.GetEnd(), FILLED_SHAPE );
aPlotter->SetColor( BLACK ); aPlotter->SetColor( BLACK );
} }
...@@ -1232,7 +1191,7 @@ static void ConfigureHPGLPenSizes( HPGL_PLOTTER *aPlotter, ...@@ -1232,7 +1191,7 @@ static void ConfigureHPGLPenSizes( HPGL_PLOTTER *aPlotter,
{ {
/* Compute pen_dim (the value is given in mils) in pcb units, /* Compute pen_dim (the value is given in mils) in pcb units,
with plot scale (if Scale is 2, pen diameter value is always m_HPGLPenDiam with plot scale (if Scale is 2, pen diameter value is always m_HPGLPenDiam
so apparent pen diam is real pen diam / Scale */ so apparent pen diam is actually pen diam / Scale */
int pen_diam = KiROUND( aPlotOpts->GetHPGLPenDiameter() * IU_PER_MILS / int pen_diam = KiROUND( aPlotOpts->GetHPGLPenDiameter() * IU_PER_MILS /
aPlotOpts->GetScale() ); aPlotOpts->GetScale() );
...@@ -1263,8 +1222,6 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, ...@@ -1263,8 +1222,6 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
const wxString& aSheetDesc ) const wxString& aSheetDesc )
{ {
const PAGE_INFO& pageInfo = aBoard->GetPageSettings(); const PAGE_INFO& pageInfo = aBoard->GetPageSettings();
EDA_RECT bbbox = aBoard->ComputeBoundingBox();
wxPoint auxOrigin( aBoard->GetOriginAxisPosition() );
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
...@@ -1315,6 +1272,8 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, ...@@ -1315,6 +1272,8 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
if( the_plotter ) if( the_plotter )
{ {
EDA_RECT bbbox = aBoard->ComputeBoundingBox();
wxPoint auxOrigin( aBoard->GetOriginAxisPosition() );
// Compute the viewport and set the other options // Compute the viewport and set the other options
PlotSetupPlotter( the_plotter, aPlotOpts, pageInfo, bbbox, auxOrigin, PlotSetupPlotter( the_plotter, aPlotOpts, pageInfo, bbbox, auxOrigin,
aFullFileName ); aFullFileName );
...@@ -1333,8 +1292,7 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, ...@@ -1333,8 +1292,7 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
PlotWorkSheet( the_plotter, aBoard->GetTitleBlock(), PlotWorkSheet( the_plotter, aBoard->GetTitleBlock(),
aBoard->GetPageSettings(), aBoard->GetPageSettings(),
1, 1, // Only one page 1, 1, // Only one page
aSheetDesc, aSheetDesc, aBoard->GetFileName() );
aBoard->GetFileName() );
return the_plotter; return the_plotter;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment