void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
{
    aCount = 0;

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

    if( IsOnLayer( F_Cu ) && IsOnLayer( B_Cu ) )
    {
        // Multi layer pad
        aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE );
        aLayers[aCount++] = NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE );
    }
    else if( IsOnLayer( F_Cu ) )
    {
        aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE );
        aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE );
    }
    else if( IsOnLayer( B_Cu ) )
    {
        aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE );
        aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );
    }

    // Check non-copper layers. This list should include all the layers that the
    // footprint editor allows a pad to be placed on.
    static const LAYER_ID layers_mech[] = { F_Mask, B_Mask, F_Paste, B_Paste,
        F_Adhes, B_Adhes, F_SilkS, B_SilkS, Dwgs_User, Eco1_User, Eco2_User };

    BOOST_FOREACH( LAYER_ID each_layer, layers_mech )
    {
        if( IsOnLayer( each_layer ) )
            aLayers[aCount++] = each_layer;
    }

#ifdef __WXDEBUG__
    if( aCount == 0 )    // Should not occur
    {
        wxString msg;
        msg.Printf( wxT( "footprint %s, pad %s: could not find valid layer for pad" ),
                GetParent() ? GetParent()->GetReference() : "<null>",
                GetPadName().IsEmpty() ? "(unnamed)" : GetPadName() );
        wxLogWarning( msg );
    }
#endif
}
wxString D_PAD::GetSelectMenuText() const
{
    wxString text;
    wxString padlayers( LayerMaskDescribe( GetBoard(), m_layerMask ) );
    wxString padname( GetPadName() );

    if( padname.IsEmpty() )
    {
        text.Printf( _( "Pad on %s of %s" ),
                     GetChars( padlayers ),
                     GetChars(GetParent()->GetReference() ) );
    }
    else
    {
        text.Printf( _( "Pad %s on %s of %s" ),
                     GetChars(GetPadName() ), GetChars( padlayers ),
                     GetChars(GetParent()->GetReference() ) );
    }

    return text;
}
示例#3
0
wxString D_PAD::GetSelectMenuText() const
{
    wxString text;
    wxString padlayers;
    BOARD * board = GetBoard();


    if ( (m_layerMask & ALL_CU_LAYERS) == ALL_CU_LAYERS )
        padlayers = _("all copper layers");
    else if( (m_layerMask & LAYER_BACK ) == LAYER_BACK )
        padlayers = board->GetLayerName(LAYER_N_BACK);
    else if( (m_layerMask & LAYER_FRONT) == LAYER_FRONT )
        padlayers = board->GetLayerName(LAYER_N_FRONT);
    else
        padlayers = _( "???" );

    text.Printf( _( "Pad [%s] (%s) of %s" ),
                 GetChars(GetPadName() ), GetChars( padlayers ),
                 GetChars(( (MODULE*) GetParent() )->GetReference() ) );

    return text;
}
// Called when a pin properties changes
void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
{
    if( ! IsShown() )   // do nothing at init time
        return;

    int pinNameSize = ValueFromString( g_UserUnit, GetPinNameTextSize() );
    int pinNumSize = ValueFromString( g_UserUnit, GetPadNameTextSize());
    int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() );
    int pinLength = ValueFromString( g_UserUnit, GetLength() );
    GRAPHIC_PINSHAPE pinShape = GetStyle();
    ELECTRICAL_PINTYPE pinType = GetElectricalType();

    m_dummyPin->SetName( GetPinName() );
    m_dummyPin->SetNameTextSize( pinNameSize );
    m_dummyPin->SetNumber( GetPadName() );
    m_dummyPin->SetNumberTextSize( pinNumSize );
    m_dummyPin->SetOrientation( pinOrient );
    m_dummyPin->SetLength( pinLength );
    m_dummyPin->SetShape( pinShape );
    m_dummyPin->SetVisible( GetVisible() );
    m_dummyPin->SetType( pinType );

    m_panelShowPin->Refresh();
}