Commit 948f22de authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio
Browse files

Removed the ugly bit stuffing for the bottom via layer number

(just replaced it with a member)
parent c0879414
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ VIA::VIA( BOARD_ITEM* aParent ) :
    TRACK( aParent, PCB_VIA_T )
{
    SetViaType( VIA_THROUGH );
    m_BottomLayer = LAYER_N_BACK;
    m_Width = Millimeter2iu( 0.5 );
    SetDrillDefault();
}
@@ -432,19 +433,19 @@ LAYER_MSK TRACK::GetLayerMask() const
}


void VIA::SetLayerPair( LAYER_NUM top_layer, LAYER_NUM bottom_layer )
void VIA::SetLayerPair( LAYER_NUM aTopLayer, LAYER_NUM aBottomLayer )
{
    if( GetViaType() == VIA_THROUGH )
    {
        top_layer    = LAYER_N_FRONT;
        bottom_layer = LAYER_N_BACK;
        aTopLayer    = LAYER_N_FRONT;
        aBottomLayer = LAYER_N_BACK;
    }

    if( bottom_layer > top_layer )
        EXCHG( bottom_layer, top_layer );
    if( aBottomLayer > aTopLayer )
        EXCHG( aBottomLayer, aTopLayer );

    // XXX EVIL usage of LAYER
    m_Layer = (top_layer & 15) + ( (bottom_layer & 15) << 4 );
    m_Layer = aTopLayer;
    m_BottomLayer = aBottomLayer;
}


@@ -455,9 +456,8 @@ void VIA::LayerPair( LAYER_NUM* top_layer, LAYER_NUM* bottom_layer ) const

    if( GetViaType() != VIA_THROUGH )
    {
        // XXX EVIL usage of LAYER
        b_layer = (m_Layer >> 4) & 15;
        t_layer = m_Layer & 15;
        b_layer = m_BottomLayer;
        t_layer = m_Layer;

        if( b_layer > t_layer )
            EXCHG( b_layer, t_layer );
+6 −6
Original line number Diff line number Diff line
@@ -371,15 +371,12 @@ public:

    /**
     * Function SetLayerPair
     * set the .m_Layer member param:
     *  For a via m_Layer contains the 2 layers :
     * top layer and bottom layer used by the via.
     * The via connect all layers from top layer to bottom layer
     * 4 bits for the first layer and 4 next bits for the second layer
     * For a via m_Layer contains the top layer, the other layer is in
     * m_BottomLayer
     * @param top_layer = first layer connected by the via
     * @param bottom_layer = last layer connected by the via
     */
    void SetLayerPair( LAYER_NUM top_layer, LAYER_NUM bottom_layer );
    void SetLayerPair( LAYER_NUM aTopLayer, LAYER_NUM aBottomLayer );

    /**
     * Function LayerPair
@@ -453,6 +450,9 @@ protected:
    virtual void GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList );

private:
    /// The bottom layer of the via (the top layer is in m_Layer)
    LAYER_NUM m_BottomLayer;

    VIATYPE_T m_ViaType;        // Type of via

    int       m_Drill;          // for vias: via drill (- 1 for default value)