Fixed namecase for private fields in BOARD_DESIGN_SETTINGS class.

Moved a few one-liners of BOARD_DESIGN_SETTINGS class to the header file.
This commit is contained in:
Maciej Suminski 2014-05-13 11:22:51 +02:00
parent cd8aaee160
commit 5af454c28b
2 changed files with 35 additions and 42 deletions

View File

@ -249,7 +249,10 @@ public:
* returns a bit-mask of all the layers that are visible * returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form. * @return int - the visible layers in bit-mapped form.
*/ */
LAYER_MSK GetVisibleLayers() const; LAYER_MSK GetVisibleLayers() const
{
return m_visibleLayers;
}
/** /**
* Function SetVisibleAlls * Function SetVisibleAlls
@ -263,7 +266,10 @@ public:
* changes the bit-mask of visible layers * changes the bit-mask of visible layers
* @param aMask = The new 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 * Function IsLayerVisible
@ -274,7 +280,7 @@ public:
bool IsLayerVisible( LAYER_NUM aLayer ) const bool IsLayerVisible( LAYER_NUM aLayer ) const
{ {
// If a layer is disabled, it is automatically invisible // 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 int GetVisibleElements() const
{ {
return m_VisibleElements; return m_visibleElements;
} }
/** /**
@ -302,7 +308,7 @@ public:
*/ */
void SetVisibleElements( int aMask ) void SetVisibleElements( int aMask )
{ {
m_VisibleElements = aMask; m_visibleElements = aMask;
} }
/** /**
@ -317,7 +323,7 @@ public:
{ {
assert( aElementCategory >= 0 && aElementCategory < END_PCB_VISIBLE_LIST ); 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 inline LAYER_MSK GetEnabledLayers() const
{ {
return m_EnabledLayers; return m_enabledLayers;
} }
/** /**
@ -354,7 +360,7 @@ public:
*/ */
bool IsLayerEnabled( LAYER_NUM aLayer ) const bool IsLayerEnabled( LAYER_NUM aLayer ) const
{ {
return m_EnabledLayers & GetLayerMask( aLayer ); return m_enabledLayers & GetLayerMask( aLayer );
} }
/** /**
@ -363,7 +369,7 @@ public:
*/ */
int GetCopperLayerCount() const int GetCopperLayerCount() const
{ {
return m_CopperLayerCount; return m_copperLayerCount;
} }
/** /**
@ -402,10 +408,10 @@ private:
///> Custom via size (used after UseCustomTrackViaSize( true ) was called). ///> Custom via size (used after UseCustomTrackViaSize( true ) was called).
VIA_DIMENSION m_customViaSize; VIA_DIMENSION m_customViaSize;
int m_CopperLayerCount; ///< Number of copper layers for this design int m_copperLayerCount; ///< Number of copper layers for this design
LAYER_MSK m_EnabledLayers; ///< Bit-mask for layer enabling LAYER_MSK m_enabledLayers; ///< Bit-mask for layer enabling
LAYER_MSK m_VisibleLayers; ///< Bit-mask for layer visibility LAYER_MSK m_visibleLayers; ///< Bit-mask for layer visibility
int m_VisibleElements; ///< Bit-mask for element category visibility int m_visibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer int m_boardThickness; ///< Board thickness for 3D viewer
}; };

View File

@ -54,13 +54,13 @@
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_Pad_Master( NULL ) 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. // SetCopperLayerCount() will adjust this.
SetVisibleLayers( FULL_LAYERS ); SetVisibleLayers( FULL_LAYERS );
// set all but hidden text as visible. // 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 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() void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
{ {
SetVisibleLayers( FULL_LAYERS ); SetVisibleLayers( FULL_LAYERS );
m_VisibleElements = -1; m_visibleElements = -1;
}
void BOARD_DESIGN_SETTINGS::SetVisibleLayers( LAYER_MSK aMask )
{
m_VisibleLayers = aMask & m_EnabledLayers & FULL_LAYERS;
} }
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayer, bool aNewState ) void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayer, bool aNewState )
{ {
if( aNewState && IsLayerEnabled( aLayer ) ) if( aNewState && IsLayerEnabled( aLayer ) )
m_VisibleLayers |= GetLayerMask( aLayer ); m_visibleLayers |= GetLayerMask( aLayer );
else else
m_VisibleLayers &= ~GetLayerMask( aLayer ); m_visibleLayers &= ~GetLayerMask( aLayer );
} }
@ -237,9 +224,9 @@ void BOARD_DESIGN_SETTINGS::SetElementVisibility( int aElementCategory, bool aNe
return; return;
if( aNewState ) if( aNewState )
m_VisibleElements |= 1 << aElementCategory; m_visibleElements |= 1 << aElementCategory;
else 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; // if( aNewLayerCount < 2 ) aNewLayerCount = 2;
m_CopperLayerCount = aNewLayerCount; m_copperLayerCount = aNewLayerCount;
// ensure consistency with the m_EnabledLayers member // ensure consistency with the m_EnabledLayers member
m_EnabledLayers &= ~ALL_CU_LAYERS; m_enabledLayers &= ~ALL_CU_LAYERS;
m_EnabledLayers |= LAYER_BACK; m_enabledLayers |= LAYER_BACK;
if( m_CopperLayerCount > 1 ) if( m_copperLayerCount > 1 )
m_EnabledLayers |= LAYER_FRONT; m_enabledLayers |= LAYER_FRONT;
for( LAYER_NUM ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii ) 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. // Back and front layers are always enabled.
aMask |= LAYER_BACK | LAYER_FRONT; aMask |= LAYER_BACK | LAYER_FRONT;
m_EnabledLayers = aMask; m_enabledLayers = aMask;
// A disabled layer cannot be visible // A disabled layer cannot be visible
m_VisibleLayers &= aMask; m_visibleLayers &= aMask;
// update m_CopperLayerCount to ensure its consistency with m_EnabledLayers // update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
m_CopperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS); m_copperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS);
} }