Commit 89637b89 authored by Maciej Suminski's avatar Maciej Suminski

Separate layers for each copper layer netnames.

parent b7447ff0
......@@ -214,15 +214,35 @@ enum PCB_VISIBLE
MOD_REFERENCES_VISIBLE, ///< show modules references (when texts are visibles)
TRACKS_VISIBLE,
TRACKS_NETNAMES_VISIBLE,
PADS_VISIBLE,
PADS_NETNAMES_VISIBLE,
PADS_HOLES_VISIBLE,
VIAS_HOLES_VISIBLE,
// Netname layers
LAYER_1_NETNAMES_VISIBLE, // Bottom layer
LAYER_2_NETNAMES_VISIBLE,
LAYER_3_NETNAMES_VISIBLE,
LAYER_4_NETNAMES_VISIBLE,
LAYER_5_NETNAMES_VISIBLE,
LAYER_6_NETNAMES_VISIBLE,
LAYER_7_NETNAMES_VISIBLE,
LAYER_8_NETNAMES_VISIBLE,
LAYER_9_NETNAMES_VISIBLE,
LAYER_10_NETNAMES_VISIBLE,
LAYER_11_NETNAMES_VISIBLE,
LAYER_12_NETNAMES_VISIBLE,
LAYER_13_NETNAMES_VISIBLE,
LAYER_14_NETNAMES_VISIBLE,
LAYER_15_NETNAMES_VISIBLE,
LAYER_16_NETNAMES_VISIBLE, // Top layer
PADS_NETNAMES_VISIBLE,
END_PCB_VISIBLE_LIST // sentinel
};
#define FIRST_NETNAME_LAYER ITEM_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE )
#define LAST_NETNAME_LAYER ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE )
/// macro for obtaining layer number for specific item (eg. pad or text)
#define ITEM_GAL_LAYER(layer) (NB_LAYERS + layer)
......@@ -338,4 +358,32 @@ LAYER_NUM ExtractLayer( LAYER_MSK aMask );
*/
wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask );
/**
* Returns a netname layer corresponding to the given layer.
*/
inline LAYER_NUM GetNetnameLayer( LAYER_NUM aLayer )
{
if( IsCopperLayer( aLayer ) )
{
// Compute the offset in description layers
return FIRST_NETNAME_LAYER + ( aLayer - FIRST_COPPER_LAYER );
}
else if( aLayer == ITEM_GAL_LAYER( PADS_VISIBLE ) )
return ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE );
// Fallback
return COMMENT_N;
}
/**
* Function IsCopperLayer
* tests whether a layer is a netname layer
* @param aLayer = Layer to test
* @return true if aLayer is a valid netname layer
*/
inline bool IsNetnameLayer( LAYER_NUM aLayer )
{
return aLayer >= FIRST_NETNAME_LAYER && aLayer <= LAST_NETNAME_LAYER;
}
#endif // _LAYERS_ID_AND_VISIBILITY_H_
......@@ -98,10 +98,24 @@ const int m_galLayerOrder[] =
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( TRACKS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ),
LAYER_N_FRONT, LAYER_N_15, LAYER_N_14, LAYER_N_13,
LAYER_N_12, LAYER_N_11, LAYER_N_10, LAYER_N_9, LAYER_N_8, LAYER_N_7, LAYER_N_6,
LAYER_N_5, LAYER_N_4, LAYER_N_3, LAYER_N_2, LAYER_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ),
ITEM_GAL_LAYER( PAD_FR_VISIBLE ),
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,
ITEM_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
ITEM_GAL_LAYER( LAYER_12_NETNAMES_VISIBLE ), LAYER_N_12,
ITEM_GAL_LAYER( LAYER_11_NETNAMES_VISIBLE ), LAYER_N_11,
ITEM_GAL_LAYER( LAYER_10_NETNAMES_VISIBLE ), LAYER_N_10,
ITEM_GAL_LAYER( LAYER_9_NETNAMES_VISIBLE ), LAYER_N_9,
ITEM_GAL_LAYER( LAYER_8_NETNAMES_VISIBLE ), LAYER_N_8,
ITEM_GAL_LAYER( LAYER_7_NETNAMES_VISIBLE ), LAYER_N_7,
ITEM_GAL_LAYER( LAYER_6_NETNAMES_VISIBLE ), LAYER_N_6,
ITEM_GAL_LAYER( LAYER_5_NETNAMES_VISIBLE ), LAYER_N_5,
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( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,
ITEM_GAL_LAYER( PAD_BK_VISIBLE ),
SOLDERMASK_N_BACK, ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE )
......@@ -227,7 +241,10 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
// Netnames are drawn only when scale is sufficient (level of details)
// so there is no point in caching them
view->SetLayerCached( ITEM_GAL_LAYER( TRACKS_NETNAMES_VISIBLE ), false );
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
{
view->SetLayerCached( GetNetnameLayer( layer ), false );
}
view->SetLayerCached( ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), false );
// Load layer & elements visibility settings
......
......@@ -754,7 +754,7 @@ void TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
{
// Show the track and its netname on different layers
aLayers[0] = GetLayer();
aLayers[1] = ITEM_GAL_LAYER( TRACKS_NETNAMES_VISIBLE );
aLayers[1] = GetNetnameLayer( aLayers[0] );
aCount = 2;
}
......@@ -770,7 +770,7 @@ void TRACK::ViewGetRequiredLayers( int aLayers[], int& aCount ) const
unsigned int TRACK::ViewGetLOD( int aLayer ) const
{
// Netnames will be shown only if zoom is appropriate
if( aLayer == ITEM_GAL_LAYER( TRACKS_NETNAMES_VISIBLE ) )
if( aLayer == GetNetnameLayer( GetLayer() ) )
{
return ( 20000000 / m_Width );
}
......
......@@ -73,7 +73,13 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings
m_itemColors[VIAS_VISIBLE] = COLOR4D( 0.7, 0.7, 0.7, 1.0 );
m_itemColors[PADS_VISIBLE] = COLOR4D( 0.7, 0.7, 0.7, 1.0 );
m_itemColors[PADS_NETNAMES_VISIBLE] = COLOR4D( 0.8, 0.8, 0.8, 0.7 );
m_itemColors[TRACKS_NETNAMES_VISIBLE] = COLOR4D( 0.8, 0.8, 0.8, 0.7 );
// Netnames for copper layers
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
{
// Quick, dirty hack, netnames layers should be stored in usual layers
m_itemColors[GetNetnameLayer( layer ) - NB_LAYERS] = COLOR4D( 0.8, 0.8, 0.8, 0.7 );
}
Update();
}
......@@ -261,7 +267,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
m_gal->SetStrokeColor( color );
if( aLayer == ITEM_GAL_LAYER( TRACKS_NETNAMES_VISIBLE) )
if( IsNetnameLayer( aLayer ) )
{
// If there is a net name - display it on the track
if( netNumber != 0 )
......@@ -289,7 +295,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
m_gal->StrokeText( netName, textPosition, textOrientation );
}
}
else
else if( IsCopperLayer( aLayer ))
{
// Draw a regular track
m_gal->SetIsStroke( true );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment