← Back to team overview

kicad-developers team mailing list archive

[PATCH] Copper layers selected by default in plot dialog

 

This fixes a small "issue" that was annoying me.

With this patch when you add new layers in pcbnew they will be selected by
default for plotting.

It does this in two places:
First - it sets the default for a new board to plot select all copper
layers. This is needed so the first time the plot dialog is opened all
enabled copper layers will be selected.
Second - when the plot dialog is closed all disabled copper layers are set
to "selected". The reason for this is when the dialog is closed it was
setting all disabled copper layers to unselected. If you added new layers
to a board it was defaulting to unselected. This is done here because it
would have been difficult to access the plot dialog settings from the layer
preferences manager.

Jon
From eacc4ab58cfc2fb801f6d430d87bf0a432d92993 Mon Sep 17 00:00:00 2001
From: Jon Neal <reportingsjr@xxxxxxxxx>
Date: Wed, 11 Nov 2015 21:37:28 -0500
Subject: [PATCH] The plot dialog now checks copper layers by default including
 when new layers are added.

---
 pcbnew/dialogs/dialog_plot.cpp | 8 ++++++--
 pcbnew/pcb_plot_params.cpp     | 6 +++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp
index 5806438..94023b1 100644
--- a/pcbnew/dialogs/dialog_plot.cpp
+++ b/pcbnew/dialogs/dialog_plot.cpp
@@ -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() );
 
diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp
index 9f40fbc..85aeb04 100644
--- a/pcbnew/pcb_plot_params.cpp
+++ b/pcbnew/pcb_plot_params.cpp
@@ -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.
                 {
-- 
2.4.3


Follow ups