When changing the number of copper layers, new layers added to the board in pcbnew are now selected by default for plotting

This commit is contained in:
unknown 2015-12-08 16:15:24 +01:00 committed by jean-pierre charras
parent 32d4dae5ef
commit 0ae5fed41f
2 changed files with 19 additions and 6 deletions

View File

@ -677,14 +677,18 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetGerberPrecision( m_rbGerberFormat->GetSelection() == 0 ? 5 : 6 );
LSET selectedLayers;
for( unsigned i = 0; i < m_layerList.size(); i++ )
{
if( m_layerCheckListBox->IsChecked( i ) )
selectedLayers.set( m_layerList[i] );
}
// Get a list of copper layers that aren't being used by inverting enabled layers.
LSET disabledCopperLayers = LSET::AllCuMask() & ~m_board->GetEnabledLayers();
// Enable all of the disabled copper layers.
// If someone enables more copper layers they will be selected by default.
selectedLayers = selectedLayers | disabledCopperLayers;
tempOptions.SetLayerSelection( selectedLayers );
tempOptions.SetNegative( m_plotPSNegativeOpt->GetValue() );
tempOptions.SetA4Output( m_forcePSA4OutputOpt->GetValue() );
@ -782,7 +786,16 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq )
{
LAYER_ID layer = *seq;
// All copper layers that are disabled are actually selected
// This is due to wonkyness in automatically selecting copper layers
// for plotting when adding more than two layers to a board.
// If plot options become accessible to the layers setup dialog
// please move this functionality there!
// This skips a copper layer if it is actually disabled on the board.
if( ( LSET::AllCuMask() & ~m_board->GetEnabledLayers() )[layer] )
continue;
// Pick the basename from the board file
wxFileName fn( boardFilename );

View File

@ -79,8 +79,7 @@ static bool setInt( int* aInt, int aValue, int aMin, int aMax )
// PCB_PLOT_PARAMS
PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() :
m_layerSelection( 4, B_Cu, F_Cu, F_SilkS, B_SilkS )
PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
{
m_useGerberProtelExtensions = false;
m_useGerberAttributes = false;
@ -116,6 +115,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() :
m_referenceColor = BLACK;
m_valueColor = BLACK;
m_textMode = PLOTTEXTMODE_DEFAULT;
m_layerSelection = LSET( 2, F_SilkS, B_SilkS) | LSET::AllCuMask();
// This parameter controls if the NPTH pads will be plotted or not
// it is a "local" parameter
@ -377,7 +377,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
*/
// sorry, use the UI once to fix:
aPcbPlotParams->m_layerSelection = LSET( 4, B_Cu, F_Cu, F_SilkS, B_SilkS );
aPcbPlotParams->m_layerSelection = LSET( 2, F_SilkS, B_SilkS) | LSET::AllCuMask();
}
else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4.
{