Commit 137066e5 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Fully encapsulated with accessors PCB_PLOT_PARAMS

parent 7cef5395
......@@ -138,11 +138,11 @@ void DIALOG_GENDRILL::InitDisplayParams()
m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
msg.Empty();
msg << plot_opts.m_HPGLPenNum;
msg << plot_opts.GetHPGLPenNum();
m_PenNum->SetValue( msg );
msg.Empty();
msg << plot_opts.m_HPGLPenSpeed;
msg << plot_opts.GetHPGLPenSpeed();
m_PenSpeed->SetValue( msg );
// See if we have some buried vias or/and microvias, and display
......@@ -308,12 +308,12 @@ void DIALOG_GENDRILL::SetParams()
msg = m_PenSpeed->GetValue();
if( msg.ToLong( &ltmp ) )
plot_opts.m_HPGLPenSpeed = ltmp;
plot_opts.SetHPGLPenSpeed( ltmp );
msg = m_PenNum->GetValue();
if( msg.ToLong( &ltmp ) )
plot_opts.m_HPGLPenNum = ltmp;
plot_opts.SetHPGLPenNum( ltmp );
if( m_Choice_Drill_Offset->GetSelection() == 0 )
m_FileDrillOffset = wxPoint( 0, 0 );
......
......@@ -191,9 +191,9 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event )
s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[m_ScaleOption->GetSelection()];
plot_opts.m_FineScaleAdjustX = s_Parameters.m_XScaleAdjust;
plot_opts.m_FineScaleAdjustY = s_Parameters.m_YScaleAdjust;
plot_opts.m_PlotScale = s_Parameters.m_PrintScale;
plot_opts.SetFineScaleAdjustX( s_Parameters.m_XScaleAdjust );
plot_opts.SetFineScaleAdjustY( s_Parameters.m_YScaleAdjust );
plot_opts.SetScale( s_Parameters.m_PrintScale );
m_parent->SetPlotSettings( plot_opts );
......
......@@ -353,7 +353,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
int idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[idx];
plot_opts.m_PlotScale = s_Parameters.m_PrintScale;
plot_opts.SetScale( s_Parameters.m_PrintScale );
if( m_FineAdjustXscaleOpt )
{
......@@ -371,8 +371,8 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
m_FineAdjustYscaleOpt->GetValue().ToDouble( &s_Parameters.m_YScaleAdjust );
}
plot_opts.m_FineScaleAdjustX = s_Parameters.m_XScaleAdjust;
plot_opts.m_FineScaleAdjustY = s_Parameters.m_YScaleAdjust;
plot_opts.SetFineScaleAdjustX( s_Parameters.m_XScaleAdjust );
plot_opts.SetFineScaleAdjustY( s_Parameters.m_YScaleAdjust );
m_parent->SetPlotSettings( plot_opts );
......
......@@ -62,8 +62,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
{
HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
plotter = hpgl_plotter;
hpgl_plotter->SetPenNumber( plot_opts.m_HPGLPenNum );
hpgl_plotter->SetPenSpeed( plot_opts.m_HPGLPenSpeed );
hpgl_plotter->SetPenNumber( plot_opts.GetHPGLPenNum() );
hpgl_plotter->SetPenSpeed( plot_opts.GetHPGLPenSpeed() );
hpgl_plotter->SetPenOverlap( 0 );
plotter->SetPageSettings( aSheet );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -80,7 +80,7 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* aPlotter, int aLayerMask, EDA_DRAW
int layersmask_plotpads = aLayerMask;
// Calculate the mask layers of allowed layers for pads
if( !plot_opts.m_PlotPadsOnSilkLayer ) // Do not plot pads on silk screen layers
if( !plot_opts.GetPlotPadsOnSilkLayer() ) // Do not plot pads on silk screen layers
layersmask_plotpads &= ~(SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT );
if( layersmask_plotpads )
......@@ -129,8 +129,8 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* aPlotter, int aLayerMask, EDA_DRAW
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
// see if we want to plot VALUE and REF fields
trace_val = plot_opts.m_PlotValue;
trace_ref = plot_opts.m_PlotReference;
trace_val = plot_opts.GetPlotValue();
trace_ref = plot_opts.GetPlotReference();
TEXTE_MODULE* text = module->m_Reference;
unsigned textLayer = text->GetLayer();
......@@ -149,7 +149,7 @@ module\n %s's \"reference\" text." ),
if( ( ( 1 << textLayer ) & aLayerMask ) == 0 )
trace_ref = false;
if( !text->IsVisible() && !plot_opts.m_PlotInvisibleTexts )
if( !text->IsVisible() && !plot_opts.GetPlotInvisibleText() )
trace_ref = false;
text = module->m_Value;
......@@ -169,7 +169,7 @@ module\n %s's \"value\" text." ),
if( ( (1 << textLayer) & aLayerMask ) == 0 )
trace_val = false;
if( !text->IsVisible() && !plot_opts.m_PlotInvisibleTexts )
if( !text->IsVisible() && !plot_opts.GetPlotInvisibleText() )
trace_val = false;
// Plot text fields, if allowed
......@@ -186,10 +186,10 @@ module\n %s's \"value\" text." ),
if( pt_texte->Type() != PCB_MODULE_TEXT_T )
continue;
if( !plot_opts.m_PlotTextOther )
if( !plot_opts.GetPlotOtherText() )
continue;
if( !pt_texte->IsVisible() && !plot_opts.m_PlotInvisibleTexts )
if( !pt_texte->IsVisible() && !plot_opts.GetPlotInvisibleText() )
continue;
textLayer = pt_texte->GetLayer();
......@@ -417,7 +417,7 @@ void Plot_1_EdgeModule( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
double endAngle = startAngle + aEdge->GetAngle();
if ( ( aPlotOpts.GetPlotFormat() == PLOT_FORMAT_DXF ) &&
if ( ( aPlotOpts.GetFormat() == PLOT_FORMAT_DXF ) &&
( masque_layer & ( SILKSCREEN_LAYER_BACK | DRAW_LAYER | COMMENT_LAYER ) ) )
aPlotter->ThickArc( pos, -startAngle, -endAngle, radius,
thickness, trace_mode );
......@@ -607,7 +607,7 @@ void PlotDrawSegment( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, DRAWS
return;
if( trace_mode == LINE )
thickness = aPlotOpts.m_PlotLineWidth;
thickness = aPlotOpts.GetLineWidth();
else
thickness = aSeg->GetWidth();
......@@ -658,7 +658,7 @@ void PCB_BASE_FRAME::Plot_Layer( PLOTTER* aPlotter, int Layer, EDA_DRAW_MODE_T t
// in addition to the contents of the currently specified layer.
int layer_mask = GetLayerMask( Layer );
if( !plot_opts.m_ExcludeEdgeLayer )
if( !plot_opts.GetExcludeEdgeLayer() )
layer_mask |= EDGE_LAYER;
switch( Layer )
......@@ -679,15 +679,15 @@ void PCB_BASE_FRAME::Plot_Layer( PLOTTER* aPlotter, int Layer, EDA_DRAW_MODE_T t
case LAYER_N_14:
case LAYER_N_15:
case LAST_COPPER_LAYER:
Plot_Standard_Layer( aPlotter, layer_mask, true, trace_mode,
plot_opts.m_SkipNPTH_Pads );
// The last true make it skip NPTH pad plotting
Plot_Standard_Layer( aPlotter, layer_mask, true, trace_mode, true );
// Adding drill marks, if required and if the plotter is able to plot them:
if( plot_opts.m_DrillShapeOpt != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
if( plot_opts.GetDrillMarksType() != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
{
if( aPlotter->GetPlotterType() == PLOT_FORMAT_POST )
PlotDrillMark( aPlotter, trace_mode,
plot_opts.m_DrillShapeOpt ==
plot_opts.GetDrillMarksType() ==
PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE );
}
......@@ -696,7 +696,7 @@ void PCB_BASE_FRAME::Plot_Layer( PLOTTER* aPlotter, int Layer, EDA_DRAW_MODE_T t
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
Plot_Standard_Layer( aPlotter, layer_mask,
plot_opts.m_PlotViaOnMaskLayer, trace_mode );
plot_opts.GetPlotViaOnMaskLayer(), trace_mode );
break;
case SOLDERPASTE_N_BACK:
......@@ -724,7 +724,7 @@ void PCB_BASE_FRAME::Plot_Layer( PLOTTER* aPlotter, int Layer, EDA_DRAW_MODE_T t
// Set layer polarity to negative
aPlotter->SetLayerPolarity( false );
Plot_Standard_Layer( aPlotter, layer_mask,
plot_opts.m_PlotViaOnMaskLayer,
plot_opts.GetPlotViaOnMaskLayer(),
trace_mode );
}
......@@ -1012,7 +1012,7 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
pos = pts->m_Start;
// It is quite possible that the real drill value is less then small drill value.
if( plot_opts.m_DrillShapeOpt == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE )
if( plot_opts.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE )
diam.x = diam.y = MIN( SMALL_DRILL, pts->GetDrillValue() );
else
diam.x = diam.y = pts->GetDrillValue();
......
......@@ -36,8 +36,8 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
plotter->SetFilename( aFullFileName );
plotter->StartPlot( output_file );
if( plot_opts.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen(), plot_opts.GetPlotLineWidth() );
if( plot_opts.GetPlotFrameRef() )
PlotWorkSheet( plotter, GetScreen(), plot_opts.GetLineWidth() );
Plot_Layer( plotter, aLayer, aTraceMode );
plotter->EndPlot();
......
......@@ -37,7 +37,7 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
wxPoint offset;
// Calculate scaling from Pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units
double scale = plot_opts.m_PlotScale;
double scale = plot_opts.GetScale();
if( aPlotOriginIsAuxAxis )
{
......@@ -55,29 +55,22 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
// No mirror and scaling for gerbers!
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, 0 );
plotter->SetDefaultLineWidth( plot_opts.m_PlotLineWidth );
plotter->SetDefaultLineWidth( plot_opts.GetLineWidth() );
plotter->SetCreator( wxT( "PCBNEW-RS274X" ) );
plotter->SetFilename( aFullFileName );
if( plotter->StartPlot( output_file ) )
{
// Skip NPTH pads on copper layers
// ( only if hole size == pad size ):
if( (aLayer >= LAYER_N_BACK) && (aLayer <= LAYER_N_FRONT) )
plot_opts.m_SkipNPTH_Pads = true;
SetPlotSettings( plot_opts );
// Sheet refs on gerber CAN be useful... and they're always 1:1
if( plot_opts.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen(), plot_opts.GetPlotLineWidth() );
if( plot_opts.GetPlotFrameRef() )
PlotWorkSheet( plotter, GetScreen(), plot_opts.GetLineWidth() );
Plot_Layer( plotter, aLayer, aTraceMode );
plotter->EndPlot();
plot_opts.m_SkipNPTH_Pads = false;
SetPlotSettings( plot_opts );
}
else // error in start_plot( ): failed opening a temporary file
......
......@@ -58,22 +58,22 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
// Compute pen_dim (from m_HPGLPenDiam in mils) in pcb units,
// with plot scale (if Scale is 2, pen diameter value is always m_HPGLPenDiam
// so apparent pen diam is real pen diam / Scale
int pen_diam = KiROUND( plot_opts.m_HPGLPenDiam * IU_PER_MILS /
plot_opts.m_PlotScale );
int pen_diam = KiROUND( plot_opts.GetHPGLPenDiameter() * IU_PER_MILS /
plot_opts.GetScale() );
// compute pen_overlay (from m_HPGLPenOvr in mils) in pcb units
// with plot scale
if( plot_opts.m_HPGLPenOvr < 0 )
plot_opts.m_HPGLPenOvr = 0;
if( plot_opts.GetHPGLPenOverlay() < 1 )
plot_opts.SetHPGLPenOverlay( 0 );
if( plot_opts.m_HPGLPenOvr >= plot_opts.m_HPGLPenDiam )
plot_opts.m_HPGLPenOvr = plot_opts.m_HPGLPenDiam - 1;
if( plot_opts.GetHPGLPenOverlay() >= plot_opts.GetHPGLPenDiameter() )
plot_opts.SetHPGLPenOverlay( plot_opts.GetHPGLPenDiameter() - 1 );
int pen_overlay = KiROUND( plot_opts.m_HPGLPenOvr * IU_PER_MILS /
plot_opts.m_PlotScale );
int pen_overlay = KiROUND( plot_opts.GetHPGLPenOverlay() * IU_PER_MILS /
plot_opts.GetScale() );
if( plot_opts.m_PlotScale != 1.0 || plot_opts.m_AutoScale )
if( plot_opts.GetScale() != 1.0 || plot_opts.GetAutoScale() )
{
// when scale != 1.0 we must calculate the position in page
// because actual position has no meaning
......@@ -88,7 +88,7 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
boardSize = bbbox.GetSize();
boardCenter = bbbox.Centre();
if( plot_opts.m_AutoScale ) // Optimum scale
if( plot_opts.GetAutoScale() ) // Optimum scale
{
// Fit to 80% of the page
double Xscale = ( ( pageSizeIU.x * 0.8 ) / boardSize.x );
......@@ -97,7 +97,7 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
}
else
{
scale = plot_opts.m_PlotScale;
scale = plot_opts.GetScale();
}
// Calculate the page size offset.
......@@ -122,19 +122,19 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
SetPlotSettings( plot_opts );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale,
plot_opts.m_PlotMirror );
plotter->SetDefaultLineWidth( plot_opts.m_PlotLineWidth );
plot_opts.GetMirror() );
plotter->SetDefaultLineWidth( plot_opts.GetLineWidth() );
plotter->SetCreator( wxT( "PCBNEW-HPGL" ) );
plotter->SetFilename( aFullFileName );
plotter->SetPenSpeed( plot_opts.m_HPGLPenSpeed );
plotter->SetPenNumber( plot_opts.m_HPGLPenNum );
plotter->SetPenSpeed( plot_opts.GetHPGLPenSpeed() );
plotter->SetPenNumber( plot_opts.GetHPGLPenNum() );
plotter->SetPenOverlap( pen_overlay );
plotter->SetPenDiameter( pen_diam );
plotter->StartPlot( output_file );
// The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway
if( plot_opts.m_PlotFrameRef && !center )
PlotWorkSheet( plotter, GetScreen(), plot_opts.GetPlotLineWidth() );
if( plot_opts.GetPlotFrameRef() && !center )
PlotWorkSheet( plotter, GetScreen(), plot_opts.GetLineWidth() );
Plot_Layer( plotter, aLayer, aTraceMode );
plotter->EndPlot();
......
......@@ -46,7 +46,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
return false;
}
if( plotOpts.m_PlotScale != 1.0 || plotOpts.m_AutoScale )
if( plotOpts.GetScale() != 1.0 || plotOpts.GetAutoScale() )
{
// when scale != 1.0 we must calculate the position in page
// because actual position has no meaning
......@@ -54,8 +54,8 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
}
// Set default line width
if( plotOpts.m_PlotLineWidth < 1 )
plotOpts.m_PlotLineWidth = 1;
if( plotOpts.GetLineWidth() < 1 )
plotOpts.SetLineWidth( 1 );
wxSize pageSizeIU = GetPageSizeIU();
......@@ -77,7 +77,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
boardSize = bbbox.GetSize();
boardCenter = bbbox.Centre();
if( plotOpts.m_AutoScale ) // Optimum scale
if( plotOpts.GetAutoScale() ) // Optimum scale
{
// Fit to 80% of the page
double Xscale = (paperSizeIU.x * 0.8) / boardSize.x;
......@@ -87,7 +87,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
}
else
{
scale = plotOpts.m_PlotScale * paperscale;
scale = plotOpts.GetScale() * paperscale;
}
if( center )
......@@ -108,24 +108,24 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
// why did we have to change these settings?
SetPlotSettings( plotOpts );
plotter->SetScaleAdjust( plotOpts.m_FineScaleAdjustX,
plotOpts.m_FineScaleAdjustY );
plotter->SetPlotWidthAdj( plotOpts.m_FineWidthAdjust );
plotter->SetScaleAdjust( plotOpts.GetFineScaleAdjustX(),
plotOpts.GetFineScaleAdjustY() );
plotter->SetPlotWidthAdj( plotOpts.GetWidthAdjust() );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale,
plotOpts.m_PlotMirror );
plotter->SetDefaultLineWidth( plotOpts.m_PlotLineWidth );
plotOpts.GetMirror() );
plotter->SetDefaultLineWidth( plotOpts.GetLineWidth() );
plotter->SetCreator( wxT( "PCBNEW-PS" ) );
plotter->SetFilename( aFullFileName );
plotter->StartPlot( output_file );
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
if( plotOpts.m_PlotFrameRef && !center )
PlotWorkSheet( plotter, GetScreen(), plotOpts.GetPlotLineWidth() );
if( plotOpts.GetPlotFrameRef() && !center )
PlotWorkSheet( plotter, GetScreen(), plotOpts.GetLineWidth() );
// If plot a negative board:
// Draw a black rectangle (background for plot board in white)
// and switch the current color to WHITE
if( plotOpts.m_PlotPSNegative )
if( plotOpts.GetNegative() )
{
int margin = 500; // Add a 0.5 inch margin around the board
plotter->SetNegative( true );
......
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