From f24bc87a842648b562f45081604f0edf972acaff Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 8 Mar 2014 20:07:35 +0100 Subject: [PATCH] Pcbnew: fix Bug #1289416 (Broken setting of layer list in D_PAD:: ViewGetLayers() for GAL). --- pcbnew/class_pad.cpp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index d024290e74..405c398db0 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -842,29 +842,40 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const // Multi layer pad aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE ); aLayers[aCount++] = NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ); - aLayers[aCount++] = SOLDERMASK_N_FRONT; - aLayers[aCount++] = SOLDERMASK_N_BACK; - aLayers[aCount++] = SOLDERPASTE_N_FRONT; - aLayers[aCount++] = SOLDERPASTE_N_BACK; } else if( IsOnLayer( LAYER_N_FRONT ) ) { aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE ); aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ); - aLayers[aCount++] = SOLDERMASK_N_FRONT; - aLayers[aCount++] = SOLDERPASTE_N_FRONT; } else if( IsOnLayer( LAYER_N_BACK ) ) { aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE ); aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ); - aLayers[aCount++] = SOLDERMASK_N_BACK; - aLayers[aCount++] = SOLDERPASTE_N_BACK; } + + if( IsOnLayer( SOLDERMASK_N_FRONT ) ) + aLayers[aCount++] = SOLDERMASK_N_FRONT; + + if( IsOnLayer( SOLDERMASK_N_BACK ) ) + aLayers[aCount++] = SOLDERMASK_N_BACK; + + if( IsOnLayer( SOLDERPASTE_N_FRONT ) ) + aLayers[aCount++] = SOLDERPASTE_N_FRONT; + + if( IsOnLayer( SOLDERPASTE_N_BACK ) ) + aLayers[aCount++] = SOLDERPASTE_N_BACK; + + if( IsOnLayer( ADHESIVE_N_BACK ) ) + aLayers[aCount++] = ADHESIVE_N_BACK; + + if( IsOnLayer( ADHESIVE_N_FRONT ) ) + aLayers[aCount++] = ADHESIVE_N_FRONT; + #ifdef __WXDEBUG__ - else // Should not occur + if( aCount == 0 ) // Should not occur { - wxLogWarning( wxT("D_PAD::ViewGetLayers():PAD on layer different than FRONT/BACK") ); + wxLogWarning( wxT("D_PAD::ViewGetLayers():PAD has no layer") ); } #endif }