Commit 5af454c2 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Fixed namecase for private fields in BOARD_DESIGN_SETTINGS class.

Moved a few one-liners of BOARD_DESIGN_SETTINGS class to the header file.
parent cd8aaee1
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -249,7 +249,10 @@ public:
     * returns a bit-mask of all the layers that are visible
     * @return int - the visible layers in bit-mapped form.
     */
    LAYER_MSK GetVisibleLayers() const;
    LAYER_MSK GetVisibleLayers() const
    {
        return m_visibleLayers;
    }

    /**
     * Function SetVisibleAlls
@@ -263,7 +266,10 @@ public:
     * changes the bit-mask of visible layers
     * @param aMask = The new bit-mask of visible layers
     */
    void SetVisibleLayers( LAYER_MSK aMask );
    void SetVisibleLayers( LAYER_MSK aMask )
    {
        m_visibleLayers = aMask & m_enabledLayers & FULL_LAYERS;
    }

    /**
     * Function IsLayerVisible
@@ -274,7 +280,7 @@ public:
    bool IsLayerVisible( LAYER_NUM aLayer ) const
    {
        // If a layer is disabled, it is automatically invisible
        return m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayer );
        return m_visibleLayers & m_enabledLayers & GetLayerMask( aLayer );
    }

    /**
@@ -292,7 +298,7 @@ public:
     */
    int GetVisibleElements() const
    {
        return m_VisibleElements;
        return m_visibleElements;
    }

    /**
@@ -302,7 +308,7 @@ public:
     */
    void SetVisibleElements( int aMask )
    {
        m_VisibleElements = aMask;
        m_visibleElements = aMask;
    }

    /**
@@ -317,7 +323,7 @@ public:
    {
        assert( aElementCategory >= 0 && aElementCategory < END_PCB_VISIBLE_LIST );

        return ( m_VisibleElements & ( 1 << aElementCategory ) );
        return ( m_visibleElements & ( 1 << aElementCategory ) );
    }

    /**
@@ -336,7 +342,7 @@ public:
     */
    inline LAYER_MSK GetEnabledLayers() const
    {
        return m_EnabledLayers;
        return m_enabledLayers;
    }

    /**
@@ -354,7 +360,7 @@ public:
     */
    bool IsLayerEnabled( LAYER_NUM aLayer ) const
    {
        return m_EnabledLayers & GetLayerMask( aLayer );
        return m_enabledLayers & GetLayerMask( aLayer );
    }

    /**
@@ -363,7 +369,7 @@ public:
     */
    int GetCopperLayerCount() const
    {
        return m_CopperLayerCount;
        return m_copperLayerCount;
    }

    /**
@@ -402,10 +408,10 @@ private:
    ///> Custom via size (used after UseCustomTrackViaSize( true ) was called).
    VIA_DIMENSION m_customViaSize;

    int       m_CopperLayerCount;   ///< Number of copper layers for this design
    LAYER_MSK m_EnabledLayers;      ///< Bit-mask for layer enabling
    LAYER_MSK m_VisibleLayers;      ///< Bit-mask for layer visibility
    int       m_VisibleElements;    ///< Bit-mask for element category visibility
    int       m_copperLayerCount;   ///< Number of copper layers for this design
    LAYER_MSK m_enabledLayers;      ///< Bit-mask for layer enabling
    LAYER_MSK m_visibleLayers;      ///< Bit-mask for layer visibility
    int       m_visibleElements;    ///< Bit-mask for element category visibility
    int       m_boardThickness;     ///< Board thickness for 3D viewer
};

+16 −29
Original line number Diff line number Diff line
@@ -54,13 +54,13 @@
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
    m_Pad_Master( NULL )
{
    m_EnabledLayers = ALL_LAYERS;               // All layers enabled at first.
    m_enabledLayers = ALL_LAYERS;               // All layers enabled at first.
                                                // SetCopperLayerCount() will adjust this.

    SetVisibleLayers( FULL_LAYERS );

    // set all but hidden text as visible.
    m_VisibleElements = ~( 1 << MOD_TEXT_INVISIBLE );
    m_visibleElements = ~( 1 << MOD_TEXT_INVISIBLE );

    SetCopperLayerCount( 2 );                   // Default design is a double sided board

@@ -202,32 +202,19 @@ void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex )
}


// see pcbstruct.h
LAYER_MSK BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
{
    return m_VisibleLayers;
}


void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
{
    SetVisibleLayers( FULL_LAYERS );
    m_VisibleElements = -1;
}


void BOARD_DESIGN_SETTINGS::SetVisibleLayers( LAYER_MSK aMask )
{
    m_VisibleLayers = aMask & m_EnabledLayers & FULL_LAYERS;
    m_visibleElements = -1;
}


void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayer, bool aNewState )
{
    if( aNewState && IsLayerEnabled( aLayer ) )
        m_VisibleLayers |= GetLayerMask( aLayer );
        m_visibleLayers |= GetLayerMask( aLayer );
    else
        m_VisibleLayers &= ~GetLayerMask( aLayer );
        m_visibleLayers &= ~GetLayerMask( aLayer );
}


@@ -237,9 +224,9 @@ void BOARD_DESIGN_SETTINGS::SetElementVisibility( int aElementCategory, bool aNe
        return;

    if( aNewState )
        m_VisibleElements |= 1 << aElementCategory;
        m_visibleElements |= 1 << aElementCategory;
    else
        m_VisibleElements &= ~( 1 << aElementCategory );
        m_visibleElements &= ~( 1 << aElementCategory );
}


@@ -247,17 +234,17 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
{
    // if( aNewLayerCount < 2 ) aNewLayerCount = 2;

    m_CopperLayerCount = aNewLayerCount;
    m_copperLayerCount = aNewLayerCount;

    // ensure consistency with the m_EnabledLayers member
    m_EnabledLayers &= ~ALL_CU_LAYERS;
    m_EnabledLayers |= LAYER_BACK;
    m_enabledLayers &= ~ALL_CU_LAYERS;
    m_enabledLayers |= LAYER_BACK;

    if( m_CopperLayerCount > 1 )
        m_EnabledLayers |= LAYER_FRONT;
    if( m_copperLayerCount > 1 )
        m_enabledLayers |= LAYER_FRONT;

    for( LAYER_NUM ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii )
        m_EnabledLayers |= GetLayerMask( ii );
        m_enabledLayers |= GetLayerMask( ii );
}


@@ -266,13 +253,13 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
    // Back and front layers are always enabled.
    aMask |= LAYER_BACK | LAYER_FRONT;

    m_EnabledLayers = aMask;
    m_enabledLayers = aMask;

    // A disabled layer cannot be visible
    m_VisibleLayers &= aMask;
    m_visibleLayers &= aMask;

    // update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
    m_CopperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS);
    m_copperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS);
}