Commit ee1b8e2a authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Added display of soldermask for pads.

parent 862d5a4b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -261,12 +261,12 @@ 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, SOLDERMASK_N_FRONT,
    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 ),
    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,
    ITEM_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
    ITEM_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
@@ -282,10 +282,10 @@ const LAYER_NUM GalLayerOrder[] =
    ITEM_GAL_LAYER( LAYER_4_NETNAMES_VISIBLE ), LAYER_N_4,
    ITEM_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
    ITEM_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
    ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ),
    ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), SOLDERMASK_N_BACK,
    ITEM_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,

    SOLDERMASK_N_BACK, ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
    ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
    ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE )
};

+32 −8
Original line number Diff line number Diff line
@@ -391,7 +391,7 @@ int D_PAD::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const

// Mask margins handling:

int D_PAD::GetSolderMaskMargin()
int D_PAD::GetSolderMaskMargin() const
{
    int     margin = m_LocalSolderMaskMargin;
    MODULE* module = GetParent();
@@ -748,21 +748,29 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
{
    aCount = 0;

    // These types of pads contain a hole
    if( m_Attribute == PAD_STANDARD || m_Attribute == PAD_HOLE_NOT_PLATED )
        aLayers[aCount++] = ITEM_GAL_LAYER( PADS_HOLES_VISIBLE );

    if( IsOnLayer( LAYER_N_FRONT ) && IsOnLayer( LAYER_N_BACK ) )
    {
        // Multi layer pad
        aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE );
        aLayers[aCount++] = ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE );
        aLayers[aCount++] = SOLDERMASK_N_FRONT;
        aLayers[aCount++] = SOLDERMASK_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;
    }
    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;
    }
#ifdef __WXDEBUG__
    else    // Should not occur
@@ -770,10 +778,6 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
        wxLogWarning( wxT("D_PAD::ViewGetLayers():PAD on layer different than FRONT/BACK") );
    }
#endif

    // These types of pads contain a hole
    if( m_Attribute == PAD_STANDARD || m_Attribute == PAD_HOLE_NOT_PLATED )
        aLayers[aCount++] = ITEM_GAL_LAYER( PADS_HOLES_VISIBLE );
}


@@ -781,14 +785,23 @@ void D_PAD::ViewGetRequiredLayers( int aLayers[], int& aCount ) const
{
    ViewGetLayers( aLayers, aCount );

    // Remove pad description layer from the required layers group
    aCount--;
    // 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;
    }
    else
    {
        // Resto of pads have one soldermask layer and one description layer
        aCount -= 2;
    }
}


unsigned int D_PAD::ViewGetLOD( int aLayer ) const
{
    // Netnames will be shown only if zoom is appropriate
    // Netnames and soldermasks will be shown only if zoom is appropriate
    if( IsNetnameLayer( aLayer ) )
    {
        return ( 100000000 / std::max( m_Size.x, m_Size.y ) );
@@ -797,3 +810,14 @@ unsigned int D_PAD::ViewGetLOD( int aLayer ) const
    // Other layers are shown without any conditions
    return 0;
}


const BOX2I D_PAD::ViewBBox() const
{
    // Bounding box includes soldermask too
    int solderMaskMargin = GetSolderMaskMargin();
    EDA_RECT bbox        = GetBoundingBox();

    return BOX2I( VECTOR2I( bbox.GetOrigin() ) - solderMaskMargin,
                  VECTOR2I( bbox.GetSize() ) + 2 * solderMaskMargin );
}
+4 −1
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ public:
     * 2 - if null, the parent footprint value
     * 1 - if null, the global value
     */
    int GetSolderMaskMargin();
    int GetSolderMaskMargin() const;

    /**
     * Function GetSolderPasteMargin
@@ -442,6 +442,9 @@ public:
    /// @copydoc VIEW_ITEM::ViewGetLOD()
    virtual unsigned int ViewGetLOD( int aLayer ) const;

    /// @copydoc VIEW_ITEM::ViewBBox()
    virtual const BOX2I ViewBBox() const;

    /**
     * Function CopyNetlistSettings
     * copies the netlist settings to \a aPad.
+8 −0
Original line number Diff line number Diff line
@@ -522,6 +522,14 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
        size  = VECTOR2D( aPad->GetDrillSize() ) / 2.0;
        shape = aPad->GetDrillShape();
    }
    else if( aLayer == SOLDERMASK_N_FRONT || aLayer == SOLDERMASK_N_BACK )
    {
        // Drawing soldermask
        m_gal->Translate( VECTOR2D( aPad->GetOffset() ) );
        size  = VECTOR2D( aPad->GetSize().x / 2.0 + aPad->GetSolderMaskMargin(),
                          aPad->GetSize().y / 2.0 + aPad->GetSolderMaskMargin() );
        shape = aPad->GetShape();
    }
    else
    {
        // Drawing every kind of pad