diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index 2c8f2d079a..e2304461c7 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -261,13 +261,13 @@ const LAYER_NUM GalLayerOrder[] = UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31, ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ), - SILKSCREEN_N_FRONT, SOLDERPASTE_N_FRONT, ADHESIVE_N_FRONT, ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), SOLDERMASK_N_FRONT, ITEM_GAL_LAYER( LAYER_16_NETNAMES_VISIBLE ), LAYER_N_FRONT, + SILKSCREEN_N_FRONT, SOLDERPASTE_N_FRONT, ADHESIVE_N_FRONT, ITEM_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15, ITEM_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14, ITEM_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13, diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 69e4ae4e53..2a62d6d901 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -424,7 +424,7 @@ int D_PAD::GetSolderMaskMargin() const } -wxSize D_PAD::GetSolderPasteMargin() +wxSize D_PAD::GetSolderPasteMargin() const { int margin = m_LocalSolderPasteMargin; double mratio = m_LocalSolderPasteMarginRatio; @@ -759,18 +759,22 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const aLayers[aCount++] = ITEM_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++] = ITEM_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++] = ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ); aLayers[aCount++] = SOLDERMASK_N_BACK; + aLayers[aCount++] = SOLDERPASTE_N_BACK; } #ifdef __WXDEBUG__ else // Should not occur @@ -788,13 +792,16 @@ void D_PAD::ViewGetRequiredLayers( int aLayers[], int& aCount ) const // Remove pad description layer & soldermask from the required layers group if( IsOnLayer( LAYER_N_FRONT ) && IsOnLayer( LAYER_N_BACK ) ) { - // Multilayer pads have 2 soldermask layers and one description layer - aCount -= 3; + // Multilayer pads have 2 soldermask layers (front and back), 2 solder paste layer + // (front and back) and one description layer that do not have to be enabled in order to + // display a pad. + aCount -= 5; } else { - // Rest of pads have one soldermask layer and one description layer - aCount -= 2; + // Rest of pads have one soldermask layer, one solder paste layer and one description layer + // that are not necessary for pad to be displayed. + aCount -= 3; } } @@ -815,9 +822,14 @@ unsigned int D_PAD::ViewGetLOD( int aLayer ) const const BOX2I D_PAD::ViewBBox() const { // Bounding box includes soldermask too - int solderMaskMargin = GetSolderMaskMargin(); - EDA_RECT bbox = GetBoundingBox(); + int solderMaskMargin = GetSolderMaskMargin(); + VECTOR2I solderPasteMargin = VECTOR2D( GetSolderPasteMargin() ); + EDA_RECT bbox = GetBoundingBox(); - return BOX2I( VECTOR2I( bbox.GetOrigin() ) - solderMaskMargin, - VECTOR2I( bbox.GetSize() ) + 2 * solderMaskMargin ); + // Look for the biggest possible bounding box + int xMargin = std::max( solderMaskMargin, solderPasteMargin.x ); + int yMargin = std::max( solderMaskMargin, solderPasteMargin.y ); + + return BOX2I( VECTOR2I( bbox.GetOrigin() ) - VECTOR2I( xMargin, yMargin ), + VECTOR2I( bbox.GetSize() ) + VECTOR2I( 2 * xMargin, 2 * yMargin ) ); } diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index e5eeaa297e..f72705e9fc 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -259,7 +259,7 @@ public: * 2 - if null, the parent footprint value * 1 - if null, the global value */ - wxSize GetSolderPasteMargin(); + wxSize GetSolderPasteMargin() const; void SetZoneConnection( ZoneConnection aType ) { m_ZoneConnection = aType; } ZoneConnection GetZoneConnection() const; diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index b2ff0b483b..cdccda1f82 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -525,9 +525,21 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer ) else if( aLayer == SOLDERMASK_N_FRONT || aLayer == SOLDERMASK_N_BACK ) { // Drawing soldermask + int soldermaskMargin = aPad->GetSolderMaskMargin(); + m_gal->Translate( VECTOR2D( aPad->GetOffset() ) ); - size = VECTOR2D( aPad->GetSize().x / 2.0 + aPad->GetSolderMaskMargin(), - aPad->GetSize().y / 2.0 + aPad->GetSolderMaskMargin() ); + size = VECTOR2D( aPad->GetSize().x / 2.0 + soldermaskMargin, + aPad->GetSize().y / 2.0 + soldermaskMargin ); + shape = aPad->GetShape(); + } + else if( aLayer == SOLDERPASTE_N_FRONT || aLayer == SOLDERPASTE_N_BACK ) + { + // Drawing solderpaste + int solderpasteMargin = aPad->GetLocalSolderPasteMargin(); + + m_gal->Translate( VECTOR2D( aPad->GetOffset() ) ); + size = VECTOR2D( aPad->GetSize().x / 2.0 + solderpasteMargin, + aPad->GetSize().y / 2.0 + solderpasteMargin ); shape = aPad->GetShape(); } else