Refactor layer enumerations to all live in the same place

This commit is contained in:
Jon Evans 2017-03-12 23:19:33 -04:00 committed by Wayne Stambaugh
parent 40f60c9871
commit 3ec28e2acf
168 changed files with 1302 additions and 1290 deletions

View File

@ -120,9 +120,9 @@ CINFO3D_VISU::~CINFO3D_VISU()
} }
bool CINFO3D_VISU::Is3DLayerEnabled( LAYER_ID aLayer ) const bool CINFO3D_VISU::Is3DLayerEnabled( PCB_LAYER_ID aLayer ) const
{ {
wxASSERT( aLayer < LAYER_ID_COUNT ); wxASSERT( aLayer < PCB_LAYER_ID_COUNT );
DISPLAY3D_FLG flg; DISPLAY3D_FLG flg;
@ -372,7 +372,7 @@ void CINFO3D_VISU::InitSettings( REPORTER *aStatusTextReporter )
// calculate z position for each non copper layer // calculate z position for each non copper layer
// Solder mask and Solder paste have the same Z position // Solder mask and Solder paste have the same Z position
for( int layer_id = MAX_CU_LAYERS; layer_id < LAYER_ID_COUNT; ++layer_id ) for( int layer_id = MAX_CU_LAYERS; layer_id < PCB_LAYER_ID_COUNT; ++layer_id )
{ {
float zposTop; float zposTop;
float zposBottom; float zposBottom;
@ -526,9 +526,9 @@ void CINFO3D_VISU::CameraSetType( CAMERA_TYPE aCameraType )
} }
SFVEC3F CINFO3D_VISU::GetLayerColor( LAYER_ID aLayerId ) const SFVEC3F CINFO3D_VISU::GetLayerColor( PCB_LAYER_ID aLayerId ) const
{ {
wxASSERT( aLayerId < LAYER_ID_COUNT ); wxASSERT( aLayerId < PCB_LAYER_ID_COUNT );
const COLOR4D color = g_ColorsSettings.GetLayerColor( aLayerId ); const COLOR4D color = g_ColorsSettings.GetLayerColor( aLayerId );

View File

@ -52,10 +52,10 @@
#include <reporter.h> #include <reporter.h>
/// A type that stores a container of 2d objects for each layer id /// A type that stores a container of 2d objects for each layer id
typedef std::map< LAYER_ID, CBVHCONTAINER2D *> MAP_CONTAINER_2D; typedef std::map< PCB_LAYER_ID, CBVHCONTAINER2D *> MAP_CONTAINER_2D;
/// A type that stores polysets for each layer id /// A type that stores polysets for each layer id
typedef std::map< LAYER_ID, SHAPE_POLY_SET *> MAP_POLY; typedef std::map< PCB_LAYER_ID, SHAPE_POLY_SET *> MAP_POLY;
/// This defines the range that all coord will have to be rendered. /// This defines the range that all coord will have to be rendered.
/// It will use this value to convert to a normalized value between /// It will use this value to convert to a normalized value between
@ -106,7 +106,7 @@ class CINFO3D_VISU
* @param aLayer: layer ID to get status * @param aLayer: layer ID to get status
* @return true if layer should be displayed, false if not * @return true if layer should be displayed, false if not
*/ */
bool Is3DLayerEnabled( LAYER_ID aLayer ) const; bool Is3DLayerEnabled( PCB_LAYER_ID aLayer ) const;
/** /**
* @brief ShouldModuleBeDisplayed - Test if module should be displayed in * @brief ShouldModuleBeDisplayed - Test if module should be displayed in
@ -256,7 +256,7 @@ class CINFO3D_VISU
* @param aLayerId: the layer to get the color information * @param aLayerId: the layer to get the color information
* @return the color in SFVEC3F format * @return the color in SFVEC3F format
*/ */
SFVEC3F GetLayerColor( LAYER_ID aLayerId ) const; SFVEC3F GetLayerColor( PCB_LAYER_ID aLayerId ) const;
/** /**
* @brief GetItemColor - get the technical color of a layer * @brief GetItemColor - get the technical color of a layer
@ -277,14 +277,14 @@ class CINFO3D_VISU
* @param aLayerId: layer id * @param aLayerId: layer id
* @return position in 3D unities * @return position in 3D unities
*/ */
float GetLayerTopZpos3DU( LAYER_ID aLayerId ) const { return m_layerZcoordTop[aLayerId]; } float GetLayerTopZpos3DU( PCB_LAYER_ID aLayerId ) const { return m_layerZcoordTop[aLayerId]; }
/** /**
* @brief GetLayerBottomZpos3DU - Get the bottom z position * @brief GetLayerBottomZpos3DU - Get the bottom z position
* @param aLayerId: layer id * @param aLayerId: layer id
* @return position in 3D unities * @return position in 3D unities
*/ */
float GetLayerBottomZpos3DU( LAYER_ID aLayerId ) const { return m_layerZcoordBottom[aLayerId]; } float GetLayerBottomZpos3DU( PCB_LAYER_ID aLayerId ) const { return m_layerZcoordBottom[aLayerId]; }
/** /**
* @brief GetMapLayers - Get the map of container that have the objects per layer * @brief GetMapLayers - Get the map of container that have the objects per layer
@ -437,33 +437,33 @@ class CINFO3D_VISU
void AddPadsShapesWithClearanceToContainer( const MODULE *aModule, void AddPadsShapesWithClearanceToContainer( const MODULE *aModule,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue, int aInflateValue,
bool aSkipNPTHPadsWihNoCopper ); bool aSkipNPTHPadsWihNoCopper );
void AddGraphicsShapesWithClearanceToContainer( const MODULE *aModule, void AddGraphicsShapesWithClearanceToContainer( const MODULE *aModule,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue ); int aInflateValue );
void AddShapeWithClearanceToContainer( const TEXTE_PCB *aTextPCB, void AddShapeWithClearanceToContainer( const TEXTE_PCB *aTextPCB,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aClearanceValue ); int aClearanceValue );
void AddShapeWithClearanceToContainer( const DRAWSEGMENT *aDrawSegment, void AddShapeWithClearanceToContainer( const DRAWSEGMENT *aDrawSegment,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aClearanceValue ); int aClearanceValue );
void AddShapeWithClearanceToContainer( const DIMENSION *aDimension, void AddShapeWithClearanceToContainer( const DIMENSION *aDimension,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aClearanceValue ); int aClearanceValue );
void AddSolidAreasShapesToContainer( const ZONE_CONTAINER *aZoneContainer, void AddSolidAreasShapesToContainer( const ZONE_CONTAINER *aZoneContainer,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId ); PCB_LAYER_ID aLayerId );
void TransformArcToSegments( const wxPoint &aCentre, void TransformArcToSegments( const wxPoint &aCentre,
const wxPoint &aStart, const wxPoint &aStart,
@ -483,13 +483,13 @@ class CINFO3D_VISU
int aWidth) const; int aWidth) const;
void transformPadsShapesWithClearanceToPolygon( const DLIST<D_PAD> &aPads, void transformPadsShapesWithClearanceToPolygon( const DLIST<D_PAD> &aPads,
LAYER_ID aLayer, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET &aCornerBuffer, SHAPE_POLY_SET &aCornerBuffer,
int aInflateValue, int aInflateValue,
bool aSkipNPTHPadsWihNoCopper) const; bool aSkipNPTHPadsWihNoCopper) const;
void transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule, void transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule,
LAYER_ID aLayer, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer ) const; SHAPE_POLY_SET& aCornerBuffer ) const;
void buildPadShapePolygon( const D_PAD *aPad, void buildPadShapePolygon( const D_PAD *aPad,
@ -616,10 +616,10 @@ class CINFO3D_VISU
double m_biuTo3Dunits; double m_biuTo3Dunits;
/// Top (End) Z position of each layer (normalized) /// Top (End) Z position of each layer (normalized)
float m_layerZcoordTop[LAYER_ID_COUNT]; float m_layerZcoordTop[PCB_LAYER_ID_COUNT];
/// Bottom (Start) Z position of each layer (normalized) /// Bottom (Start) Z position of each layer (normalized)
float m_layerZcoordBottom[LAYER_ID_COUNT]; float m_layerZcoordBottom[PCB_LAYER_ID_COUNT];
/// Copper thickness (normalized) /// Copper thickness (normalized)
float m_copperThickness3DU; float m_copperThickness3DU;

View File

@ -91,7 +91,7 @@ void addTextSegmToContainer( int x0, int y0, int xf, int yf )
// board_items_to_polygon_shape_transform.cpp // board_items_to_polygon_shape_transform.cpp
void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aTextPCB, void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aTextPCB,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aClearanceValue ) int aClearanceValue )
{ {
wxSize size = aTextPCB->GetTextSize(); wxSize size = aTextPCB->GetTextSize();
@ -141,7 +141,7 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aTextPCB,
void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DIMENSION* aDimension, void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DIMENSION* aDimension,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aClearanceValue ) int aClearanceValue )
{ {
AddShapeWithClearanceToContainer(&aDimension->Text(), aDstContainer, aLayerId, aClearanceValue); AddShapeWithClearanceToContainer(&aDimension->Text(), aDstContainer, aLayerId, aClearanceValue);
@ -178,7 +178,7 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DIMENSION* aDimension
// board_items_to_polygon_shape_transform.cpp#L204 // board_items_to_polygon_shape_transform.cpp#L204
void CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer( const MODULE* aModule, void CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer( const MODULE* aModule,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue ) int aInflateValue )
{ {
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
@ -603,7 +603,7 @@ void CINFO3D_VISU::createNewPad( const D_PAD* aPad,
void CINFO3D_VISU::AddPadsShapesWithClearanceToContainer( const MODULE* aModule, void CINFO3D_VISU::AddPadsShapesWithClearanceToContainer( const MODULE* aModule,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue, int aInflateValue,
bool aSkipNPTHPadsWihNoCopper ) bool aSkipNPTHPadsWihNoCopper )
{ {
@ -745,7 +745,7 @@ void CINFO3D_VISU::TransformArcToSegments( const wxPoint &aCentre,
// board_items_to_polygon_shape_transform.cpp#L431 // board_items_to_polygon_shape_transform.cpp#L431
void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSegment, void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSegment,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aClearanceValue ) int aClearanceValue )
{ {
// The full width of the lines to create: // The full width of the lines to create:
@ -909,7 +909,7 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
// board_items_to_polygon_shape_transform.cpp // board_items_to_polygon_shape_transform.cpp
void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneContainer, void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneContainer,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
LAYER_ID aLayerId ) PCB_LAYER_ID aLayerId )
{ {
// Copy the polys list because we have to simplify it // Copy the polys list because we have to simplify it
SHAPE_POLY_SET polyList = SHAPE_POLY_SET(aZoneContainer->GetFilledPolysList()); SHAPE_POLY_SET polyList = SHAPE_POLY_SET(aZoneContainer->GetFilledPolysList());
@ -1164,7 +1164,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
unsigned start_Time = stats_startCopperLayersTime; unsigned start_Time = stats_startCopperLayersTime;
#endif #endif
LAYER_ID cu_seq[MAX_CU_LAYERS]; PCB_LAYER_ID cu_seq[MAX_CU_LAYERS];
LSET cu_set = LSET::AllCuMask( m_copperLayersCount ); LSET cu_set = LSET::AllCuMask( m_copperLayersCount );
m_stats_nr_tracks = 0; m_stats_nr_tracks = 0;
@ -1216,7 +1216,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Prepare copper layers index and containers // Prepare copper layers index and containers
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
std::vector< LAYER_ID > layer_id; std::vector< PCB_LAYER_ID > layer_id;
layer_id.clear(); layer_id.clear();
layer_id.reserve( m_copperLayersCount ); layer_id.reserve( m_copperLayersCount );
@ -1225,7 +1225,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
for( LSEQ cu = cu_set.Seq( cu_seq, DIM( cu_seq ) ); cu; ++cu ) for( LSEQ cu = cu_set.Seq( cu_seq, DIM( cu_seq ) ); cu; ++cu )
{ {
const LAYER_ID curr_layer_id = *cu; const PCB_LAYER_ID curr_layer_id = *cu;
if( !Is3DLayerEnabled( curr_layer_id ) ) // Skip non enabled layers if( !Is3DLayerEnabled( curr_layer_id ) ) // Skip non enabled layers
continue; continue;
@ -1255,7 +1255,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() ); wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() );
@ -1286,7 +1286,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
// ADD TRACKS // ADD TRACKS
unsigned int nTracks = trackList.size(); unsigned int nTracks = trackList.size();
@ -1370,7 +1370,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
// ADD TRACKS // ADD TRACKS
const unsigned int nTracks = trackList.size(); const unsigned int nTracks = trackList.size();
@ -1481,7 +1481,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
{ {
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() ); wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
@ -1599,7 +1599,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() ); wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() );
@ -1636,7 +1636,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
{ {
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() ); wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
@ -1679,7 +1679,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() ); wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() );
@ -1739,7 +1739,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
{ {
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() ); wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
@ -1800,7 +1800,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// ///////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
if( aStatusTextReporter ) if( aStatusTextReporter )
aStatusTextReporter->Report( wxString::Format( _( "Create zones of layer %s" ), aStatusTextReporter->Report( wxString::Format( _( "Create zones of layer %s" ),
@ -1814,7 +1814,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii ) for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
{ {
const ZONE_CONTAINER* zone = m_board->GetArea( ii ); const ZONE_CONTAINER* zone = m_board->GetArea( ii );
const LAYER_ID zonelayer = zone->GetLayer(); const PCB_LAYER_ID zonelayer = zone->GetLayer();
if( zonelayer == curr_layer_id ) if( zonelayer == curr_layer_id )
{ {
@ -1839,7 +1839,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// ///////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() ); wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
@ -1880,7 +1880,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
#pragma omp parallel for #pragma omp parallel for
for( signed int lIdx = 0; lIdx < nLayers; ++lIdx ) for( signed int lIdx = 0; lIdx < nLayers; ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() ); wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
@ -1905,7 +1905,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx ) for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{ {
const LAYER_ID curr_layer_id = layer_id[lIdx]; const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
if( m_layers_outer_holes_poly.find( curr_layer_id ) != if( m_layers_outer_holes_poly.find( curr_layer_id ) !=
m_layers_outer_holes_poly.end() ) m_layers_outer_holes_poly.end() )
@ -1951,7 +1951,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
aStatusTextReporter->Report( _( "Build Tech layers" ) ); aStatusTextReporter->Report( _( "Build Tech layers" ) );
// draw graphic items, on technical layers // draw graphic items, on technical layers
static const LAYER_ID teckLayerList[] = { static const PCB_LAYER_ID teckLayerList[] = {
B_Adhes, B_Adhes,
F_Adhes, F_Adhes,
B_Paste, B_Paste,
@ -1975,7 +1975,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
seq; seq;
++seq ) ++seq )
{ {
const LAYER_ID curr_layer_id = *seq; const PCB_LAYER_ID curr_layer_id = *seq;
if( !Is3DLayerEnabled( curr_layer_id ) ) if( !Is3DLayerEnabled( curr_layer_id ) )
continue; continue;

View File

@ -125,7 +125,7 @@ void CINFO3D_VISU::buildPadShapeThickOutlineAsPolygon( const D_PAD* aPad,
// Based on the same function name in board_items_to_polyshape_transform.cpp // Based on the same function name in board_items_to_polyshape_transform.cpp
// It was implemented here to allow dynamic segments count per pad shape // It was implemented here to allow dynamic segments count per pad shape
void CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon( const DLIST<D_PAD>& aPads, LAYER_ID aLayer, void CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon( const DLIST<D_PAD>& aPads, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue, int aInflateValue,
bool aSkipNPTHPadsWihNoCopper ) const bool aSkipNPTHPadsWihNoCopper ) const
@ -191,7 +191,7 @@ void CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon( const DLIST<D_PAD>
} }
void CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule, void CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule,
LAYER_ID aLayer, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer ) const SHAPE_POLY_SET& aCornerBuffer ) const
{ {
for( const EDA_ITEM* item = aModule->GraphicalItems(); for( const EDA_ITEM* item = aModule->GraphicalItems();

View File

@ -493,7 +493,7 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
ii != outerMapHoles.end(); ii != outerMapHoles.end();
++ii ) ++ii )
{ {
LAYER_ID layer_id = static_cast<LAYER_ID>(ii->first); PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
const SHAPE_POLY_SET *poly = static_cast<const SHAPE_POLY_SET *>(ii->second); const SHAPE_POLY_SET *poly = static_cast<const SHAPE_POLY_SET *>(ii->second);
const CBVHCONTAINER2D *container = map_holes.at( layer_id ); const CBVHCONTAINER2D *container = map_holes.at( layer_id );
@ -511,7 +511,7 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
ii != innerMapHoles.end(); ii != innerMapHoles.end();
++ii ) ++ii )
{ {
LAYER_ID layer_id = static_cast<LAYER_ID>(ii->first); PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
const SHAPE_POLY_SET *poly = static_cast<const SHAPE_POLY_SET *>(ii->second); const SHAPE_POLY_SET *poly = static_cast<const SHAPE_POLY_SET *>(ii->second);
const CBVHCONTAINER2D *container = map_holes.at( layer_id ); const CBVHCONTAINER2D *container = map_holes.at( layer_id );
@ -539,7 +539,7 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
ii != m_settings.GetMapLayers().end(); ii != m_settings.GetMapLayers().end();
++ii ) ++ii )
{ {
LAYER_ID layer_id = static_cast<LAYER_ID>(ii->first); PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
if( !m_settings.Is3DLayerEnabled( layer_id ) ) if( !m_settings.Is3DLayerEnabled( layer_id ) )
continue; continue;
@ -685,7 +685,7 @@ void C3D_RENDER_OGL_LEGACY::add_triangle_top_bot( CLAYER_TRIANGLES *aDst,
} }
void C3D_RENDER_OGL_LEGACY::get_layer_z_pos ( LAYER_ID aLayerID, void C3D_RENDER_OGL_LEGACY::get_layer_z_pos ( PCB_LAYER_ID aLayerID,
float &aOutZtop, float &aOutZtop,
float &aOutZbot ) const float &aOutZbot ) const
{ {
@ -773,7 +773,7 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads()
const SFVEC2F via_center( via->GetStart().x * m_settings.BiuTo3Dunits(), const SFVEC2F via_center( via->GetStart().x * m_settings.BiuTo3Dunits(),
-via->GetStart().y * m_settings.BiuTo3Dunits() ); -via->GetStart().y * m_settings.BiuTo3Dunits() );
LAYER_ID top_layer, bottom_layer; PCB_LAYER_ID top_layer, bottom_layer;
via->LayerPair( &top_layer, &bottom_layer ); via->LayerPair( &top_layer, &bottom_layer );
float ztop, zbot, dummy; float ztop, zbot, dummy;

View File

@ -302,7 +302,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
} }
void C3D_RENDER_OGL_LEGACY::set_layer_material( LAYER_ID aLayerID ) void C3D_RENDER_OGL_LEGACY::set_layer_material( PCB_LAYER_ID aLayerID )
{ {
switch( aLayerID ) switch( aLayerID )
{ {
@ -360,7 +360,7 @@ void C3D_RENDER_OGL_LEGACY::set_layer_material( LAYER_ID aLayerID )
} }
SFVEC3F C3D_RENDER_OGL_LEGACY::get_layer_color( LAYER_ID aLayerID ) SFVEC3F C3D_RENDER_OGL_LEGACY::get_layer_color( PCB_LAYER_ID aLayerID )
{ {
SFVEC3F layerColor = m_settings.GetLayerColor( aLayerID ); SFVEC3F layerColor = m_settings.GetLayerColor( aLayerID );
@ -623,7 +623,7 @@ bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving,
++ii ) ++ii )
{ {
const LAYER_ID layer_id = (LAYER_ID)(ii->first); const PCB_LAYER_ID layer_id = (PCB_LAYER_ID)(ii->first);
// Mask kayers are not processed here because they are a special case // Mask kayers are not processed here because they are a special case
if( (layer_id == B_Mask) || (layer_id == F_Mask) ) if( (layer_id == B_Mask) || (layer_id == F_Mask) )
@ -918,7 +918,7 @@ void C3D_RENDER_OGL_LEGACY::ogl_free_all_display_lists()
} }
void C3D_RENDER_OGL_LEGACY::render_solder_mask_layer( LAYER_ID aLayerID, void C3D_RENDER_OGL_LEGACY::render_solder_mask_layer( PCB_LAYER_ID aLayerID,
float aZPosition, float aZPosition,
bool aIsRenderingOnPreviewMode ) bool aIsRenderingOnPreviewMode )
{ {

View File

@ -47,8 +47,8 @@
#include <map> #include <map>
typedef std::map< LAYER_ID, CLAYERS_OGL_DISP_LISTS* > MAP_OGL_DISP_LISTS; typedef std::map< PCB_LAYER_ID, CLAYERS_OGL_DISP_LISTS* > MAP_OGL_DISP_LISTS;
typedef std::map< LAYER_ID, CLAYER_TRIANGLES * > MAP_TRIANGLES; typedef std::map< PCB_LAYER_ID, CLAYER_TRIANGLES * > MAP_TRIANGLES;
typedef std::map< wxString, C_OGL_3DMODEL * > MAP_3DMODEL; typedef std::map< wxString, C_OGL_3DMODEL * > MAP_3DMODEL;
#define SIZE_OF_CIRCLE_TEXTURE 1024 #define SIZE_OF_CIRCLE_TEXTURE 1024
@ -148,11 +148,11 @@ private:
float aZtop, float aZtop,
float aZbot ); float aZbot );
void render_solder_mask_layer( LAYER_ID aLayerID, void render_solder_mask_layer( PCB_LAYER_ID aLayerID,
float aZPosition, float aZPosition,
bool aIsRenderingOnPreviewMode ); bool aIsRenderingOnPreviewMode );
void get_layer_z_pos( LAYER_ID aLayerID, void get_layer_z_pos( PCB_LAYER_ID aLayerID,
float &aOutZtop, float &aOutZtop,
float &aOutZbot ) const; float &aOutZbot ) const;
@ -208,12 +208,12 @@ private:
SMATERIAL m_GrayMaterial; SMATERIAL m_GrayMaterial;
}m_materials; }m_materials;
void set_layer_material( LAYER_ID aLayerID ); void set_layer_material( PCB_LAYER_ID aLayerID );
SFVEC3F get_layer_color( LAYER_ID aLayerID ); SFVEC3F get_layer_color( PCB_LAYER_ID aLayerID );
public: public:
const MAP_OGL_DISP_LISTS &GetLayerDispListMap() const { return m_ogl_disp_lists_layers; } const MAP_OGL_DISP_LISTS &GetLayerDispListMap() const { return m_ogl_disp_lists_layers; }
const CLAYERS_OGL_DISP_LISTS *GetLayerDispList( LAYER_ID aLayerId ) const { return m_ogl_disp_lists_layers.at( aLayerId ); } const CLAYERS_OGL_DISP_LISTS *GetLayerDispList( PCB_LAYER_ID aLayerId ) const { return m_ogl_disp_lists_layers.at( aLayerId ); }
const CLAYERS_OGL_DISP_LISTS *GetBoardDispList() const { return m_ogl_disp_list_board; } const CLAYERS_OGL_DISP_LISTS *GetBoardDispList() const { return m_ogl_disp_list_board; }
}; };

View File

@ -442,7 +442,7 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
ii != m_settings.GetMapLayers().end(); ii != m_settings.GetMapLayers().end();
++ii ) ++ii )
{ {
LAYER_ID layer_id = static_cast<LAYER_ID>(ii->first); PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
// Mask kayers are not processed here because they are a special case // Mask kayers are not processed here because they are a special case
if( (layer_id == B_Mask) || (layer_id == F_Mask) ) if( (layer_id == B_Mask) || (layer_id == F_Mask) )
@ -644,7 +644,7 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
ii != m_settings.GetMapLayers().end(); ii != m_settings.GetMapLayers().end();
++ii ) ++ii )
{ {
LAYER_ID layer_id = static_cast<LAYER_ID>(ii->first); PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
const CBVHCONTAINER2D *containerLayer2d = const CBVHCONTAINER2D *containerLayer2d =
static_cast<const CBVHCONTAINER2D *>(ii->second); static_cast<const CBVHCONTAINER2D *>(ii->second);
@ -971,7 +971,7 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
// 3d_draw_helper_functions.cpp // 3d_draw_helper_functions.cpp
void C3D_RENDER_RAYTRACING::insert3DViaHole( const VIA* aVia ) void C3D_RENDER_RAYTRACING::insert3DViaHole( const VIA* aVia )
{ {
LAYER_ID top_layer, bottom_layer; PCB_LAYER_ID top_layer, bottom_layer;
int radiusBUI = (aVia->GetDrillValue() / 2); int radiusBUI = (aVia->GetDrillValue() / 2);
aVia->LayerPair( &top_layer, &bottom_layer ); aVia->LayerPair( &top_layer, &bottom_layer );
@ -1001,7 +1001,7 @@ void C3D_RENDER_RAYTRACING::insert3DViaHole( const VIA* aVia )
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) ) if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
objPtr->SetColor( ConvertSRGBToLinear( (SFVEC3F)m_settings.m_CopperColor ) ); objPtr->SetColor( ConvertSRGBToLinear( (SFVEC3F)m_settings.m_CopperColor ) );
else else
objPtr->SetColor( ConvertSRGBToLinear( m_settings.GetItemColor( VIAS_VISIBLE + aVia->GetViaType() ) ) ); objPtr->SetColor( ConvertSRGBToLinear( m_settings.GetItemColor( LAYER_VIAS + aVia->GetViaType() ) ) );
m_object_container.Add( objPtr ); m_object_container.Add( objPtr );
} }
@ -1018,7 +1018,7 @@ void C3D_RENDER_RAYTRACING::insert3DPadHole( const D_PAD* aPad )
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) ) if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
objColor = (SFVEC3F)m_settings.m_CopperColor; objColor = (SFVEC3F)m_settings.m_CopperColor;
else else
objColor = m_settings.GetItemColor( PADS_VISIBLE ); objColor = m_settings.GetItemColor( LAYER_PADS );
const wxSize drillsize = aPad->GetDrillSize(); const wxSize drillsize = aPad->GetDrillSize();
const bool hasHole = drillsize.x && drillsize.y; const bool hasHole = drillsize.x && drillsize.y;

View File

@ -66,18 +66,18 @@ static const EDA_COLOR_T default_layer_color[] = {
static const EDA_COLOR_T default_items_color[] = { static const EDA_COLOR_T default_items_color[] = {
LIGHTGRAY, // unused LIGHTGRAY, // unused
CYAN, // VIA_MICROVIA_VISIBLE CYAN, // LAYER_VIA_MICROVIA
BROWN, // VIA_BBLIND_VISIBLE BROWN, // LAYER_VIA_BBLIND
LIGHTGRAY, // VIA_THROUGH_VISIBLE LIGHTGRAY, // LAYER_VIA_THROUGH
YELLOW, // NON_PLATED_VISIBLE YELLOW, // LAYER_NON_PLATED
LIGHTGRAY, // MOD_TEXT_FR_VISIBLE LIGHTGRAY, // LAYER_MOD_TEXT_FR
BLUE, // MOD_TEXT_BK_VISIBLE BLUE, // LAYER_MOD_TEXT_BK
DARKGRAY, // MOD_TEXT_INVISIBLE DARKGRAY, // LAYER_MOD_TEXT_INVISIBLE
BLUE, // ANCHOR_VISIBLE BLUE, // LAYER_ANCHOR
RED, // PAD_FR_VISIBLE RED, // LAYER_PAD_FR
GREEN, // PAD_BK_VISIBLE GREEN, // LAYER_PAD_BK
LIGHTGRAY, // RATSNEST_VISIBLE LIGHTGRAY, // LAYER_RATSNEST
DARKGRAY, // GRID_VISIBLE DARKGRAY, // LAYER_GRID
LIGHTRED, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTRED, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
@ -88,7 +88,7 @@ static const EDA_COLOR_T default_items_color[] = {
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS() COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
{ {
for( unsigned src = 0, dst = 0; dst < DIM(m_LayersColors); ++dst ) for( unsigned src = 0, dst = 0; dst < DIM( m_LayersColors ); ++dst )
{ {
m_LayersColors[dst] = COLOR4D( default_layer_color[src++] ); m_LayersColors[dst] = COLOR4D( default_layer_color[src++] );
@ -96,19 +96,16 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
src = 0; // wrap the source. src = 0; // wrap the source.
} }
for( unsigned src = 0, dst = 0; dst < DIM(m_ItemsColors); ++dst ) for( unsigned src = 0, dst = LAYER_VIAS; dst < DIM( default_items_color ); ++dst )
{ {
m_ItemsColors[dst] = COLOR4D( default_items_color[src++] ); m_LayersColors[dst] = COLOR4D( default_items_color[src++] );
if( src >= DIM( default_items_color ) )
src = 0;
} }
} }
COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
{ {
if( (unsigned) aLayer < DIM(m_LayersColors) ) if( (unsigned) aLayer < DIM( m_LayersColors ) )
{ {
return m_LayersColors[aLayer]; return m_LayersColors[aLayer];
} }
@ -118,7 +115,7 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor ) void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
{ {
if( (unsigned) aLayer < DIM(m_LayersColors) ) if( (unsigned) aLayer < DIM( m_LayersColors ) )
{ {
m_LayersColors[aLayer] = aColor; m_LayersColors[aLayer] = aColor;
} }
@ -127,9 +124,9 @@ void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
{ {
if( (unsigned) aItemIdx < DIM( m_ItemsColors ) ) if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
{ {
return m_ItemsColors[aItemIdx]; return m_LayersColors[aItemIdx];
} }
return COLOR4D::UNSPECIFIED; return COLOR4D::UNSPECIFIED;
@ -138,9 +135,9 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor ) void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor )
{ {
if( (unsigned) aItemIdx < DIM(m_ItemsColors) ) if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
{ {
m_ItemsColors[aItemIdx] = aColor; m_LayersColors[aItemIdx] = aColor;
} }
} }
@ -149,7 +146,4 @@ void COLORS_DESIGN_SETTINGS::SetAllColorsAs( COLOR4D aColor )
{ {
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ ) for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = aColor; m_LayersColors[ii] = aColor;
for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ )
m_ItemsColors[ii] = aColor;
} }

View File

@ -175,7 +175,7 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_gal->BeginDrawing(); m_gal->BeginDrawing();
m_gal->ClearScreen( settings->GetBackgroundColor() ); m_gal->ClearScreen( settings->GetBackgroundColor() );
KIGFX::COLOR4D gridColor = settings->GetLayerColor( ITEM_GAL_LAYER( GRID_VISIBLE ) ); KIGFX::COLOR4D gridColor = settings->GetLayerColor( LAYER_GRID );
m_gal->SetGridColor( gridColor ); m_gal->SetGridColor( gridColor );
if( m_view->IsDirty() ) if( m_view->IsDirty() )

View File

@ -30,7 +30,7 @@
#include <class_board.h> #include <class_board.h>
LSET::LSET( const LAYER_ID* aArray, unsigned aCount ) : LSET::LSET( const PCB_LAYER_ID* aArray, unsigned aCount ) :
BASE_SET() BASE_SET()
{ {
for( unsigned i=0; i<aCount; ++i ) for( unsigned i=0; i<aCount; ++i )
@ -42,7 +42,7 @@ LSET::LSET( unsigned aIdCount, int aFirst, ... ) :
BASE_SET() BASE_SET()
{ {
// The constructor, without the mandatory aFirst argument, could have been confused // The constructor, without the mandatory aFirst argument, could have been confused
// by the compiler with the LSET( LAYER_ID ). With aFirst, that ambiguity is not // by the compiler with the LSET( PCB_LAYER_ID ). With aFirst, that ambiguity is not
// present. Therefore aIdCount must always be >=1. // present. Therefore aIdCount must always be >=1.
wxASSERT_MSG( aIdCount > 0, wxT( "aIdCount must be >= 1" ) ); wxASSERT_MSG( aIdCount > 0, wxT( "aIdCount must be >= 1" ) );
@ -56,11 +56,11 @@ LSET::LSET( unsigned aIdCount, int aFirst, ... ) :
for( unsigned i=0; i<aIdCount; ++i ) for( unsigned i=0; i<aIdCount; ++i )
{ {
LAYER_ID id = (LAYER_ID) va_arg( ap, int ); PCB_LAYER_ID id = (PCB_LAYER_ID) va_arg( ap, int );
// printf( "%s: id:%d LAYER_ID_COUNT:%d\n", __func__, id, LAYER_ID_COUNT ); // printf( "%s: id:%d PCB_LAYER_ID_COUNT:%d\n", __func__, id, PCB_LAYER_ID_COUNT );
assert( unsigned( id ) < LAYER_ID_COUNT ); assert( unsigned( id ) < PCB_LAYER_ID_COUNT );
set( id ); set( id );
} }
@ -70,7 +70,7 @@ LSET::LSET( unsigned aIdCount, int aFirst, ... ) :
} }
const wxChar* LSET::Name( LAYER_ID aLayerId ) const wxChar* LSET::Name( PCB_LAYER_ID aLayerId )
{ {
const wxChar* txt; const wxChar* txt;
@ -135,6 +135,7 @@ const wxChar* LSET::Name( LAYER_ID aLayerId )
case B_Fab: txt = wxT( "B.Fab" ); break; case B_Fab: txt = wxT( "B.Fab" ); break;
default: default:
std::cout << aLayerId << std::endl;
wxASSERT_MSG( 0, wxT( "aLayerId out of range" ) ); wxASSERT_MSG( 0, wxT( "aLayerId out of range" ) );
txt = wxT( "BAD INDEX!" ); break; txt = wxT( "BAD INDEX!" ); break;
} }
@ -146,7 +147,7 @@ const wxChar* LSET::Name( LAYER_ID aLayerId )
LSEQ LSET::CuStack() const LSEQ LSET::CuStack() const
{ {
// desired sequence // desired sequence
static const LAYER_ID sequence[] = { static const PCB_LAYER_ID sequence[] = {
F_Cu, F_Cu,
In1_Cu, In1_Cu,
In2_Cu, In2_Cu,
@ -188,7 +189,7 @@ LSEQ LSET::CuStack() const
LSEQ LSET::Technicals( LSET aSetToOmit ) const LSEQ LSET::Technicals( LSET aSetToOmit ) const
{ {
// desired sequence // desired sequence
static const LAYER_ID sequence[] = { static const PCB_LAYER_ID sequence[] = {
B_Adhes, B_Adhes,
F_Adhes, F_Adhes,
B_Paste, B_Paste,
@ -212,7 +213,7 @@ LSEQ LSET::Technicals( LSET aSetToOmit ) const
LSEQ LSET::Users() const LSEQ LSET::Users() const
{ {
// desired // desired
static const LAYER_ID sequence[] = { static const PCB_LAYER_ID sequence[] = {
Dwgs_User, Dwgs_User,
Cmts_User, Cmts_User,
Eco1_User, Eco1_User,
@ -333,7 +334,7 @@ int LSET::ParseHex( const char* aStart, int aCount )
} }
LSEQ LSET::Seq( const LAYER_ID* aWishListSequence, unsigned aCount ) const LSEQ LSET::Seq( const PCB_LAYER_ID* aWishListSequence, unsigned aCount ) const
{ {
LSEQ ret; LSEQ ret;
@ -342,7 +343,7 @@ LSEQ LSET::Seq( const LAYER_ID* aWishListSequence, unsigned aCount ) const
for( unsigned i=0; i<aCount; ++i ) for( unsigned i=0; i<aCount; ++i )
{ {
LAYER_ID id = aWishListSequence[i]; PCB_LAYER_ID id = aWishListSequence[i];
if( test( id ) ) if( test( id ) )
{ {
@ -356,7 +357,7 @@ LSEQ LSET::Seq( const LAYER_ID* aWishListSequence, unsigned aCount ) const
for( unsigned i=0; i<aCount; ++i ) for( unsigned i=0; i<aCount; ++i )
{ {
LAYER_ID id = aWishListSequence[i]; PCB_LAYER_ID id = aWishListSequence[i];
if( test( id ) ) if( test( id ) )
ret.push_back( id ); ret.push_back( id );
@ -374,7 +375,7 @@ LSEQ LSET::Seq() const
for( unsigned i=0; i<size(); ++i ) for( unsigned i=0; i<size(); ++i )
{ {
if( test(i) ) if( test(i) )
ret.push_back( LAYER_ID( i ) ); ret.push_back( PCB_LAYER_ID( i ) );
} }
return ret; return ret;
@ -384,7 +385,7 @@ LSEQ LSET::Seq() const
LSEQ LSET::SeqStackupBottom2Top() const LSEQ LSET::SeqStackupBottom2Top() const
{ {
// bottom-to-top stack-up layers // bottom-to-top stack-up layers
static const LAYER_ID sequence[] = { static const PCB_LAYER_ID sequence[] = {
B_Fab, B_Fab,
B_CrtYd, B_CrtYd,
B_Adhes, B_Adhes,
@ -441,7 +442,7 @@ LSEQ LSET::SeqStackupBottom2Top() const
} }
LAYER_ID FlipLayer( LAYER_ID aLayerId, int aCopperLayersCount ) PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayerId, int aCopperLayersCount )
{ {
switch( aLayerId ) switch( aLayerId )
{ {
@ -470,7 +471,7 @@ LAYER_ID FlipLayer( LAYER_ID aLayerId, int aCopperLayersCount )
if( IsCopperLayer( aLayerId ) && aCopperLayersCount >= 4 ) if( IsCopperLayer( aLayerId ) && aCopperLayersCount >= 4 )
{ {
// internal copper layers count is aCopperLayersCount-2 // internal copper layers count is aCopperLayersCount-2
LAYER_ID fliplayer = LAYER_ID(aCopperLayersCount - 2 - ( aLayerId - In1_Cu ) ); PCB_LAYER_ID fliplayer = PCB_LAYER_ID(aCopperLayersCount - 2 - ( aLayerId - In1_Cu ) );
// Ensure fliplayer has a value which does not crash pcbnew: // Ensure fliplayer has a value which does not crash pcbnew:
if( fliplayer < F_Cu ) if( fliplayer < F_Cu )
fliplayer = F_Cu; fliplayer = F_Cu;
@ -574,7 +575,7 @@ LSET FlipLayerMask( LSET aMask, int aCopperLayersCount )
} }
LAYER_ID LSET::ExtractLayer() const PCB_LAYER_ID LSET::ExtractLayer() const
{ {
unsigned set_count = count(); unsigned set_count = count();
@ -586,7 +587,7 @@ LAYER_ID LSET::ExtractLayer() const
for( unsigned i=0; i < size(); ++i ) for( unsigned i=0; i < size(); ++i )
{ {
if( test( i ) ) if( test( i ) )
return LAYER_ID( i ); return PCB_LAYER_ID( i );
} }
wxASSERT( 0 ); // set_count was verified as 1 above, what did you break? wxASSERT( 0 ); // set_count was verified as 1 above, what did you break?
@ -597,7 +598,7 @@ LAYER_ID LSET::ExtractLayer() const
LSET LSET::InternalCuMask() LSET LSET::InternalCuMask()
{ {
static const LAYER_ID cu_internals[] = { static const PCB_LAYER_ID cu_internals[] = {
In1_Cu, In1_Cu,
In2_Cu, In2_Cu,
In3_Cu, In3_Cu,
@ -750,22 +751,22 @@ LSET LSET::BackMask()
LSEQ LSET::UIOrder() const LSEQ LSET::UIOrder() const
{ {
LAYER_ID order[LAYER_ID_COUNT]; PCB_LAYER_ID order[PCB_LAYER_ID_COUNT];
// Assmuming that the LAYER_ID order is according to preferred UI order, as of // Assmuming that the PCB_LAYER_ID order is according to preferred UI order, as of
// today this is true. When that becomes not true, its easy to change the order // today this is true. When that becomes not true, its easy to change the order
// in here to compensate. // in here to compensate.
for( unsigned i=0; i<DIM(order); ++i ) for( unsigned i=0; i<DIM(order); ++i )
order[i] = LAYER_ID( i ); order[i] = PCB_LAYER_ID( i );
return Seq( order, DIM( order ) ); return Seq( order, DIM( order ) );
} }
LAYER_ID ToLAYER_ID( int aLayer ) PCB_LAYER_ID ToLAYER_ID( int aLayer )
{ {
wxASSERT( unsigned( aLayer ) < LAYER_ID_COUNT ); wxASSERT( unsigned( aLayer ) < PCB_LAYER_ID_COUNT );
return LAYER_ID( aLayer ); return PCB_LAYER_ID( aLayer );
} }

View File

@ -55,7 +55,7 @@ void RENDER_SETTINGS::update()
m_layerOpacity ); m_layerOpacity );
// Calculate darkened/highlighted variants of layer colors // Calculate darkened/highlighted variants of layer colors
for( int i = 0; i < TOTAL_LAYER_COUNT; i++ ) for( int i = 0; i < LAYER_ID_COUNT; i++ )
{ {
m_layerColorsHi[i] = m_layerColors[i].Brightened( m_highlightFactor ); m_layerColorsHi[i] = m_layerColors[i].Brightened( m_highlightFactor );
m_layerColorsDark[i] = m_layerColors[i].Darkened( 1.0 - m_highlightFactor ); m_layerColorsDark[i] = m_layerColors[i].Darkened( 1.0 - m_highlightFactor );

View File

@ -222,7 +222,7 @@ const BOX2I RULER_ITEM::ViewBBox() const
void RULER_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const void RULER_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY ); aLayers[0] = LAYER_GP_OVERLAY;
aCount = 1; aCount = 1;
} }

View File

@ -25,7 +25,6 @@
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <view/view.h> #include <view/view.h>
#include <layers_id_colors_and_visibility.h>
using namespace KIGFX::PREVIEW; using namespace KIGFX::PREVIEW;
@ -51,7 +50,7 @@ void SIMPLE_OVERLAY_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
void SIMPLE_OVERLAY_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const void SIMPLE_OVERLAY_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
static const int SelectionLayer = ITEM_GAL_LAYER( GP_OVERLAY ); static const int SelectionLayer = LAYER_GP_OVERLAY;
aLayers[0] = SelectionLayer; aLayers[0] = SelectionLayer;
aCount = 1; aCount = 1;

View File

@ -117,10 +117,10 @@ principle should be easily implemented by adapting the current STL containers.
%template(intVector) std::vector<int>; %template(intVector) std::vector<int>;
%template(str_utf8_Map) std::map< std::string,UTF8 >; %template(str_utf8_Map) std::map< std::string,UTF8 >;
// wrapper of BASE_SEQ (see typedef std::vector<LAYER_ID> BASE_SEQ;) // wrapper of BASE_SEQ (see typedef std::vector<PCB_LAYER_ID> BASE_SEQ;)
%template(base_seqVect) std::vector<enum LAYER_ID>; %template(base_seqVect) std::vector<enum PCB_LAYER_ID>;
// TODO: wrapper of BASE_SET (see std::bitset<LAYER_ID_COUNT> BASE_SET;) // TODO: wrapper of BASE_SET (see std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;)
// KiCad plugin handling // KiCad plugin handling

View File

@ -41,7 +41,7 @@
using namespace KIGFX; using namespace KIGFX;
VIEW_GROUP::VIEW_GROUP( VIEW* aView ) : VIEW_GROUP::VIEW_GROUP( VIEW* aView ) :
m_layer( ITEM_GAL_LAYER( GP_OVERLAY ) ) m_layer( LAYER_GP_OVERLAY )
{ {
} }

View File

@ -131,7 +131,7 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
void WORKSHEET_VIEWITEM::ViewGetLayers( int aLayers[], int& aCount ) const void WORKSHEET_VIEWITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aCount = 1; aCount = 1;
aLayers[0] = ITEM_GAL_LAYER( WORKSHEET ); aLayers[0] = LAYER_WORKSHEET;
} }

View File

@ -161,18 +161,20 @@ PGM_BASE& Pgm()
} }
static COLOR4D s_layerColor[LAYERSCH_ID_COUNT]; static COLOR4D s_layerColor[SCH_LAYER_ID_COUNT];
COLOR4D GetLayerColor( LAYERSCH_ID aLayer ) COLOR4D GetLayerColor( SCH_LAYER_ID aLayer )
{ {
wxASSERT( unsigned( aLayer ) < DIM( s_layerColor ) ); unsigned layer = SCH_LAYER_INDEX( aLayer );
return s_layerColor[aLayer]; wxASSERT( layer < DIM( s_layerColor ) );
return s_layerColor[layer];
} }
void SetLayerColor( COLOR4D aColor, LAYERSCH_ID aLayer ) void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer )
{ {
wxASSERT( unsigned( aLayer ) < DIM( s_layerColor ) ); unsigned layer = SCH_LAYER_INDEX( aLayer );
s_layerColor[aLayer] = aColor; wxASSERT( layer < DIM( s_layerColor ) );
s_layerColor[layer] = aColor;
} }
@ -186,34 +188,35 @@ static PARAM_CFG_ARRAY& cfg_params()
// eeschema KIFACE comes in. // eeschema KIFACE comes in.
#define CLR(x, y, z)\ #define CLR(x, y, z)\
ca.push_back( new PARAM_CFG_SETCOLOR( true, wxT( x ), &s_layerColor[y], z ) ); ca.push_back( new PARAM_CFG_SETCOLOR( true, wxT( x ),\
&s_layerColor[SCH_LAYER_INDEX( y )], z ) );
CLR( "ColorWireEx", LAYER_WIRE, COLOR4D( GREEN ) ) CLR( "ColorWireEx", LAYER_WIRE, COLOR4D( GREEN ) )
CLR( "ColorBusEx", LAYER_BUS, COLOR4D( BLUE ) ) CLR( "ColorBusEx", LAYER_BUS, COLOR4D( BLUE ) )
CLR( "ColorConnEx", LAYER_JUNCTION, COLOR4D( GREEN ) ) CLR( "ColorConnEx", LAYER_JUNCTION, COLOR4D( GREEN ) )
CLR( "ColorLLabelEx", LAYER_LOCLABEL, COLOR4D( BLACK ) ) CLR( "ColorLLabelEx", LAYER_LOCLABEL, COLOR4D( BLACK ) )
CLR( "ColorHLabelEx", LAYER_HIERLABEL, COLOR4D( BROWN ) ) CLR( "ColorHLabelEx", LAYER_HIERLABEL, COLOR4D( BROWN ) )
CLR( "ColorGLabelEx", LAYER_GLOBLABEL, COLOR4D( RED ) ) CLR( "ColorGLabelEx", LAYER_GLOBLABEL, COLOR4D( RED ) )
CLR( "ColorPinNumEx", LAYER_PINNUM, COLOR4D( RED ) ) CLR( "ColorPinNumEx", LAYER_PINNUM, COLOR4D( RED ) )
CLR( "ColorPinNameEx", LAYER_PINNAM, COLOR4D( CYAN ) ) CLR( "ColorPinNameEx", LAYER_PINNAM, COLOR4D( CYAN ) )
CLR( "ColorFieldEx", LAYER_FIELDS, COLOR4D( MAGENTA ) ) CLR( "ColorFieldEx", LAYER_FIELDS, COLOR4D( MAGENTA ) )
CLR( "ColorReferenceEx", LAYER_REFERENCEPART, COLOR4D( CYAN ) ) CLR( "ColorReferenceEx", LAYER_REFERENCEPART, COLOR4D( CYAN ) )
CLR( "ColorValueEx", LAYER_VALUEPART, COLOR4D( CYAN ) ) CLR( "ColorValueEx", LAYER_VALUEPART, COLOR4D( CYAN ) )
CLR( "ColorNoteEx", LAYER_NOTES, COLOR4D( LIGHTBLUE ) ) CLR( "ColorNoteEx", LAYER_NOTES, COLOR4D( LIGHTBLUE ) )
CLR( "ColorBodyEx", LAYER_DEVICE, COLOR4D( RED ) ) CLR( "ColorBodyEx", LAYER_DEVICE, COLOR4D( RED ) )
CLR( "ColorBodyBgEx", LAYER_DEVICE_BACKGROUND, COLOR4D( LIGHTYELLOW ) ) CLR( "ColorBodyBgEx", LAYER_DEVICE_BACKGROUND, COLOR4D( LIGHTYELLOW ) )
CLR( "ColorNetNameEx", LAYER_NETNAM, COLOR4D( DARKGRAY ) ) CLR( "ColorNetNameEx", LAYER_NETNAM, COLOR4D( DARKGRAY ) )
CLR( "ColorPinEx", LAYER_PIN, COLOR4D( RED ) ) CLR( "ColorPinEx", LAYER_PIN, COLOR4D( RED ) )
CLR( "ColorSheetEx", LAYER_SHEET, COLOR4D( MAGENTA ) ) CLR( "ColorSheetEx", LAYER_SHEET, COLOR4D( MAGENTA ) )
CLR( "ColorSheetFileNameEx", LAYER_SHEETFILENAME, COLOR4D( BROWN ) ) CLR( "ColorSheetFileNameEx", LAYER_SHEETFILENAME, COLOR4D( BROWN ) )
CLR( "ColorSheetNameEx", LAYER_SHEETNAME, COLOR4D( CYAN ) ) CLR( "ColorSheetNameEx", LAYER_SHEETNAME, COLOR4D( CYAN ) )
CLR( "ColorSheetLabelEx", LAYER_SHEETLABEL, COLOR4D( BROWN ) ) CLR( "ColorSheetLabelEx", LAYER_SHEETLABEL, COLOR4D( BROWN ) )
CLR( "ColorNoConnectEx", LAYER_NOCONNECT, COLOR4D( BLUE ) ) CLR( "ColorNoConnectEx", LAYER_NOCONNECT, COLOR4D( BLUE ) )
CLR( "ColorErcWEx", LAYER_ERC_WARN, COLOR4D( GREEN ) ) CLR( "ColorErcWEx", LAYER_ERC_WARN, COLOR4D( GREEN ) )
CLR( "ColorErcEEx", LAYER_ERC_ERR, COLOR4D( RED ) ) CLR( "ColorErcEEx", LAYER_ERC_ERR, COLOR4D( RED ) )
CLR( "ColorGridEx", LAYER_GRID, COLOR4D( DARKGRAY ) ) CLR( "ColorGridEx", LAYER_SCHEMATIC_GRID, COLOR4D( DARKGRAY ) )
CLR( "ColorBgCanvasEx", LAYER_BACKGROUND, COLOR4D( WHITE ) ) CLR( "ColorBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND, COLOR4D( WHITE ) )
CLR( "ColorBrighenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) ) CLR( "ColorBrighenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) )
} }
return ca; return ca;
@ -230,10 +233,10 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// Give a default colour for all layers // Give a default colour for all layers
// (actual color will be initialized by config) // (actual color will be initialized by config)
for( LAYERSCH_ID ii = LAYER_FIRST; ii < LAYERSCH_ID_COUNT; ++ii ) for( SCH_LAYER_ID ii = SCH_LAYER_ID_START; ii < SCH_LAYER_ID_END; ++ii )
SetLayerColor( COLOR4D( DARKGRAY ), ii ); SetLayerColor( COLOR4D( DARKGRAY ), ii );
SetLayerColor( COLOR4D::WHITE, LAYER_BACKGROUND ); SetLayerColor( COLOR4D::WHITE, LAYER_SCHEMATIC_BACKGROUND );
// Must be called before creating the main frame in order to // Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips // display the real hotkeys in menus or tool tips

View File

@ -595,8 +595,8 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
SetGridColor( GetLayerColor( LAYER_GRID ) ); SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) ); SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
SetDefaultBusThickness( aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) ); SetDefaultBusThickness( aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) );
SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) ); SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
@ -759,8 +759,8 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
{ {
EDA_DRAW_FRAME::LoadSettings( aCfg ); EDA_DRAW_FRAME::LoadSettings( aCfg );
SetGridColor( GetLayerColor( LAYER_GRID ) ); SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) ); SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) ); SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SetDefaultPinLength( aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) ); SetDefaultPinLength( aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );

View File

@ -30,6 +30,7 @@
#define _GENERAL_H_ #define _GENERAL_H_
#include <gal/color4d.h> #include <gal/color4d.h>
#include <layers_id_colors_and_visibility.h>
using KIGFX::COLOR4D; using KIGFX::COLOR4D;
@ -68,48 +69,6 @@ class SCH_SHEET;
#define GR_DEFAULT_DRAWMODE GR_COPY #define GR_DEFAULT_DRAWMODE GR_COPY
// this enum is for color management
// Using here "LAYER" in name is due to historical reasons.
// Eeschema does not actually use layers. It just uses "LAYER_XX" as identifier
// mainly for item color
typedef enum {
LAYER_FIRST,
LAYER_WIRE = LAYER_FIRST,
LAYER_BUS,
LAYER_JUNCTION,
LAYER_LOCLABEL,
LAYER_GLOBLABEL,
LAYER_HIERLABEL,
LAYER_PINNUM,
LAYER_PINNAM,
LAYER_REFERENCEPART,
LAYER_VALUEPART,
LAYER_FIELDS,
LAYER_DEVICE,
LAYER_NOTES,
LAYER_NETNAM,
LAYER_PIN,
LAYER_SHEET,
LAYER_SHEETNAME,
LAYER_SHEETFILENAME,
LAYER_SHEETLABEL,
LAYER_NOCONNECT,
LAYER_ERC_WARN,
LAYER_ERC_ERR,
LAYER_DEVICE_BACKGROUND,
LAYER_GRID,
LAYER_BACKGROUND,
LAYER_BRIGHTENED,
LAYERSCH_ID_COUNT
} LAYERSCH_ID;
inline LAYERSCH_ID operator++( LAYERSCH_ID& a )
{
a = LAYERSCH_ID( int( a ) + 1 );
return a;
}
/* Rotation, mirror of graphic items in components bodies are handled by a /* Rotation, mirror of graphic items in components bodies are handled by a
* transform matrix. The default matrix is useful to draw lib entries with * transform matrix. The default matrix is useful to draw lib entries with
* using this default matrix ( no rotation, no mirror but Y axis is bottom to top, and * using this default matrix ( no rotation, no mirror but Y axis is bottom to top, and
@ -140,8 +99,8 @@ void SetDefaultTextSize( int aSize );
int GetDefaultBusThickness(); int GetDefaultBusThickness();
void SetDefaultBusThickness( int aThickness ); void SetDefaultBusThickness( int aThickness );
COLOR4D GetLayerColor( LAYERSCH_ID aLayer ); COLOR4D GetLayerColor( SCH_LAYER_ID aLayer );
void SetLayerColor( COLOR4D aColor, LAYERSCH_ID aLayer ); void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer );
// Color to draw selected items // Color to draw selected items
COLOR4D GetItemSelectedColor(); COLOR4D GetItemSelectedColor();

View File

@ -65,13 +65,13 @@ void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
// Virtual from EDA_DRAW_FRAME // Virtual from EDA_DRAW_FRAME
COLOR4D SCH_BASE_FRAME::GetDrawBgColor() const COLOR4D SCH_BASE_FRAME::GetDrawBgColor() const
{ {
return GetLayerColor( LAYER_BACKGROUND ); return GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
} }
void SCH_BASE_FRAME::SetDrawBgColor( COLOR4D aColor) void SCH_BASE_FRAME::SetDrawBgColor( COLOR4D aColor)
{ {
m_drawBgColor= aColor; m_drawBgColor= aColor;
SetLayerColor( aColor, LAYER_BACKGROUND ); SetLayerColor( aColor, LAYER_SCHEMATIC_BACKGROUND );
} }

View File

@ -116,7 +116,7 @@ public:
class SCH_ITEM : public EDA_ITEM class SCH_ITEM : public EDA_ITEM
{ {
protected: protected:
LAYERSCH_ID m_Layer; SCH_LAYER_ID m_Layer;
EDA_ITEMS m_connections; ///< List of items connected to this item. EDA_ITEMS m_connections; ///< List of items connected to this item.
wxPoint m_storedPos; ///< a temporary variable used in some move commands wxPoint m_storedPos; ///< a temporary variable used in some move commands
///> to store a initial pos (of the item or mouse cursor) ///> to store a initial pos (of the item or mouse cursor)
@ -161,14 +161,14 @@ public:
* Function GetLayer * Function GetLayer
* returns the layer this item is on. * returns the layer this item is on.
*/ */
LAYERSCH_ID GetLayer() const { return m_Layer; } SCH_LAYER_ID GetLayer() const { return m_Layer; }
/** /**
* Function SetLayer * Function SetLayer
* sets the layer this item is on. * sets the layer this item is on.
* @param aLayer The layer number. * @param aLayer The layer number.
*/ */
void SetLayer( LAYERSCH_ID aLayer ) { m_Layer = aLayer; } void SetLayer( SCH_LAYER_ID aLayer ) { m_Layer = aLayer; }
/** /**
* Function GetPenSize virtual pure * Function GetPenSize virtual pure

View File

@ -1591,7 +1591,7 @@ void SCH_LEGACY_PLUGIN::Format( SCH_SCREEN* aScreen )
m_out->Print( 0, "LIBS:%s\n", TO_UTF8( lib.GetName() ) ); m_out->Print( 0, "LIBS:%s\n", TO_UTF8( lib.GetName() ) );
// This section is not used, but written for file compatibility // This section is not used, but written for file compatibility
m_out->Print( 0, "EELAYER %d %d\n", LAYERSCH_ID_COUNT, 0 ); m_out->Print( 0, "EELAYER %d %d\n", SCH_LAYER_ID_COUNT, 0 );
m_out->Print( 0, "EELAYER END\n" ); m_out->Print( 0, "EELAYER END\n" );
/* Write page info, ScreenNumber and NumberOfScreen; not very meaningful for /* Write page info, ScreenNumber and NumberOfScreen; not very meaningful for
@ -1972,7 +1972,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
wxString text = aText->GetText(); wxString text = aText->GetText();
LAYERSCH_ID layer = aText->GetLayer(); SCH_LAYER_ID layer = aText->GetLayer();
if( layer == LAYER_NOTES || layer == LAYER_LOCLABEL ) if( layer == LAYER_NOTES || layer == LAYER_LOCLABEL )
{ {

View File

@ -486,7 +486,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
} }
// This section is not used, but written for file compatibility // This section is not used, but written for file compatibility
if( fprintf( aFile, "EELAYER %d %d\n", LAYERSCH_ID_COUNT, 0 ) < 0 if( fprintf( aFile, "EELAYER %d %d\n", SCH_LAYER_ID_COUNT, 0 ) < 0
|| fprintf( aFile, "EELAYER END\n" ) < 0 ) || fprintf( aFile, "EELAYER END\n" ) < 0 )
return false; return false;

View File

@ -629,8 +629,8 @@ void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
{ {
EDA_DRAW_FRAME::LoadSettings( aCfg ); EDA_DRAW_FRAME::LoadSettings( aCfg );
SetGridColor( GetLayerColor( LAYER_GRID ) ); SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) ); SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 ); aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 ); aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );

View File

@ -90,7 +90,7 @@ static COLORBUTTON sheetColorButtons[] = {
static COLORBUTTON miscColorButtons[] = { static COLORBUTTON miscColorButtons[] = {
{ _( "ERC warning" ), LAYER_ERC_WARN }, { _( "ERC warning" ), LAYER_ERC_WARN },
{ _( "ERC error" ), LAYER_ERC_ERR }, { _( "ERC error" ), LAYER_ERC_ERR },
{ _( "Grid" ), LAYER_GRID }, { _( "Grid" ), LAYER_SCHEMATIC_GRID },
{ _( "Brightened" ), LAYER_BRIGHTENED }, { _( "Brightened" ), LAYER_BRIGHTENED },
{ wxT( "" ), -1 } // Sentinel marking end of list. { wxT( "" ), -1 } // Sentinel marking end of list.
}; };
@ -104,9 +104,9 @@ static BUTTONINDEX buttonGroups[] = {
{ wxT( "" ), NULL } { wxT( "" ), NULL }
}; };
static COLORBUTTON bgColorButton = { "", LAYER_BACKGROUND }; static COLORBUTTON bgColorButton = { "", LAYER_SCHEMATIC_BACKGROUND };
static COLOR4D currentColors[ LAYERSCH_ID_COUNT ]; static COLOR4D currentColors[ SCH_LAYER_ID_COUNT ];
WIDGET_EESCHEMA_COLOR_CONFIG::WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) : WIDGET_EESCHEMA_COLOR_CONFIG::WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) :
@ -151,8 +151,8 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
rowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); rowBoxSizer = new wxBoxSizer( wxHORIZONTAL );
columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxALL, 0 ); columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxALL, 0 );
COLOR4D color = GetLayerColor( LAYERSCH_ID( buttons->m_Layer ) ); COLOR4D color = GetLayerColor( SCH_LAYER_ID( buttons->m_Layer ) );
currentColors[ buttons->m_Layer ] = color; currentColors[ SCH_LAYER_INDEX( buttons->m_Layer ) ] = color;
wxMemoryDC iconDC; wxMemoryDC iconDC;
wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
@ -217,7 +217,7 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
columnBoxSizer->Add( selBgColorBtn, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); columnBoxSizer->Add( selBgColorBtn, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
} }
currentColors[ LAYER_BACKGROUND ] = bgColor; currentColors[ SCH_LAYER_INDEX( LAYER_SCHEMATIC_BACKGROUND ) ] = bgColor;
// Dialog now needs to be resized, but the associated command is found elsewhere. // Dialog now needs to be resized, but the associated command is found elsewhere.
} }
@ -234,7 +234,7 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::SetColor( wxCommandEvent& event )
wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) ); wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) );
wxColourData colourData; wxColourData colourData;
colourData.SetColour( currentColors[ colorButton->m_Layer ].ToColour() ); colourData.SetColour( currentColors[ SCH_LAYER_INDEX( colorButton->m_Layer ) ].ToColour() );
wxColourDialog *dialog = new wxColourDialog( this, &colourData ); wxColourDialog *dialog = new wxColourDialog( this, &colourData );
COLOR4D newColor = COLOR4D::UNSPECIFIED; COLOR4D newColor = COLOR4D::UNSPECIFIED;
@ -244,10 +244,11 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::SetColor( wxCommandEvent& event )
newColor = COLOR4D( dialog->GetColourData().GetColour() ); newColor = COLOR4D( dialog->GetColourData().GetColour() );
} }
if( newColor == COLOR4D::UNSPECIFIED || currentColors[ colorButton->m_Layer ] == newColor ) if( newColor == COLOR4D::UNSPECIFIED ||
currentColors[ SCH_LAYER_INDEX( colorButton->m_Layer ) ] == newColor )
return; return;
currentColors[ colorButton->m_Layer ] = newColor; currentColors[ SCH_LAYER_INDEX( colorButton->m_Layer ) ] = newColor;
wxMemoryDC iconDC; wxMemoryDC iconDC;
@ -275,11 +276,11 @@ bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl()
// Check for color conflicts with background color to give user a chance to bail // Check for color conflicts with background color to give user a chance to bail
// out before making changes. // out before making changes.
COLOR4D bgcolor = currentColors[LAYER_BACKGROUND]; COLOR4D bgcolor = currentColors[ SCH_LAYER_INDEX( LAYER_SCHEMATIC_BACKGROUND ) ];
for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr ) for( SCH_LAYER_ID clyr = LAYER_WIRE; clyr < SCH_LAYER_ID_END; ++clyr )
{ {
if( bgcolor == currentColors[ clyr ] && clyr != LAYER_BACKGROUND ) if( bgcolor == currentColors[ SCH_LAYER_INDEX( clyr ) ] && clyr != LAYER_SCHEMATIC_BACKGROUND )
{ {
warning = true; warning = true;
break; break;
@ -300,15 +301,15 @@ bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl()
// Update color of background // Update color of background
GetDrawFrame()->SetDrawBgColor( bgcolor ); GetDrawFrame()->SetDrawBgColor( bgcolor );
currentColors[ LAYER_BACKGROUND ] = bgcolor; currentColors[ SCH_LAYER_INDEX( LAYER_SCHEMATIC_BACKGROUND ) ] = bgcolor;
for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr ) for( SCH_LAYER_ID clyr = LAYER_WIRE; clyr < SCH_LAYER_ID_END; ++clyr )
{ {
SetLayerColor( currentColors[ clyr ], clyr ); SetLayerColor( currentColors[ SCH_LAYER_INDEX( clyr ) ], clyr );
} }
GetDrawFrame()->SetGridColor( GetLayerColor( LAYER_GRID ) ); GetDrawFrame()->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
GetDrawFrame()->GetCanvas()->Refresh(); GetDrawFrame()->GetCanvas()->Refresh();
return true; return true;

View File

@ -105,10 +105,10 @@ void GERBER_LAYER_WIDGET::ReFillRender()
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width #define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
// text id color tooltip checked // text id color tooltip checked
RR( _( "Grid" ), GERBER_GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ), RR( _( "Grid" ), LAYER_GERBVIEW_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "DCodes" ), DCODES_VISIBLE, WHITE, _( "Show DCodes identification" ) ), RR( _( "DCodes" ), LAYER_DCODES, WHITE, _( "Show DCodes identification" ) ),
RR( _( "Neg. Obj." ), NEGATIVE_OBJECTS_VISIBLE, DARKGRAY, RR( _( "Neg. Obj." ), LAYER_NEGATIVE_OBJECTS, DARKGRAY,
_( "Show negative objects in this color" ) ), _( "Show negative objects in this color" ) ),
}; };
@ -117,10 +117,10 @@ void GERBER_LAYER_WIDGET::ReFillRender()
if( renderRows[row].color != COLOR4D::UNSPECIFIED ) // does this row show a color? if( renderRows[row].color != COLOR4D::UNSPECIFIED ) // does this row show a color?
{ {
renderRows[row].color = myframe->GetVisibleElementColor( renderRows[row].color = myframe->GetVisibleElementColor(
(GERBER_VISIBLE_ID)renderRows[row].id ); ( GERBVIEW_LAYER_ID )renderRows[row].id );
} }
renderRows[row].state = myframe->IsElementVisible( renderRows[row].state = myframe->IsElementVisible(
(GERBER_VISIBLE_ID)renderRows[row].id ); ( GERBVIEW_LAYER_ID )renderRows[row].id );
} }
AppendRenderRows( renderRows, DIM(renderRows) ); AppendRenderRows( renderRows, DIM(renderRows) );
@ -293,13 +293,13 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor ) void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
{ {
myframe->SetVisibleElementColor( (GERBER_VISIBLE_ID)aId, aColor ); myframe->SetVisibleElementColor( (GERBVIEW_LAYER_ID) aId, aColor );
myframe->GetCanvas()->Refresh(); myframe->GetCanvas()->Refresh();
} }
void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{ {
myframe->SetElementVisibility( (GERBER_VISIBLE_ID)aId, isEnabled ); myframe->SetElementVisibility( (GERBVIEW_LAYER_ID) aId, isEnabled );
myframe->GetCanvas()->Refresh(); myframe->GetCanvas()->Refresh();
} }

View File

@ -31,7 +31,7 @@
#include <gerbview_frame.h> #include <gerbview_frame.h>
#include <select_layers_to_pcb.h> #include <select_layers_to_pcb.h>
#define NB_PCB_LAYERS LAYER_ID_COUNT #define NB_PCB_LAYERS PCB_LAYER_ID_COUNT
#define FIRST_COPPER_LAYER 0 #define FIRST_COPPER_LAYER 0
#define LAST_COPPER_LAYER 31 #define LAST_COPPER_LAYER 31
@ -202,7 +202,7 @@ void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event )
} }
// This function is a duplicate of // This function is a duplicate of
// const wxChar* LSET::Name( LAYER_ID aLayerId ) // const wxChar* LSET::Name( PCB_LAYER_ID aLayerId )
// However it avoids a dependency to Pcbnew code. // However it avoids a dependency to Pcbnew code.
const wxString GetPCBDefaultLayerName( int aLayerId ) const wxString GetPCBDefaultLayerName( int aLayerId )
{ {

View File

@ -130,7 +130,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
} }
} }
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) ); m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( LAYER_DCODES ) );
m_OptZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() ); m_OptZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() );
@ -172,7 +172,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
else else
m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = true; m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = true;
m_Parent->SetElementVisibility( DCODES_VISIBLE, m_OptDisplayDCodes->GetValue() ); m_Parent->SetElementVisibility( LAYER_DCODES, m_OptDisplayDCodes->GetValue() );
int idx = m_ShowPageLimits->GetSelection(); int idx = m_ShowPageLimits->GetSelection();

View File

@ -120,7 +120,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( m_DisplayOptions.m_DisplayDCodes ) if( m_DisplayOptions.m_DisplayDCodes )
{ {
COLOR4D dcode_color = GetVisibleElementColor( DCODES_VISIBLE ); COLOR4D dcode_color = GetVisibleElementColor( LAYER_DCODES );
GetGerberLayout()->DrawItemsDCodeID( m_canvas, DC, GR_COPY, dcode_color ); GetGerberLayout()->DrawItemsDCodeID( m_canvas, DC, GR_COPY, dcode_color );
} }

View File

@ -433,12 +433,12 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_DCODES: case ID_TB_OPTIONS_SHOW_DCODES:
SetElementVisibility( DCODES_VISIBLE, state ); SetElementVisibility( LAYER_DCODES, state );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS: case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS:
SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, state ); SetElementVisibility( LAYER_NEGATIVE_OBJECTS, state );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
break; break;

View File

@ -456,7 +456,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader( LAYER_NUM* aLayerLookUpTable )
fprintf( m_fp, " (%d %s signal)\n", id, TO_UTF8( GetPCBDefaultLayerName( id ) ) ); fprintf( m_fp, " (%d %s signal)\n", id, TO_UTF8( GetPCBDefaultLayerName( id ) ) );
} }
for( int ii = B_Adhes; ii < LAYER_ID_COUNT; ii++ ) for( int ii = B_Adhes; ii < PCB_LAYER_ID_COUNT; ii++ )
{ {
fprintf( m_fp, " (%d %s user)\n", ii, TO_UTF8( GetPCBDefaultLayerName( ii ) ) ); fprintf( m_fp, " (%d %s user)\n", ii, TO_UTF8( GetPCBDefaultLayerName( ii ) ) );
} }

View File

@ -41,22 +41,7 @@
/// List of page sizes /// List of page sizes
extern const wxChar* g_GerberPageSizeList[8]; extern const wxChar* g_GerberPageSizeList[8];
// number fo draw layers in Gerbview
#define GERBER_DRAWLAYERS_COUNT 32
/**
* Enum GERBER_VISIBLE_ID
* is a set of visible GERBVIEW elements.
*/
enum GERBER_VISIBLE_ID
{
DCODES_VISIBLE = 1, // visible item id cannot be 0
// because this id is used as wxWidget id
GERBER_GRID_VISIBLE,
NEGATIVE_OBJECTS_VISIBLE, // use the selected color to draw negative objects
// instaed of background color, to make them visible
END_GERBER_VISIBLE_LIST // sentinel
};
// Interpolation type // Interpolation type
enum Gerb_Interpolation enum Gerb_Interpolation

View File

@ -89,13 +89,13 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
&m_displayMode, 2, 0, 2 ) ); &m_displayMode, 2, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
wxT( "DCodeColorEx" ), wxT( "DCodeColorEx" ),
&g_ColorsSettings.m_ItemsColors[ &g_ColorsSettings.m_LayersColors[
DCODES_VISIBLE], LAYER_DCODES],
WHITE ) ); WHITE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
wxT( "NegativeObjectsColorEx" ), wxT( "NegativeObjectsColorEx" ),
&g_ColorsSettings.m_ItemsColors[ &g_ColorsSettings.m_LayersColors[
NEGATIVE_OBJECTS_VISIBLE], LAYER_NEGATIVE_OBJECTS],
DARKGRAY ) ); DARKGRAY ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, m_configSettings.push_back( new PARAM_CFG_BOOL( true,
wxT( "DisplayPolarCoordinates" ), wxT( "DisplayPolarCoordinates" ),

View File

@ -293,9 +293,9 @@ void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
bool tmp; bool tmp;
aCfg->Read( cfgShowDCodes, &tmp, true ); aCfg->Read( cfgShowDCodes, &tmp, true );
SetElementVisibility( DCODES_VISIBLE, tmp ); SetElementVisibility( LAYER_DCODES, tmp );
aCfg->Read( cfgShowNegativeObjects, &tmp, false ); aCfg->Read( cfgShowNegativeObjects, &tmp, false );
SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, tmp ); SetElementVisibility( LAYER_NEGATIVE_OBJECTS, tmp );
// because we have more than one file history, we must read this one // because we have more than one file history, we must read this one
// using a specific path // using a specific path
@ -320,9 +320,9 @@ void GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( cfgShowPageSizeOption, GetPageSettings().GetType() ); aCfg->Write( cfgShowPageSizeOption, GetPageSettings().GetType() );
aCfg->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock ); aCfg->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock );
aCfg->Write( cfgShowDCodes, IsElementVisible( DCODES_VISIBLE ) ); aCfg->Write( cfgShowDCodes, IsElementVisible( LAYER_DCODES ) );
aCfg->Write( cfgShowNegativeObjects, aCfg->Write( cfgShowNegativeObjects,
IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ); IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
// Save the drill file history list. // Save the drill file history list.
// Because we have more than one file history, we must save this one // Because we have more than one file history, we must save this one
@ -362,20 +362,20 @@ void GERBVIEW_FRAME::ReFillLayerWidget()
} }
void GERBVIEW_FRAME::SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible, void GERBVIEW_FRAME::SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible,
bool aNewState ) bool aNewState )
{ {
switch( aItemIdVisible ) switch( aItemIdVisible )
{ {
case DCODES_VISIBLE: case LAYER_DCODES:
m_DisplayOptions.m_DisplayDCodes = aNewState; m_DisplayOptions.m_DisplayDCodes = aNewState;
break; break;
case NEGATIVE_OBJECTS_VISIBLE: case LAYER_NEGATIVE_OBJECTS:
m_DisplayOptions.m_DisplayNegativeObjects = aNewState; m_DisplayOptions.m_DisplayNegativeObjects = aNewState;
break; break;
case GERBER_GRID_VISIBLE: case LAYER_GERBVIEW_GRID:
SetGridVisibility( aNewState ); SetGridVisibility( aNewState );
break; break;
@ -562,19 +562,19 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
} }
bool GERBVIEW_FRAME::IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) const bool GERBVIEW_FRAME::IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) const
{ {
switch( aItemIdVisible ) switch( aItemIdVisible )
{ {
case DCODES_VISIBLE: case LAYER_DCODES:
return m_DisplayOptions.m_DisplayDCodes; return m_DisplayOptions.m_DisplayDCodes;
break; break;
case NEGATIVE_OBJECTS_VISIBLE: case LAYER_NEGATIVE_OBJECTS:
return m_DisplayOptions.m_DisplayNegativeObjects; return m_DisplayOptions.m_DisplayNegativeObjects;
break; break;
case GERBER_GRID_VISIBLE: case LAYER_GERBVIEW_GRID:
return IsGridVisible(); return IsGridVisible();
break; break;
@ -607,18 +607,18 @@ bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
} }
COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible ) const
{ {
COLOR4D color = COLOR4D::UNSPECIFIED; COLOR4D color = COLOR4D::UNSPECIFIED;
switch( aItemIdVisible ) switch( aItemIdVisible )
{ {
case NEGATIVE_OBJECTS_VISIBLE: case LAYER_NEGATIVE_OBJECTS:
case DCODES_VISIBLE: case LAYER_DCODES:
color = m_colorsSettings->GetItemColor( aItemIdVisible ); color = m_colorsSettings->GetItemColor( aItemIdVisible );
break; break;
case GERBER_GRID_VISIBLE: case LAYER_GERBVIEW_GRID:
color = GetGridColor(); color = GetGridColor();
break; break;
@ -634,21 +634,21 @@ COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible
void GERBVIEW_FRAME::SetGridVisibility( bool aVisible ) void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
{ {
EDA_DRAW_FRAME::SetGridVisibility( aVisible ); EDA_DRAW_FRAME::SetGridVisibility( aVisible );
m_LayersManager->SetRenderState( GERBER_GRID_VISIBLE, aVisible ); m_LayersManager->SetRenderState( LAYER_GERBVIEW_GRID, aVisible );
} }
void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible, void GERBVIEW_FRAME::SetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible,
COLOR4D aColor ) COLOR4D aColor )
{ {
switch( aItemIdVisible ) switch( aItemIdVisible )
{ {
case NEGATIVE_OBJECTS_VISIBLE: case LAYER_NEGATIVE_OBJECTS:
case DCODES_VISIBLE: case LAYER_DCODES:
m_colorsSettings->SetItemColor( aItemIdVisible, aColor ); m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
break; break;
case GERBER_GRID_VISIBLE: case LAYER_GERBVIEW_GRID:
SetGridColor( aColor ); SetGridColor( aColor );
m_colorsSettings->SetItemColor( aItemIdVisible, aColor ); m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
break; break;
@ -661,8 +661,8 @@ void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible,
COLOR4D GERBVIEW_FRAME::GetNegativeItemsColor() const COLOR4D GERBVIEW_FRAME::GetNegativeItemsColor() const
{ {
if( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ) if( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) )
return GetVisibleElementColor( NEGATIVE_OBJECTS_VISIBLE ); return GetVisibleElementColor( LAYER_NEGATIVE_OBJECTS );
else else
return GetDrawBgColor(); return GetDrawBgColor();
} }

View File

@ -33,6 +33,7 @@
#include <config_params.h> #include <config_params.h>
#include <draw_frame.h> #include <draw_frame.h>
#include <layers_id_colors_and_visibility.h>
#include <gerbview.h> #include <gerbview.h>
#include <class_gbr_layout.h> #include <class_gbr_layout.h>
@ -285,19 +286,19 @@ public:
* Function IsElementVisible * Function IsElementVisible
* tests whether a given element category is visible. Keep this as an * tests whether a given element category is visible. Keep this as an
* inline function. * inline function.
* @param aItemIdVisible is an item id from the enum GERBER_VISIBLE_ID * @param aItemIdVisible is an item id from the enum GERBVIEW_LAYER_ID
* @return bool - true if the element is visible. * @return bool - true if the element is visible.
*/ */
bool IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) const; bool IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) const;
/** /**
* Function SetElementVisibility * Function SetElementVisibility
* changes the visibility of an element category * changes the visibility of an element category
* @param aItemIdVisible is an item id from the enum GERBER_VISIBLE_ID * @param aItemIdVisible is an item id from the enum GERBVIEW_LAYER_ID
* @param aNewState = The new visibility state of the element category * @param aNewState = The new visibility state of the element category
* (see enum PCB_VISIBLE) * (see enum PCB)
*/ */
void SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible, bool aNewState ); void SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible, bool aNewState );
/** /**
* Function SetGridVisibility(), virtual from EDA_DRAW_FRAME * Function SetGridVisibility(), virtual from EDA_DRAW_FRAME
@ -334,9 +335,9 @@ public:
* Function GetVisibleElementColor * Function GetVisibleElementColor
* returns the color of a gerber visible element. * returns the color of a gerber visible element.
*/ */
COLOR4D GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const; COLOR4D GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible ) const;
void SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible, COLOR4D aColor ); void SetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible, COLOR4D aColor );
/** /**
* Function GetLayerColor * Function GetLayerColor

View File

@ -185,12 +185,12 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break; break;
case HK_GBR_NEGATIVE_DISPLAY_ONOFF: case HK_GBR_NEGATIVE_DISPLAY_ONOFF:
SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, not IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ); SetElementVisibility( LAYER_NEGATIVE_OBJECTS, not IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
case HK_GBR_DCODE_DISPLAY_ONOFF: case HK_GBR_DCODE_DISPLAY_ONOFF:
SetElementVisibility( DCODES_VISIBLE, not IsElementVisible( DCODES_VISIBLE ) ); SetElementVisibility( LAYER_DCODES, not IsElementVisible( LAYER_DCODES ) );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;

View File

@ -505,13 +505,13 @@ void GERBVIEW_FRAME::OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent )
void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( IsElementVisible( DCODES_VISIBLE ) ); aEvent.Check( IsElementVisible( LAYER_DCODES ) );
} }
void GERBVIEW_FRAME::OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ); aEvent.Check( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
} }

View File

@ -144,14 +144,14 @@ public:
// if empty, use footprint name as default // if empty, use footprint name as default
bool m_RefDefaultVisibility; ///< Default ref text visibility on fp creation bool m_RefDefaultVisibility; ///< Default ref text visibility on fp creation
int m_RefDefaultlayer; ///< Default ref text layer on fp creation int m_RefDefaultlayer; ///< Default ref text layer on fp creation
// should be a LAYER_ID, but use an int // should be a PCB_LAYER_ID, but use an int
// to save this param in config // to save this param in config
wxString m_ValueDefaultText; ///< Default value text on fp creation wxString m_ValueDefaultText; ///< Default value text on fp creation
// if empty, use footprint name as default // if empty, use footprint name as default
bool m_ValueDefaultVisibility; ///< Default value text visibility on fp creation bool m_ValueDefaultVisibility; ///< Default value text visibility on fp creation
int m_ValueDefaultlayer; ///< Default value text layer on fp creation int m_ValueDefaultlayer; ///< Default value text layer on fp creation
// should be a LAYER_ID, but use an int // should be a PCB_LAYER_ID, but use an int
// to save this param in config // to save this param in config
// Miscellaneous // Miscellaneous
@ -447,7 +447,7 @@ public:
* @param aLayerId = The layer to be tested * @param aLayerId = The layer to be tested
* @return bool - true if the layer is visible. * @return bool - true if the layer is visible.
*/ */
inline bool IsLayerVisible( LAYER_ID aLayerId ) const inline bool IsLayerVisible( PCB_LAYER_ID aLayerId ) const
{ {
// If a layer is disabled, it is automatically invisible // If a layer is disabled, it is automatically invisible
return (m_visibleLayers & m_enabledLayers)[aLayerId]; return (m_visibleLayers & m_enabledLayers)[aLayerId];
@ -459,7 +459,7 @@ public:
* @param aLayerId = The layer to be changed * @param aLayerId = The layer to be changed
* @param aNewState = The new visibility state of the layer * @param aNewState = The new visibility state of the layer
*/ */
void SetLayerVisibility( LAYER_ID aLayerId, bool aNewState ); void SetLayerVisibility( PCB_LAYER_ID aLayerId, bool aNewState );
/** /**
* Function GetVisibleElements * Function GetVisibleElements
@ -487,13 +487,11 @@ public:
* inline function. * inline function.
* @param aElementCategory is from the enum by the same name * @param aElementCategory is from the enum by the same name
* @return bool - true if the element is visible. * @return bool - true if the element is visible.
* @see enum PCB_VISIBLE * @see enum GAL_LAYER_ID
*/ */
inline bool IsElementVisible( int aElementCategory ) const inline bool IsElementVisible( GAL_LAYER_ID aElementCategory ) const
{ {
assert( aElementCategory >= 0 && aElementCategory < END_PCB_VISIBLE_LIST ); return ( m_visibleElements & ( 1 << GAL_LAYER_INDEX( aElementCategory ) ) );
return ( m_visibleElements & ( 1 << aElementCategory ) );
} }
/** /**
@ -501,9 +499,9 @@ public:
* changes the visibility of an element category * changes the visibility of an element category
* @param aElementCategory is from the enum by the same name * @param aElementCategory is from the enum by the same name
* @param aNewState = The new visibility state of the element category * @param aNewState = The new visibility state of the element category
* @see enum PCB_VISIBLE * @see enum GAL_LAYER_ID
*/ */
void SetElementVisibility( int aElementCategory, bool aNewState ); void SetElementVisibility( GAL_LAYER_ID aElementCategory, bool aNewState );
/** /**
* Function GetEnabledLayers * Function GetEnabledLayers
@ -528,7 +526,7 @@ public:
* @param aLayerId = The layer to be tested * @param aLayerId = The layer to be tested
* @return bool - true if the layer is enabled * @return bool - true if the layer is enabled
*/ */
inline bool IsLayerEnabled( LAYER_ID aLayerId ) const inline bool IsLayerEnabled( PCB_LAYER_ID aLayerId ) const
{ {
return m_enabledLayers[aLayerId]; return m_enabledLayers[aLayerId];
} }

View File

@ -77,7 +77,7 @@ class BOARD_ITEM : public EDA_ITEM
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; } void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
protected: protected:
LAYER_ID m_Layer; PCB_LAYER_ID m_Layer;
static int getTrailingInt( wxString aStr ); static int getTrailingInt( wxString aStr );
static int getNextNumberInSequence( const std::set<int>& aSeq, bool aFillSequenceGaps ); static int getNextNumberInSequence( const std::set<int>& aSeq, bool aFillSequenceGaps );
@ -129,7 +129,7 @@ public:
* Function GetLayer * Function GetLayer
* returns the primary layer this item is on. * returns the primary layer this item is on.
*/ */
LAYER_ID GetLayer() const { return m_Layer; } PCB_LAYER_ID GetLayer() const { return m_Layer; }
/** /**
* Function GetLayerSet * Function GetLayerSet
@ -146,7 +146,7 @@ public:
* is virtual because some items (in fact: class DIMENSION) * is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization * have a slightly different initialization
*/ */
virtual void SetLayer( LAYER_ID aLayer ) virtual void SetLayer( PCB_LAYER_ID aLayer )
{ {
// trap any invalid layers, then go find the caller and fix it. // trap any invalid layers, then go find the caller and fix it.
// wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) ); // wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) );
@ -179,7 +179,7 @@ public:
* @param aLayer The layer to test for. * @param aLayer The layer to test for.
* @return bool - true if on given layer, else false. * @return bool - true if on given layer, else false.
*/ */
virtual bool IsOnLayer( LAYER_ID aLayer ) const virtual bool IsOnLayer( PCB_LAYER_ID aLayer ) const
{ {
return m_Layer == aLayer; return m_Layer == aLayer;
} }

View File

@ -46,9 +46,6 @@ public:
// Common to Eeschema, Pcbnew, GerbView // Common to Eeschema, Pcbnew, GerbView
COLOR4D m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items) COLOR4D m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items)
// Common to Eeschema, Pcbnew
COLOR4D m_ItemsColors[32]; ///< All others items but layers
public: public:
COLORS_DESIGN_SETTINGS(); COLORS_DESIGN_SETTINGS();
@ -69,14 +66,14 @@ public:
/** /**
* Function GetItemColor * Function GetItemColor
* @return the color for an item which is one of the item indices given * @return the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic * in enum PCB_LAYER_ID
*/ */
COLOR4D GetItemColor( int aItemIdx ) const; COLOR4D GetItemColor( int aItemIdx ) const;
/** /**
* Function SetItemColor * Function SetItemColor
* sets the color for an item which is one of the item indices given * sets the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic * in enum PCB_LAYER_ID
*/ */
void SetItemColor( int aItemIdx, COLOR4D aColor ); void SetItemColor( int aItemIdx, COLOR4D aColor );

View File

@ -41,9 +41,9 @@ class UNDO_REDO_CONTAINER;
class PCB_SCREEN : public BASE_SCREEN class PCB_SCREEN : public BASE_SCREEN
{ {
public: public:
LAYER_ID m_Active_Layer; PCB_LAYER_ID m_Active_Layer;
LAYER_ID m_Route_Layer_TOP; PCB_LAYER_ID m_Route_Layer_TOP;
LAYER_ID m_Route_Layer_BOTTOM; PCB_LAYER_ID m_Route_Layer_BOTTOM;
public: public:

View File

@ -47,15 +47,35 @@ class BOARD;
*/ */
typedef int LAYER_NUM; typedef int LAYER_NUM;
/**
* A quick note on layer IDs:
*
* The layers are stored in separate enums so that certain functions can
* take in the enums as datatypes and don't have to know about layers from
* other applications.
*
* Layers that are shared between applications should be in the GAL_LAYER_ID enum.
*
* The PCB_LAYER_ID struct must start at zero for compatibility with legacy board files.
*
* Some functions accept any layer ID, so they start at zero (i.e. F_Cu) and go up to
* the LAYER_ID_COUNT, which needs to be kept up-to-date if new enums are added.
*/
/** /**
* Enum LAYER_ID * Enum PCB_LAYER_ID
* is the set of PCB layers. It has nothing to do with gerbers or view layers. * This is the definition of all layers used in Pcbnew
* One of these cannot be "incremented". * The PCB layer types are fixed at value 0 through LAYER_ID_COUNT,
* to ensure compatibility with legacy board files.
*
*/ */
enum LAYER_ID: int enum PCB_LAYER_ID: int
{ {
F_Cu, // 0 UNDEFINED_LAYER = -1,
UNSELECTED_LAYER = -2,
F_Cu = 0, // 0
In1_Cu, In1_Cu,
In2_Cu, In2_Cu,
In3_Cu, In3_Cu,
@ -113,22 +133,181 @@ enum LAYER_ID: int
B_Fab, B_Fab,
F_Fab, F_Fab,
LAYER_ID_COUNT, PCB_LAYER_ID_COUNT
UNDEFINED_LAYER = -1,
UNSELECTED_LAYER = -2,
}; };
#define MAX_CU_LAYERS (B_Cu - F_Cu + 1) #define MAX_CU_LAYERS (B_Cu - F_Cu + 1)
/// Dedicated layers for net names used in Pcbnew
enum NETNAMES_LAYER_ID: int
{
NETNAMES_LAYER_ID_START = PCB_LAYER_ID_COUNT,
/// Reserved space for board layer netnames
NETNAMES_LAYER_ID_RESERVED = NETNAMES_LAYER_ID_START + PCB_LAYER_ID_COUNT,
/// Additional netnames layers (not associated with a PCB layer)
LAYER_PAD_FR_NETNAMES,
LAYER_PAD_BK_NETNAMES,
LAYER_PADS_NETNAMES,
NETNAMES_LAYER_ID_END
};
/// Macro for obtaining netname layer for a given PCB layer
#define NETNAMES_LAYER_INDEX( layer ) ( NETNAMES_LAYER_ID_START + layer )
/// GAL layers are "virtual" layers, i.e. not tied into design data.
/// Some layers here are shared between applications.
enum GAL_LAYER_ID: int
{
GAL_LAYER_ID_START = NETNAMES_LAYER_ID_END,
LAYER_VIAS = GAL_LAYER_ID_START,
LAYER_VIA_MICROVIA,
LAYER_VIA_BBLIND,
LAYER_VIA_THROUGH,
LAYER_NON_PLATED,
LAYER_MOD_TEXT_FR,
LAYER_MOD_TEXT_BK,
LAYER_MOD_TEXT_INVISIBLE, ///< text marked as invisible
LAYER_ANCHOR,
LAYER_PAD_FR,
LAYER_PAD_BK,
LAYER_RATSNEST,
LAYER_GRID,
LAYER_GRID_AXES,
LAYER_NO_CONNECTS, ///< show a marker on pads with no nets
LAYER_MOD_FR, ///< show modules on front
LAYER_MOD_BK, ///< show modules on back
LAYER_MOD_VALUES, ///< show modules values (when texts are visibles)
LAYER_MOD_REFERENCES, ///< show modules references (when texts are visibles)
LAYER_TRACKS,
LAYER_PADS, ///< multilayer pads, usually with holes
LAYER_PADS_HOLES,
LAYER_VIAS_HOLES,
LAYER_DRC, ///< drc markers
LAYER_WORKSHEET, ///< worksheet frame
LAYER_GP_OVERLAY, ///< general purpose overlay
/// This is the end of the layers used for visibility bitmasks in Pcbnew
/// There can be at most 32 layers above here.
GAL_LAYER_ID_BITMASK_END,
/// Add new GAL layers here
GAL_LAYER_ID_END
};
/// Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS
#define GAL_LAYER_INDEX( x ) ( x - GAL_LAYER_ID_START )
inline GAL_LAYER_ID operator++( GAL_LAYER_ID& a )
{
a = GAL_LAYER_ID( int( a ) + 1 );
return a;
}
/// Used for via types
inline GAL_LAYER_ID operator+( const GAL_LAYER_ID& a, int b )
{
GAL_LAYER_ID t = GAL_LAYER_ID( int( a ) + b );
wxASSERT( t <= GAL_LAYER_ID_END );
return t;
}
/// Eeschema drawing layers
enum SCH_LAYER_ID: int
{
SCH_LAYER_ID_START = GAL_LAYER_ID_END,
LAYER_WIRE = SCH_LAYER_ID_START,
LAYER_BUS,
LAYER_JUNCTION,
LAYER_LOCLABEL,
LAYER_GLOBLABEL,
LAYER_HIERLABEL,
LAYER_PINNUM,
LAYER_PINNAM,
LAYER_REFERENCEPART,
LAYER_VALUEPART,
LAYER_FIELDS,
LAYER_DEVICE,
LAYER_NOTES,
LAYER_NETNAM,
LAYER_PIN,
LAYER_SHEET,
LAYER_SHEETNAME,
LAYER_SHEETFILENAME,
LAYER_SHEETLABEL,
LAYER_NOCONNECT,
LAYER_ERC_WARN,
LAYER_ERC_ERR,
LAYER_DEVICE_BACKGROUND,
LAYER_SCHEMATIC_GRID,
LAYER_SCHEMATIC_BACKGROUND,
LAYER_BRIGHTENED,
SCH_LAYER_ID_END
};
#define SCH_LAYER_ID_COUNT ( SCH_LAYER_ID_END - SCH_LAYER_ID_START )
#define SCH_LAYER_INDEX( x ) ( x - SCH_LAYER_ID_START )
inline SCH_LAYER_ID operator++( SCH_LAYER_ID& a )
{
a = SCH_LAYER_ID( int( a ) + 1 );
return a;
}
// number of draw layers in Gerbview
#define GERBER_DRAWLAYERS_COUNT 32
/// GerbView draw layers
enum GERBVIEW_LAYER_ID: int
{
GERBVIEW_LAYER_ID_START = SCH_LAYER_ID_END,
/// GerbView draw layers
GERBVIEW_LAYER_ID_RESERVED = GERBVIEW_LAYER_ID_START + GERBER_DRAWLAYERS_COUNT,
LAYER_DCODES,
LAYER_NEGATIVE_OBJECTS,
LAYER_GERBVIEW_GRID,
LAYER_GERBVIEW_AXES,
LAYER_GERBVIEW_BACKGROUND,
GERBVIEW_LAYER_ID_END
};
/// Must update this if you add any enums after GerbView!
#define LAYER_ID_COUNT GERBVIEW_LAYER_ID_END
// Some elements do not have yet a visibility control
// from a dialog, but have a visibility control flag.
// Here is a mask to set them visible, to be sure they are displayed
// after loading a board for instance
#define MIN_VISIBILITY_MASK int( (1 << GAL_LAYER_INDEX( LAYER_TRACKS ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_PADS ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_PADS_HOLES ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_VIAS_HOLES ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_DRC ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_WORKSHEET ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_GP_OVERLAY ) ) )
/// A sequence of layers, a sequence provides a certain order. /// A sequence of layers, a sequence provides a certain order.
typedef std::vector<LAYER_ID> BASE_SEQ; typedef std::vector<PCB_LAYER_ID> BASE_SEQ;
/** /**
* Class LSEQ * Class LSEQ
* is a sequence (and therefore also a set) of LAYER_IDs. A sequence provides * is a sequence (and therefore also a set) of PCB_LAYER_IDs. A sequence provides
* a certain order. * a certain order.
* <p> * <p>
* It can also be used as an iterator: * It can also be used as an iterator:
@ -166,19 +345,19 @@ public:
operator bool () { return m_index < size(); } operator bool () { return m_index < size(); }
LAYER_ID operator * () const PCB_LAYER_ID operator * () const
{ {
return at( m_index ); // throws std::out_of_range return at( m_index ); // throws std::out_of_range
} }
}; };
typedef std::bitset<LAYER_ID_COUNT> BASE_SET; typedef std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;
/** /**
* Class LSET * Class LSET
* is a set of LAYER_IDs. It can be converted to numerous purpose LSEQs using * is a set of PCB_LAYER_IDs. It can be converted to numerous purpose LSEQs using
* the various member functions, most of which are based on Seq(). The advantage * the various member functions, most of which are based on Seq(). The advantage
* of converting to LSEQ using purposeful code, is it removes any dependency * of converting to LSEQ using purposeful code, is it removes any dependency
* on order/sequence inherent in this set. * on order/sequence inherent in this set.
@ -190,7 +369,7 @@ public:
// The constructor flavors are carefully chosen to prevent LSET( int ) from compiling. // The constructor flavors are carefully chosen to prevent LSET( int ) from compiling.
// That excludes "LSET s = 0;" and excludes "LSET s = -1;", etc. // That excludes "LSET s = 0;" and excludes "LSET s = -1;", etc.
// LSET s = 0; needs to be removed from the code, this accomplishes that. // LSET s = 0; needs to be removed from the code, this accomplishes that.
// Remember LSET( LAYER_ID(0) ) sets bit 0, so "LSET s = 0;" is illegal // Remember LSET( PCB_LAYER_ID(0) ) sets bit 0, so "LSET s = 0;" is illegal
// to prevent that surprize. Therefore LSET's constructor suite is significantly // to prevent that surprize. Therefore LSET's constructor suite is significantly
// different than the base class from which it is derived. // different than the base class from which it is derived.
@ -212,8 +391,8 @@ public:
} }
/** /**
* Constructor LSET( LAYER_ID ) * Constructor LSET( PCB_LAYER_ID )
* takes a LAYER_ID and sets that bit. This makes the following code into * takes a PCB_LAYER_ID and sets that bit. This makes the following code into
* a bug: * a bug:
* *
* <code> LSET s = 0; </code> * <code> LSET s = 0; </code>
@ -226,26 +405,26 @@ public:
* *
* for an empty set. * for an empty set.
*/ */
LSET( LAYER_ID aLayer ) : // LAYER_ID deliberately exludes int and relatives LSET( PCB_LAYER_ID aLayer ) : // PCB_LAYER_ID deliberately exludes int and relatives
BASE_SET() BASE_SET()
{ {
set( aLayer ); set( aLayer );
} }
/** /**
* Constructor LSET( const LAYER_ID* aArray, unsigned aCount ) * Constructor LSET( const PCB_LAYER_ID* aArray, unsigned aCount )
* works well with an array or LSEQ. * works well with an array or LSEQ.
*/ */
LSET( const LAYER_ID* aArray, unsigned aCount ); LSET( const PCB_LAYER_ID* aArray, unsigned aCount );
/** /**
* Constructor LSET( unsigned, LAYER_ID, ...) * Constructor LSET( unsigned, PCB_LAYER_ID, ...)
* takes one or more LAYER_IDs in the argument list to construct * takes one or more PCB_LAYER_IDs in the argument list to construct
* the set. Typically only used in static construction. * the set. Typically only used in static construction.
* *
* @param aIdCount is the number of LAYER_IDs which follow. * @param aIdCount is the number of PCB_LAYER_IDs which follow.
* @param aFirst is the first included in @a aIdCount and must always be present, and can * @param aFirst is the first included in @a aIdCount and must always be present, and can
* be followed by any number of additional LAYER_IDs so long as @a aIdCount accurately * be followed by any number of additional PCB_LAYER_IDs so long as @a aIdCount accurately
* reflects the count. * reflects the count.
* *
* Parameter is 'int' to avoid va_start undefined behavior. * Parameter is 'int' to avoid va_start undefined behavior.
@ -256,7 +435,7 @@ public:
* Function Name * Function Name
* returns the fixed name association with aLayerId. * returns the fixed name association with aLayerId.
*/ */
static const wxChar* Name( LAYER_ID aLayerId ); static const wxChar* Name( PCB_LAYER_ID aLayerId );
/** /**
* Function InternalCuMask() * Function InternalCuMask()
@ -267,7 +446,7 @@ public:
/** /**
* Function AllCuMask * Function AllCuMask
* returns a mask holding the requested number of Cu LAYER_IDs. * returns a mask holding the requested number of Cu PCB_LAYER_IDs.
*/ */
static LSET AllCuMask( int aCuLayerCount = MAX_CU_LAYERS ); static LSET AllCuMask( int aCuLayerCount = MAX_CU_LAYERS );
@ -364,15 +543,15 @@ public:
* returns an LSEQ from the union of this LSET and a desired sequence. The LSEQ * returns an LSEQ from the union of this LSET and a desired sequence. The LSEQ
* element will be in the same sequence as aWishListSequence if they are present. * element will be in the same sequence as aWishListSequence if they are present.
* @param aWishListSequence establishes the order of the returned LSEQ, and the LSEQ will only * @param aWishListSequence establishes the order of the returned LSEQ, and the LSEQ will only
* contiain LAYER_IDs which are present in this set. * contain PCB_LAYER_IDs which are present in this set.
* @param aCount is the length of aWishListSequence array. * @param aCount is the length of aWishListSequence array.
*/ */
LSEQ Seq( const LAYER_ID* aWishListSequence, unsigned aCount ) const; LSEQ Seq( const PCB_LAYER_ID* aWishListSequence, unsigned aCount ) const;
/** /**
* Function Seq * Function Seq
* returns a LSEQ from this LSET in ascending LAYER_ID order. Each LSEQ * returns a LSEQ from this LSET in ascending PCB_LAYER_ID order. Each LSEQ
* element will be in the same sequence as in LAYER_ID and only present * element will be in the same sequence as in PCB_LAYER_ID and only present
* in the resultant LSEQ if present in this set. Therefore the sequence is * in the resultant LSEQ if present in this set. Therefore the sequence is
* subject to change, use it only when enumeration and not order is important. * subject to change, use it only when enumeration and not order is important.
*/ */
@ -408,138 +587,31 @@ public:
std::string FmtBin() const; std::string FmtBin() const;
/** /**
* Find the first set LAYER_ID. Returns UNDEFINED_LAYER if more * Find the first set PCB_LAYER_ID. Returns UNDEFINED_LAYER if more
* than one is set or UNSELECTED_LAYER if none is set. * than one is set or UNSELECTED_LAYER if none is set.
*/ */
LAYER_ID ExtractLayer() const; PCB_LAYER_ID ExtractLayer() const;
private: private:
/// Take this off the market, it may not be used because of LSET( LAYER_ID ). /// Take this off the market, it may not be used because of LSET( PCB_LAYER_ID ).
LSET( unsigned long __val ) LSET( unsigned long __val )
{ {
// not usable, it's private. // not usable, it's private.
} }
}; };
/**
* Enum PCB_VISIBLE
* is a set of visible PCB elements.
* @see BOARD::SetVisibleElementColor()
* @see BOARD::SetVisibleElement()
*/
enum PCB_VISIBLE
{
VIAS_VISIBLE,
VIA_MICROVIA_VISIBLE,
VIA_BBLIND_VISIBLE,
VIA_THROUGH_VISIBLE,
NON_PLATED_VISIBLE,
MOD_TEXT_FR_VISIBLE,
MOD_TEXT_BK_VISIBLE,
MOD_TEXT_INVISIBLE, ///< text marked as invisible
ANCHOR_VISIBLE,
PAD_FR_VISIBLE,
PAD_BK_VISIBLE,
RATSNEST_VISIBLE,
GRID_VISIBLE,
// the rest of these do not currently support color changes:
NO_CONNECTS_VISIBLE, ///< show a marker on pads with no nets
MOD_FR_VISIBLE, ///< show modules on front
MOD_BK_VISIBLE, ///< show modules on back
MOD_VALUES_VISIBLE, ///< show modules values (when texts are visibles)
MOD_REFERENCES_VISIBLE, ///< show modules references (when texts are visibles)
TRACKS_VISIBLE,
PADS_VISIBLE, ///< multilayer pads, usually with holes
PADS_HOLES_VISIBLE,
VIAS_HOLES_VISIBLE,
DRC_VISIBLE, ///< drc markers
WORKSHEET, ///< worksheet frame
GP_OVERLAY, ///< general purpose overlay
END_PCB_VISIBLE_LIST // sentinel
};
// Some elements do not have yet a visibility control
// from a dialog, but have a visibility control flag.
// Here is a mask to set them visible, to be sure they are displayed
// after loading a board for instance
#define MIN_VISIBILITY_MASK int( (1 << TRACKS_VISIBLE) +\
(1 << PADS_VISIBLE) +\
(1 << PADS_HOLES_VISIBLE) +\
(1 << VIAS_HOLES_VISIBLE) +\
(1 << DRC_VISIBLE) +\
(1 << WORKSHEET) +\
(1 << GP_OVERLAY) )
/**
* Enum NETNAMES_VISIBLE
* is a set of layers specific for displaying net names.
* Their visiblity is not supposed to be saved in a board file,
* they are only to be used by the GAL.
*/
#if 0
// was:
enum NETNAMES_VISIBLE
{
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
PAD_FR_NETNAMES_VISIBLE,
PAD_BK_NETNAMES_VISIBLE,
PADS_NETNAMES_VISIBLE,
END_NETNAMES_VISIBLE_LIST // sentinel
};
#else
enum NETNAMES_VISIBLE
{
PAD_FR_NETNAMES_VISIBLE = B_Cu+1,
PAD_BK_NETNAMES_VISIBLE,
PADS_NETNAMES_VISIBLE,
END_NETNAMES_VISIBLE_LIST // sentinel
};
#endif
/// macro for obtaining layer number for specific item (eg. pad or text)
#define ITEM_GAL_LAYER(layer) (LAYER_ID_COUNT + layer)
#define NETNAMES_GAL_LAYER(layer) (LAYER_ID_COUNT + END_PCB_VISIBLE_LIST + layer )
/// number of *all* GAL layers including PCB and item layers
#define TOTAL_LAYER_COUNT (LAYER_ID_COUNT + END_PCB_VISIBLE_LIST + END_NETNAMES_VISIBLE_LIST)
/** /**
* Function IsValidLayer * Function IsValidLayer
* tests whether a given integer is a valid layer index, i.e. can * tests whether a given integer is a valid layer index, i.e. can
* be safely put in a LAYER_ID * be safely put in a PCB_LAYER_ID
* @param aLayerId = Layer index to test. It can be an int, so its * @param aLayerId = Layer index to test. It can be an int, so its
* useful during I/O * useful during I/O
* @return true if aLayerIndex is a valid layer index * @return true if aLayerIndex is a valid layer index
*/ */
inline bool IsValidLayer( LAYER_NUM aLayerId ) inline bool IsValidLayer( LAYER_NUM aLayerId )
{ {
return unsigned( aLayerId ) < LAYER_ID_COUNT; return unsigned( aLayerId ) < PCB_LAYER_ID_COUNT;
} }
/** /**
@ -550,7 +622,7 @@ inline bool IsValidLayer( LAYER_NUM aLayerId )
*/ */
inline bool IsPcbLayer( LAYER_NUM aLayer ) inline bool IsPcbLayer( LAYER_NUM aLayer )
{ {
return aLayer >= F_Cu && aLayer < LAYER_ID_COUNT; return aLayer >= F_Cu && aLayer < PCB_LAYER_ID_COUNT;
} }
/** /**
@ -572,7 +644,7 @@ inline bool IsCopperLayer( LAYER_NUM aLayerId )
*/ */
inline bool IsNonCopperLayer( LAYER_NUM aLayerId ) inline bool IsNonCopperLayer( LAYER_NUM aLayerId )
{ {
return aLayerId > B_Cu && aLayerId <= LAYER_ID_COUNT; return aLayerId > B_Cu && aLayerId <= PCB_LAYER_ID_COUNT;
} }
/** /**
@ -581,7 +653,7 @@ inline bool IsNonCopperLayer( LAYER_NUM aLayerId )
* @param aLayerId = Layer to test * @param aLayerId = Layer to test
* @return true if aLayer is a user layer * @return true if aLayer is a user layer
*/ */
inline bool IsUserLayer( LAYER_ID aLayerId ) inline bool IsUserLayer( PCB_LAYER_ID aLayerId )
{ {
return aLayerId >= Dwgs_User && aLayerId <= Eco2_User; return aLayerId >= Dwgs_User && aLayerId <= Eco2_User;
} }
@ -599,7 +671,7 @@ inline bool IsUserLayer( LAYER_ID aLayerId )
/** /**
* Layer classification: check if it's a front layer * Layer classification: check if it's a front layer
*/ */
inline bool IsFrontLayer( LAYER_ID aLayerId ) inline bool IsFrontLayer( PCB_LAYER_ID aLayerId )
{ {
switch( aLayerId ) switch( aLayerId )
{ {
@ -622,7 +694,7 @@ inline bool IsFrontLayer( LAYER_ID aLayerId )
/** /**
* Layer classification: check if it's a back layer * Layer classification: check if it's a back layer
*/ */
inline bool IsBackLayer( LAYER_ID aLayerId ) inline bool IsBackLayer( PCB_LAYER_ID aLayerId )
{ {
switch( aLayerId ) switch( aLayerId )
{ {
@ -648,11 +720,11 @@ inline bool IsBackLayer( LAYER_ID aLayerId )
* some (not all) layers: external copper, and paired layers( Mask, Paste, solder ... ) * some (not all) layers: external copper, and paired layers( Mask, Paste, solder ... )
* are swapped between front and back sides * are swapped between front and back sides
* internal layers are flipped only if the copper layers count is known * internal layers are flipped only if the copper layers count is known
* @param aLayer = the LAYER_ID to flip * @param aLayer = the PCB_LAYER_ID to flip
* @param aCopperLayersCount = the number of copper layers. if 0 (in fact if < 4 ) * @param aCopperLayersCount = the number of copper layers. if 0 (in fact if < 4 )
* internal layers will be not flipped because the layer count is not known * internal layers will be not flipped because the layer count is not known
*/ */
LAYER_ID FlipLayer( LAYER_ID aLayerId, int aCopperLayersCount = 0 ); PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayerId, int aCopperLayersCount = 0 );
/** /**
* Calculate the mask layer when flipping a footprint * Calculate the mask layer when flipping a footprint
@ -671,13 +743,13 @@ LSET FlipLayerMask( LSET aMask, int aCopperLayersCount = 0 );
inline int GetNetnameLayer( int aLayer ) inline int GetNetnameLayer( int aLayer )
{ {
if( IsCopperLayer( aLayer ) ) if( IsCopperLayer( aLayer ) )
return NETNAMES_GAL_LAYER( aLayer ); return NETNAMES_LAYER_INDEX( aLayer );
else if( aLayer == ITEM_GAL_LAYER( PADS_VISIBLE ) ) else if( aLayer == LAYER_PADS )
return NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ); return LAYER_PADS_NETNAMES;
else if( aLayer == ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ) else if( aLayer == LAYER_PAD_FR )
return NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ); return LAYER_PAD_FR_NETNAMES;
else if( aLayer == ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ) else if( aLayer == LAYER_PAD_BK )
return NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ); return LAYER_PAD_BK_NETNAMES;
// Fallback // Fallback
return Cmts_User; return Cmts_User;
@ -691,11 +763,11 @@ inline int GetNetnameLayer( int aLayer )
*/ */
inline bool IsNetnameLayer( LAYER_NUM aLayer ) inline bool IsNetnameLayer( LAYER_NUM aLayer )
{ {
return aLayer >= NETNAMES_GAL_LAYER( F_Cu ) && return aLayer >= NETNAMES_LAYER_INDEX( F_Cu ) &&
aLayer < NETNAMES_GAL_LAYER( END_NETNAMES_VISIBLE_LIST ); aLayer < NETNAMES_LAYER_ID_END;
} }
LAYER_ID ToLAYER_ID( int aLayer ); PCB_LAYER_ID ToLAYER_ID( int aLayer );
#endif // LAYERS_ID_AND_VISIBILITY_H_ #endif // LAYERS_ID_AND_VISIBILITY_H_

View File

@ -54,7 +54,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override void ViewGetLayers( int aLayers[], int& aCount ) const override
{ {
aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY ); aLayers[0] = LAYER_GP_OVERLAY;
aCount = 1; aCount = 1;
} }

View File

@ -231,16 +231,16 @@ protected:
std::set<unsigned int> m_activeLayers; ///< Stores active layers number std::set<unsigned int> m_activeLayers; ///< Stores active layers number
///> Colors for all layers (normal) ///> Colors for all layers (normal)
COLOR4D m_layerColors[TOTAL_LAYER_COUNT]; COLOR4D m_layerColors[LAYER_ID_COUNT];
///> Colors for all layers (highlighted) ///> Colors for all layers (highlighted)
COLOR4D m_layerColorsHi[TOTAL_LAYER_COUNT]; COLOR4D m_layerColorsHi[LAYER_ID_COUNT];
///> Colors for all layers (selected) ///> Colors for all layers (selected)
COLOR4D m_layerColorsSel[TOTAL_LAYER_COUNT]; COLOR4D m_layerColorsSel[LAYER_ID_COUNT];
///> Colors for all layers (darkened) ///> Colors for all layers (darkened)
COLOR4D m_layerColorsDark[TOTAL_LAYER_COUNT]; COLOR4D m_layerColorsDark[LAYER_ID_COUNT];
/// Parameters for display modes /// Parameters for display modes
bool m_hiContrastEnabled; ///< High contrast display mode on/off bool m_hiContrastEnabled; ///< High contrast display mode on/off

View File

@ -58,7 +58,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override void ViewGetLayers( int aLayers[], int& aCount ) const override
{ {
aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY ); aLayers[0] = LAYER_GP_OVERLAY ;
aCount = 1; aCount = 1;
} }

View File

@ -46,6 +46,7 @@ namespace PREVIEW
class SELECTION_AREA : public SIMPLE_OVERLAY_ITEM class SELECTION_AREA : public SIMPLE_OVERLAY_ITEM
{ {
public: public:
static const int SelectionLayer = LAYER_GP_OVERLAY;
SELECTION_AREA(); SELECTION_AREA();

View File

@ -26,6 +26,7 @@
#include <base_struct.h> #include <base_struct.h>
#include <layers_id_colors_and_visibility.h>
#include <gal/color4d.h> #include <gal/color4d.h>
namespace KIGFX namespace KIGFX

View File

@ -637,7 +637,8 @@ public:
m_useDrawPriority = aFlag; m_useDrawPriority = aFlag;
} }
static const int VIEW_MAX_LAYERS = 256; ///< maximum number of layers that may be shown static const int VIEW_MAX_LAYERS = 512; ///< maximum number of layers that may be shown
private: private:
struct VIEW_LAYER struct VIEW_LAYER

View File

@ -606,7 +606,7 @@ public:
* @param aDlgPosition = position of dialog ( defualt = centered) * @param aDlgPosition = position of dialog ( defualt = centered)
* @return the selected layer id * @return the selected layer id
*/ */
LAYER_ID SelectLayer( LAYER_ID aDefaultLayer, PCB_LAYER_ID SelectLayer( PCB_LAYER_ID aDefaultLayer,
LSET aNotAllowedLayersMask = LSET(), LSET aNotAllowedLayersMask = LSET(),
wxPoint aDlgPosition = wxDefaultPosition ); wxPoint aDlgPosition = wxDefaultPosition );
@ -615,13 +615,13 @@ public:
*/ */
void SelectCopperLayerPair(); void SelectCopperLayerPair();
virtual void SwitchLayer( wxDC* DC, LAYER_ID layer ); virtual void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer );
/** /**
* Function SetActiveLayer * Function SetActiveLayer
* will change the currently active layer to \a aLayer. * will change the currently active layer to \a aLayer.
*/ */
virtual void SetActiveLayer( LAYER_ID aLayer ) virtual void SetActiveLayer( PCB_LAYER_ID aLayer )
{ {
GetScreen()->m_Active_Layer = aLayer; GetScreen()->m_Active_Layer = aLayer;
} }
@ -630,7 +630,7 @@ public:
* Function GetActiveLayer * Function GetActiveLayer
* returns the active layer * returns the active layer
*/ */
virtual LAYER_ID GetActiveLayer() const virtual PCB_LAYER_ID GetActiveLayer() const
{ {
return GetScreen()->m_Active_Layer; return GetScreen()->m_Active_Layer;
} }

View File

@ -603,7 +603,7 @@ public:
* will change the currently active layer to \a aLayer and also * will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET. * update the PCB_LAYER_WIDGET.
*/ */
virtual void SetActiveLayer( LAYER_ID aLayer ) override; virtual void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
/** /**
* Function IsElementVisible * Function IsElementVisible
@ -611,18 +611,18 @@ public:
* inline function. * inline function.
* @param aElement is from the enum by the same name * @param aElement is from the enum by the same name
* @return bool - true if the element is visible. * @return bool - true if the element is visible.
* @see enum PCB_VISIBLE * @see enum GAL_LAYER_ID
*/ */
bool IsElementVisible( int aElement ) const; bool IsElementVisible( GAL_LAYER_ID aElement ) const;
/** /**
* Function SetElementVisibility * Function SetElementVisibility
* changes the visibility of an element category * changes the visibility of an element category
* @param aElement is from the enum by the same name * @param aElement is from the enum by the same name
* @param aNewState = The new visibility state of the element category * @param GAL_LAYER_ID = The new visibility state of the element category
* @see enum PCB_VISIBLE * @see enum PCB_LAYER_ID
*/ */
void SetElementVisibility( int aElement, bool aNewState ); void SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState );
/** /**
* Function SetVisibleAlls * Function SetVisibleAlls
@ -1297,7 +1297,7 @@ public:
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end ); bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, LAYER_ID layer ) override; void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) override;
/** /**
* Function Add45DegreeSegment * Function Add45DegreeSegment
@ -1497,7 +1497,7 @@ public:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC ); DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( LAYER_ID aLayer ); void Delete_Drawings_All_Layer( PCB_LAYER_ID aLayer );
// Dimension handling: // Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC ); void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );

View File

@ -132,7 +132,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
wxPoint PosOK; wxPoint PosOK;
wxPoint memopos; wxPoint memopos;
int error; int error;
LAYER_ID lay_tmp_TOP, lay_tmp_BOTTOM; PCB_LAYER_ID lay_tmp_TOP, lay_tmp_BOTTOM;
// Undo: init list // Undo: init list
PICKED_ITEMS_LIST newList; PICKED_ITEMS_LIST newList;

View File

@ -323,7 +323,7 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic )
int uy1 = aTrack->GetEnd().y - RoutingMatrix.GetBrdCoordOrigin().y; int uy1 = aTrack->GetEnd().y - RoutingMatrix.GetBrdCoordOrigin().y;
// Ordinary track // Ordinary track
LAYER_ID layer = aTrack->GetLayer(); PCB_LAYER_ID layer = aTrack->GetLayer();
if( color == VIA_IMPOSSIBLE ) if( color == VIA_IMPOSSIBLE )
layer = UNDEFINED_LAYER; layer = UNDEFINED_LAYER;

View File

@ -105,7 +105,7 @@ void PCB_EDIT_FRAME::OnPlaceOrRouteFootprints( wxCommandEvent& event )
} }
// Erase ratsnest if needed // Erase ratsnest if needed
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
DrawGeneralRatsnest( &dc ); DrawGeneralRatsnest( &dc );
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;

View File

@ -375,9 +375,9 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
// Note: virtual, overridden in PCB_EDIT_FRAME; // Note: virtual, overridden in PCB_EDIT_FRAME;
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer ) void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
{ {
LAYER_ID preslayer = GetActiveLayer(); PCB_LAYER_ID preslayer = GetActiveLayer();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
// Check if the specified layer matches the present layer // Check if the specified layer matches the present layer
@ -595,15 +595,15 @@ GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
GetActiveLayer() ); GetActiveLayer() );
// account for the globals // account for the globals
guide.SetIgnoreMTextsMarkedNoShow( ! m_Pcb->IsElementVisible( MOD_TEXT_INVISIBLE )); guide.SetIgnoreMTextsMarkedNoShow( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_INVISIBLE ) );
guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( MOD_TEXT_BK_VISIBLE )); guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( MOD_TEXT_FR_VISIBLE )); guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( MOD_BK_VISIBLE ) ); guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_BK ) );
guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( MOD_FR_VISIBLE ) ); guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_FR ) );
guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( PAD_BK_VISIBLE ) ); guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( LAYER_PAD_BK ) );
guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( PAD_FR_VISIBLE ) ); guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( MOD_VALUES_VISIBLE ) ); guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( MOD_REFERENCES_VISIBLE ) ); guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
return guide; return guide;
} }

View File

@ -317,7 +317,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
{ {
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() ) for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{ {
LAYER_ID layer = module->GetLayer(); PCB_LAYER_ID layer = module->GetLayer();
if( module->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) if( module->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete )
&& ( !module->IsLocked() || blockOpts.includeLockedModules ) ) && ( !module->IsLocked() || blockOpts.includeLockedModules ) )

View File

@ -63,7 +63,7 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
} }
void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines ) void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines )
{ {
// Number of segments to convert a circle to a polygon // Number of segments to convert a circle to a polygon
const int segcountforcircle = 18; const int segcountforcircle = 18;
@ -94,7 +94,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_ID aLayer, SHAPE_POLY_SET&
for( int ii = 0; ii < GetAreaCount(); ii++ ) for( int ii = 0; ii < GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* zone = GetArea( ii ); ZONE_CONTAINER* zone = GetArea( ii );
LAYER_ID zonelayer = zone->GetLayer(); PCB_LAYER_ID zonelayer = zone->GetLayer();
if( zonelayer == aLayer ) if( zonelayer == aLayer )
zone->TransformSolidAreasShapesToPolygonSet( zone->TransformSolidAreasShapesToPolygonSet(
@ -126,7 +126,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_ID aLayer, SHAPE_POLY_SET&
} }
void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_ID aLayer, void MODULE::TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
@ -201,7 +201,7 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_ID aLayer,
* initial radius * aCorrectionFactor * initial radius * aCorrectionFactor
*/ */
void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_ID aLayer, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
@ -277,7 +277,7 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
// Same as function TransformGraphicShapesWithClearanceToPolygonSet but // Same as function TransformGraphicShapesWithClearanceToPolygonSet but
// this only render text // this only render text
void MODULE::TransformGraphicTextWithClearanceToPolygonSet( void MODULE::TransformGraphicTextWithClearanceToPolygonSet(
LAYER_ID aLayer, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,

View File

@ -84,7 +84,7 @@ BOARD::BOARD() :
BuildListOfNets(); // prepare pad and netlist containers. BuildListOfNets(); // prepare pad and netlist containers.
for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{ {
m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) ); m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
@ -503,7 +503,7 @@ void BOARD::PopHighLight()
} }
bool BOARD::SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer ) bool BOARD::SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer )
{ {
if( unsigned( aIndex ) < DIM( m_Layer ) ) if( unsigned( aIndex ) < DIM( m_Layer ) )
{ {
@ -516,11 +516,11 @@ bool BOARD::SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer )
#include <stdio.h> #include <stdio.h>
const LAYER_ID BOARD::GetLayerID( const wxString& aLayerName ) const const PCB_LAYER_ID BOARD::GetLayerID( const wxString& aLayerName ) const
{ {
// Look for the BOARD specific copper layer names // Look for the BOARD specific copper layer names
for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{ {
if ( IsCopperLayer( layer ) && ( m_Layer[ layer ].m_name == aLayerName ) ) if ( IsCopperLayer( layer ) && ( m_Layer[ layer ].m_name == aLayerName ) )
{ {
@ -529,7 +529,7 @@ const LAYER_ID BOARD::GetLayerID( const wxString& aLayerName ) const
} }
// Otherwise fall back to the system standard layer names // Otherwise fall back to the system standard layer names
for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{ {
if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName ) if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
{ {
@ -540,7 +540,7 @@ const LAYER_ID BOARD::GetLayerID( const wxString& aLayerName ) const
return UNDEFINED_LAYER; return UNDEFINED_LAYER;
} }
const wxString BOARD::GetLayerName( LAYER_ID aLayer ) const const wxString BOARD::GetLayerName( PCB_LAYER_ID aLayer ) const
{ {
// All layer names are stored in the BOARD. // All layer names are stored in the BOARD.
if( IsLayerEnabled( aLayer ) ) if( IsLayerEnabled( aLayer ) )
@ -556,7 +556,7 @@ const wxString BOARD::GetLayerName( LAYER_ID aLayer ) const
return GetStandardLayerName( aLayer ); return GetStandardLayerName( aLayer );
} }
bool BOARD::SetLayerName( LAYER_ID aLayer, const wxString& aLayerName ) bool BOARD::SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName )
{ {
if( !IsCopperLayer( aLayer ) ) if( !IsCopperLayer( aLayer ) )
return false; return false;
@ -584,7 +584,7 @@ bool BOARD::SetLayerName( LAYER_ID aLayer, const wxString& aLayerName )
#else #else
for( LSEQ cu = GetEnabledLayers().CuStack(); cu; ++cu ) for( LSEQ cu = GetEnabledLayers().CuStack(); cu; ++cu )
{ {
LAYER_ID id = *cu; PCB_LAYER_ID id = *cu;
// veto changing the name if it exists elsewhere. // veto changing the name if it exists elsewhere.
if( id != aLayer && nameTemp == m_Layer[id].m_name ) if( id != aLayer && nameTemp == m_Layer[id].m_name )
@ -602,7 +602,7 @@ bool BOARD::SetLayerName( LAYER_ID aLayer, const wxString& aLayerName )
} }
LAYER_T BOARD::GetLayerType( LAYER_ID aLayer ) const LAYER_T BOARD::GetLayerType( PCB_LAYER_ID aLayer ) const
{ {
if( !IsCopperLayer( aLayer ) ) if( !IsCopperLayer( aLayer ) )
return LT_SIGNAL; return LT_SIGNAL;
@ -616,7 +616,7 @@ LAYER_T BOARD::GetLayerType( LAYER_ID aLayer ) const
} }
bool BOARD::SetLayerType( LAYER_ID aLayer, LAYER_T aLayerType ) bool BOARD::SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType )
{ {
if( !IsCopperLayer( aLayer ) ) if( !IsCopperLayer( aLayer ) )
return false; return false;
@ -717,9 +717,9 @@ void BOARD::SetVisibleElements( int aMask )
// Call SetElementVisibility for each item // Call SetElementVisibility for each item
// to ensure specific calculations that can be needed by some items, // to ensure specific calculations that can be needed by some items,
// just changing the visibility flags could be not sufficient. // just changing the visibility flags could be not sufficient.
for( int ii = 0; ii < PCB_VISIBLE( END_PCB_VISIBLE_LIST ); ii++ ) for( GAL_LAYER_ID ii = GAL_LAYER_ID_START; ii < GAL_LAYER_ID_BITMASK_END; ++ii )
{ {
int item_mask = 1 << ii; int item_mask = 1 << GAL_LAYER_INDEX( ii );
SetElementVisibility( ii, aMask & item_mask ); SetElementVisibility( ii, aMask & item_mask );
} }
} }
@ -731,7 +731,7 @@ void BOARD::SetVisibleAlls()
// Call SetElementVisibility for each item, // Call SetElementVisibility for each item,
// to ensure specific calculations that can be needed by some items // to ensure specific calculations that can be needed by some items
for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ ) for( GAL_LAYER_ID ii = GAL_LAYER_ID_START; ii < GAL_LAYER_ID_BITMASK_END; ++ii )
SetElementVisibility( ii, true ); SetElementVisibility( ii, true );
} }
@ -742,24 +742,24 @@ int BOARD::GetVisibleElements() const
} }
bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const bool BOARD::IsElementVisible( GAL_LAYER_ID LAYER_aPCB ) const
{ {
return m_designSettings.IsElementVisible( aPCB_VISIBLE ); return m_designSettings.IsElementVisible( LAYER_aPCB );
} }
void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled ) void BOARD::SetElementVisibility( GAL_LAYER_ID LAYER_aPCB, bool isEnabled )
{ {
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled ); m_designSettings.SetElementVisibility( LAYER_aPCB, isEnabled );
switch( aPCB_VISIBLE ) switch( LAYER_aPCB )
{ {
case RATSNEST_VISIBLE: case LAYER_RATSNEST:
// we must clear or set the CH_VISIBLE flags to hide/show ratsnest // we must clear or set the CH_VISIBLE flags to hide/show ratsnest
// because we have a tool to show/hide ratsnest relative to a pad or a module // because we have a tool to show/hide ratsnest relative to a pad or a module
// so the hide/show option is a per item selection // so the hide/show option is a per item selection
if( IsElementVisible( RATSNEST_VISIBLE ) ) if( IsElementVisible( LAYER_RATSNEST ) )
{ {
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ ) for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status |= CH_VISIBLE; m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
@ -777,81 +777,81 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
} }
COLOR4D BOARD::GetVisibleElementColor( int aPCB_VISIBLE ) COLOR4D BOARD::GetVisibleElementColor( GAL_LAYER_ID aLayerId )
{ {
COLOR4D color = COLOR4D::UNSPECIFIED; COLOR4D color = COLOR4D::UNSPECIFIED;
switch( aPCB_VISIBLE ) switch( aLayerId )
{ {
case NON_PLATED_VISIBLE: case LAYER_NON_PLATED:
case VIA_THROUGH_VISIBLE: case LAYER_VIA_THROUGH:
case VIA_MICROVIA_VISIBLE: case LAYER_VIA_MICROVIA:
case VIA_BBLIND_VISIBLE: case LAYER_VIA_BBLIND:
case MOD_TEXT_FR_VISIBLE: case LAYER_MOD_TEXT_FR:
case MOD_TEXT_BK_VISIBLE: case LAYER_MOD_TEXT_BK:
case MOD_TEXT_INVISIBLE: case LAYER_MOD_TEXT_INVISIBLE:
case ANCHOR_VISIBLE: case LAYER_ANCHOR:
case PAD_FR_VISIBLE: case LAYER_PAD_FR:
case PAD_BK_VISIBLE: case LAYER_PAD_BK:
case RATSNEST_VISIBLE: case LAYER_RATSNEST:
case GRID_VISIBLE: case LAYER_GRID:
color = GetColorsSettings()->GetItemColor( aPCB_VISIBLE ); color = GetColorsSettings()->GetItemColor( aLayerId );
break; break;
default: default:
wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE ); wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aLayerId );
} }
return color; return color;
} }
void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, COLOR4D aColor ) void BOARD::SetVisibleElementColor( GAL_LAYER_ID aLayerId, COLOR4D aColor )
{ {
switch( aPCB_VISIBLE ) switch( aLayerId )
{ {
case NON_PLATED_VISIBLE: case LAYER_NON_PLATED:
case VIA_THROUGH_VISIBLE: case LAYER_VIA_THROUGH:
case VIA_MICROVIA_VISIBLE: case LAYER_VIA_MICROVIA:
case VIA_BBLIND_VISIBLE: case LAYER_VIA_BBLIND:
case MOD_TEXT_FR_VISIBLE: case LAYER_MOD_TEXT_FR:
case MOD_TEXT_BK_VISIBLE: case LAYER_MOD_TEXT_BK:
case MOD_TEXT_INVISIBLE: case LAYER_MOD_TEXT_INVISIBLE:
case ANCHOR_VISIBLE: case LAYER_ANCHOR:
case PAD_FR_VISIBLE: case LAYER_PAD_FR:
case PAD_BK_VISIBLE: case LAYER_PAD_BK:
case GRID_VISIBLE: case LAYER_GRID:
case RATSNEST_VISIBLE: case LAYER_RATSNEST:
GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor ); GetColorsSettings()->SetItemColor( aLayerId, aColor );
break; break;
default: default:
wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE ); wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aLayerId );
} }
} }
void BOARD::SetLayerColor( LAYER_ID aLayer, COLOR4D aColor ) void BOARD::SetLayerColor( PCB_LAYER_ID aLayer, COLOR4D aColor )
{ {
GetColorsSettings()->SetLayerColor( aLayer, aColor ); GetColorsSettings()->SetLayerColor( aLayer, aColor );
} }
COLOR4D BOARD::GetLayerColor( LAYER_ID aLayer ) const COLOR4D BOARD::GetLayerColor( PCB_LAYER_ID aLayer ) const
{ {
return GetColorsSettings()->GetLayerColor( aLayer ); return GetColorsSettings()->GetLayerColor( aLayer );
} }
bool BOARD::IsModuleLayerVisible( LAYER_ID layer ) bool BOARD::IsModuleLayerVisible( PCB_LAYER_ID layer )
{ {
switch( layer ) switch( layer )
{ {
case F_Cu: case F_Cu:
return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) ); return IsElementVisible( LAYER_MOD_FR );
case B_Cu: case B_Cu:
return IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) ); return IsElementVisible( LAYER_MOD_BK );
default: default:
wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) ); wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
@ -1470,7 +1470,7 @@ int BOARD::SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
} }
void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_ID aLayer ) void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, PCB_LAYER_ID aLayer )
{ {
if( !aDC ) if( !aDC )
return; return;
@ -1485,7 +1485,7 @@ void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE a
} }
void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_ID aLayer ) void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, PCB_LAYER_ID aLayer )
{ {
if( !aDC ) if( !aDC )
return; return;
@ -1501,7 +1501,7 @@ void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDr
ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos, ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
LAYER_ID aStartLayer, LAYER_ID aEndLayer, int aNetCode ) PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer, int aNetCode )
{ {
if( aEndLayer < 0 ) if( aEndLayer < 0 )
aEndLayer = aStartLayer; aEndLayer = aStartLayer;
@ -1568,7 +1568,7 @@ int BOARD::SetAreasNetCodesFromNetNames()
} }
VIA* BOARD::GetViaByPosition( const wxPoint& aPosition, LAYER_ID aLayer) const VIA* BOARD::GetViaByPosition( const wxPoint& aPosition, PCB_LAYER_ID aLayer) const
{ {
for( VIA *via = GetFirstVia( m_Track); via; via = GetFirstVia( via->Next() ) ) for( VIA *via = GetFirstVia( m_Track); via; via = GetFirstVia( via->Next() ) )
{ {
@ -1776,7 +1776,7 @@ TRACK* BOARD::GetVisibleTrack( TRACK* aStartingTrace, const wxPoint& aPosition,
{ {
for( TRACK* track = aStartingTrace; track; track = track->Next() ) for( TRACK* track = aStartingTrace; track; track = track->Next() )
{ {
LAYER_ID layer = track->GetLayer(); PCB_LAYER_ID layer = track->GetLayer();
if( track->GetState( BUSY | IS_DELETED ) ) if( track->GetState( BUSY | IS_DELETED ) )
continue; continue;
@ -2145,7 +2145,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
} }
MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_ID aActiveLayer, MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked ) bool aVisibleOnly, bool aIgnoreLocked )
{ {
MODULE* pt_module; MODULE* pt_module;
@ -2165,7 +2165,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_ID aActiveLayer,
if( aIgnoreLocked && pt_module->IsLocked() ) if( aIgnoreLocked && pt_module->IsLocked() )
continue; continue;
LAYER_ID layer = pt_module->GetLayer(); PCB_LAYER_ID layer = pt_module->GetLayer();
// Filter non visible modules if requested // Filter non visible modules if requested
if( !aVisibleOnly || IsModuleLayerVisible( layer ) ) if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
@ -2313,7 +2313,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch ) PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch )
{ {
ZONE_CONTAINER* new_area = InsertArea( aNetcode, ZONE_CONTAINER* new_area = InsertArea( aNetcode,
m_ZoneDescriptorList.size( ) - 1, m_ZoneDescriptorList.size( ) - 1,
@ -2348,7 +2348,7 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to
} }
ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, LAYER_ID layer, int x, int y, int hatch ) ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, PCB_LAYER_ID layer, int x, int y, int hatch )
{ {
ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this ); ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );

View File

@ -177,7 +177,7 @@ private:
/// edge zone descriptors, owned by pointer. /// edge zone descriptors, owned by pointer.
ZONE_CONTAINERS m_ZoneDescriptorList; ZONE_CONTAINERS m_ZoneDescriptorList;
LAYER m_Layer[LAYER_ID_COUNT]; LAYER m_Layer[PCB_LAYER_ID_COUNT];
// if true m_highLight_NetCode is used // if true m_highLight_NetCode is used
HIGH_LIGHT_INFO m_highLight; // current high light data HIGH_LIGHT_INFO m_highLight; // current high light data
@ -425,7 +425,7 @@ public:
* @param aLayer = The layer to be tested * @param aLayer = The layer to be tested
* @return bool - true if the layer is visible. * @return bool - true if the layer is visible.
*/ */
bool IsLayerEnabled( LAYER_ID aLayer ) const bool IsLayerEnabled( PCB_LAYER_ID aLayer ) const
{ {
return m_designSettings.IsLayerEnabled( aLayer ); return m_designSettings.IsLayerEnabled( aLayer );
} }
@ -437,7 +437,7 @@ public:
* @param aLayer = The layer to be tested * @param aLayer = The layer to be tested
* @return bool - true if the layer is visible. * @return bool - true if the layer is visible.
*/ */
bool IsLayerVisible( LAYER_ID aLayer ) const bool IsLayerVisible( PCB_LAYER_ID aLayer ) const
{ {
return m_designSettings.IsLayerVisible( aLayer ); return m_designSettings.IsLayerVisible( aLayer );
} }
@ -458,15 +458,15 @@ public:
*/ */
void SetVisibleLayers( LSET aLayerMask ); void SetVisibleLayers( LSET aLayerMask );
// these 2 functions are not tidy at this time, since there are PCB_VISIBLEs that // these 2 functions are not tidy at this time, since there are PCB_LAYER_IDs that
// are not stored in the bitmap. // are not stored in the bitmap.
/** /**
* Function GetVisibleElements * Function GetVisibleElements
* is a proxy function that calls the correspondent function in m_BoardSettings * is a proxy function that calls the correspondent function in m_BoardSettings
* returns a bit-mask of all the element categories that are visible * returns a bit-mask of all the element categories that are visible
* @return int - the visible element bitmap or-ed from enum PCB_VISIBLE * @return int - the visible element bitmap or-ed from enum GAL_LAYER_ID
* @see enum PCB_VISIBLE * @see enum GAL_LAYER_ID
*/ */
int GetVisibleElements() const; int GetVisibleElements() const;
@ -474,15 +474,15 @@ public:
* Function SetVisibleElements * Function SetVisibleElements
* is a proxy function that calls the correspondent function in m_BoardSettings * is a proxy function that calls the correspondent function in m_BoardSettings
* changes the bit-mask of visible element categories * changes the bit-mask of visible element categories
* @param aMask = The new bit-mask of visible element bitmap or-ed from enum PCB_VISIBLE * @param aMask = The new bit-mask of visible element bitmap or-ed from enum GAL_LAYER_ID
* @see enum PCB_VISIBLE * @see enum GAL_LAYER_ID
*/ */
void SetVisibleElements( int aMask ); void SetVisibleElements( int aMask );
/** /**
* Function SetVisibleAlls * Function SetVisibleAlls
* changes the bit-mask of visible element categories and layers * changes the bit-mask of visible element categories and layers
* @see enum PCB_VISIBLE * @see enum GAL_LAYER_ID
*/ */
void SetVisibleAlls(); void SetVisibleAlls();
@ -490,20 +490,20 @@ public:
* Function IsElementVisible * Function IsElementVisible
* tests whether a given element category is visible. Keep this as an * tests whether a given element category is visible. Keep this as an
* inline function. * inline function.
* @param aPCB_VISIBLE is from the enum by the same name * @param LAYER_aPCB is from the enum by the same name
* @return bool - true if the element is visible. * @return bool - true if the element is visible.
* @see enum PCB_VISIBLE * @see enum GAL_LAYER_ID
*/ */
bool IsElementVisible( int aPCB_VISIBLE ) const; bool IsElementVisible( GAL_LAYER_ID LAYER_aPCB ) const;
/** /**
* Function SetElementVisibility * Function SetElementVisibility
* changes the visibility of an element category * changes the visibility of an element category
* @param aPCB_VISIBLE is from the enum by the same name * @param LAYER_aPCB is from the enum by the same name
* @param aNewState = The new visibility state of the element category * @param aNewState = The new visibility state of the element category
* @see enum PCB_VISIBLE * @see enum GAL_LAYER_ID
*/ */
void SetElementVisibility( int aPCB_VISIBLE, bool aNewState ); void SetElementVisibility( GAL_LAYER_ID LAYER_aPCB, bool aNewState );
/** /**
* Function IsModuleLayerVisible * Function IsModuleLayerVisible
@ -512,16 +512,16 @@ public:
* @param layer One of the two allowed layers for modules: F_Cu or B_Cu * @param layer One of the two allowed layers for modules: F_Cu or B_Cu
* @return bool - true if the layer is visible, else false. * @return bool - true if the layer is visible, else false.
*/ */
bool IsModuleLayerVisible( LAYER_ID layer ); bool IsModuleLayerVisible( PCB_LAYER_ID layer );
/** /**
* Function GetVisibleElementColor * Function GetVisibleElementColor
* returns the color of a pcb visible element. * returns the color of a pcb visible element.
* @see enum PCB_VISIBLE * @see enum GAL_LAYER_ID
*/ */
COLOR4D GetVisibleElementColor( int aPCB_VISIBLE ); COLOR4D GetVisibleElementColor( GAL_LAYER_ID LAYER_aPCB );
void SetVisibleElementColor( int aPCB_VISIBLE, COLOR4D aColor ); void SetVisibleElementColor( GAL_LAYER_ID LAYER_aPCB, COLOR4D aColor );
/** /**
* Function GetDesignSettings * Function GetDesignSettings
@ -595,7 +595,7 @@ public:
* @param aLayer = A copper layer, like B_Cu, etc. * @param aLayer = A copper layer, like B_Cu, etc.
* @param aOutlines The SHAPE_POLY_SET to fill in with items outline. * @param aOutlines The SHAPE_POLY_SET to fill in with items outline.
*/ */
void ConvertBrdLayerToPolygonalContours( LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines ); void ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines );
/** /**
* Function GetLayerID * Function GetLayerID
@ -604,10 +604,10 @@ public:
* *
* @param aLayerName = A layer name, like wxT("B.Cu"), etc. * @param aLayerName = A layer name, like wxT("B.Cu"), etc.
* *
* @return LAYER_ID - the layer id, which for copper layers may * @return PCB_LAYER_ID - the layer id, which for copper layers may
* be custom, else standard. * be custom, else standard.
*/ */
const LAYER_ID GetLayerID( const wxString& aLayerName ) const; const PCB_LAYER_ID GetLayerID( const wxString& aLayerName ) const;
/** /**
* Function GetLayerName * Function GetLayerName
@ -619,7 +619,7 @@ public:
* @return wxString - the layer name, which for copper layers may * @return wxString - the layer name, which for copper layers may
* be custom, else standard. * be custom, else standard.
*/ */
const wxString GetLayerName( LAYER_ID aLayer ) const; const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
/** /**
* Function SetLayerName * Function SetLayerName
@ -630,7 +630,7 @@ public:
* @return bool - true if aLayerName was legal and unique among other * @return bool - true if aLayerName was legal and unique among other
* layer names at other layer indices and aLayer was within range, else false. * layer names at other layer indices and aLayer was within range, else false.
*/ */
bool SetLayerName( LAYER_ID aLayer, const wxString& aLayerName ); bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
/** /**
* Function GetStandardLayerName * Function GetStandardLayerName
@ -643,9 +643,9 @@ public:
* @return const wxString - containing the layer name or "BAD INDEX" if aLayerId * @return const wxString - containing the layer name or "BAD INDEX" if aLayerId
* is not legal * is not legal
*/ */
static wxString GetStandardLayerName( LAYER_ID aLayerId ) static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
{ {
// a BOARD's standard layer name is the LAYER_ID fixed name // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
return LSET::Name( aLayerId ); return LSET::Name( aLayerId );
} }
@ -657,7 +657,7 @@ public:
* @param aLayer A reference to a LAYER description. * @param aLayer A reference to a LAYER description.
* @return false if the index was out of range. * @return false if the index was out of range.
*/ */
bool SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer ); bool SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer );
/** /**
* Function GetLayerType * Function GetLayerType
@ -667,7 +667,7 @@ public:
* @return LAYER_T - the layer type, or LAYER_T(-1) if the * @return LAYER_T - the layer type, or LAYER_T(-1) if the
* index was out of range. * index was out of range.
*/ */
LAYER_T GetLayerType( LAYER_ID aLayer ) const; LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
/** /**
* Function SetLayerType * Function SetLayerType
@ -677,19 +677,19 @@ public:
* @param aLayerType The new layer type. * @param aLayerType The new layer type.
* @return bool - true if aLayerType was legal and aLayer was within range, else false. * @return bool - true if aLayerType was legal and aLayer was within range, else false.
*/ */
bool SetLayerType( LAYER_ID aLayer, LAYER_T aLayerType ); bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
/** /**
* Function SetLayerColor * Function SetLayerColor
* changes a layer color for any valid layer, including non-copper ones. * changes a layer color for any valid layer, including non-copper ones.
*/ */
void SetLayerColor( LAYER_ID aLayer, COLOR4D aColor ); void SetLayerColor( PCB_LAYER_ID aLayer, COLOR4D aColor );
/** /**
* Function GetLayerColor * Function GetLayerColor
* gets a layer color for any valid layer, including non-copper ones. * gets a layer color for any valid layer, including non-copper ones.
*/ */
COLOR4D GetLayerColor( LAYER_ID aLayer ) const; COLOR4D GetLayerColor( PCB_LAYER_ID aLayer ) const;
/** Functions to get some items count */ /** Functions to get some items count */
int GetNumSegmTrack() const; int GetNumSegmTrack() const;
@ -981,8 +981,8 @@ public:
* @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL * @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL
*/ */
ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos, ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos,
LAYER_ID aStartLayer, PCB_LAYER_ID aStartLayer,
LAYER_ID aEndLayer, PCB_LAYER_ID aEndLayer,
int aNetCode ); int aNetCode );
/** /**
@ -992,14 +992,14 @@ public:
void RedrawAreasOutlines( EDA_DRAW_PANEL* aPanel, void RedrawAreasOutlines( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, wxDC* aDC,
GR_DRAWMODE aDrawMode, GR_DRAWMODE aDrawMode,
LAYER_ID aLayer ); PCB_LAYER_ID aLayer );
/** /**
* Function RedrawFilledAreas * Function RedrawFilledAreas
* Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 ) * Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 )
*/ */
void RedrawFilledAreas( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, void RedrawFilledAreas( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
LAYER_ID aLayer ); PCB_LAYER_ID aLayer );
/** /**
* Function SetAreasNetCodesFromNetNames * Function SetAreasNetCodesFromNetNames
@ -1067,14 +1067,14 @@ public:
* @return a reference to the new area * @return a reference to the new area
*/ */
ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch ); PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch );
/** /**
* Function InsertArea * Function InsertArea
* add empty copper area to net, inserting after m_ZoneDescriptorList[iarea] * add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]
* @return pointer to the new area * @return pointer to the new area
*/ */
ZONE_CONTAINER* InsertArea( int netcode, int iarea, LAYER_ID layer, int x, int y, int hatch ); ZONE_CONTAINER* InsertArea( int netcode, int iarea, PCB_LAYER_ID layer, int x, int y, int hatch );
/** /**
* Function NormalizeAreaPolygon * Function NormalizeAreaPolygon
@ -1187,10 +1187,10 @@ public:
* of the via. * of the via.
* </p> * </p>
* @param aPosition The wxPoint to HitTest() against. * @param aPosition The wxPoint to HitTest() against.
* @param aLayer The layer to search. Use -1 (LAYER_ID::UNDEFINED_LAYER) for a don't care. * @param aLayer The layer to search. Use -1 (<PCB_LAYER_ID>::UNDEFINED_LAYER) for a don't care.
* @return VIA* A point a to the VIA object if found, else NULL. * @return VIA* A point a to the VIA object if found, else NULL.
*/ */
VIA* GetViaByPosition( const wxPoint& aPosition, LAYER_ID aLayer = LAYER_ID( -1 ) ) const; VIA* GetViaByPosition( const wxPoint& aPosition, PCB_LAYER_ID aLayer = PCB_LAYER_ID( -1 ) ) const;
/** /**
* Function GetPad * Function GetPad
@ -1351,7 +1351,7 @@ public:
* @param aIgnoreLocked Ignore locked modules when true. * @param aIgnoreLocked Ignore locked modules when true.
* @return MODULE* The best module or NULL if none. * @return MODULE* The best module or NULL if none.
*/ */
MODULE* GetFootprint( const wxPoint& aPosition, LAYER_ID aActiveLayer, MODULE* GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked = false ); bool aVisibleOnly, bool aIgnoreLocked = false );
/** /**

View File

@ -47,7 +47,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
SetVisibleLayers( all_set ); SetVisibleLayers( all_set );
// set all but hidden text as visible. // set all but hidden text as visible.
m_visibleElements = ~( 1 << MOD_TEXT_INVISIBLE ); m_visibleElements = ~( 1 << GAL_LAYER_INDEX( LAYER_MOD_TEXT_INVISIBLE ) );
SetCopperLayerCount( 2 ); // Default design is a double sided board SetCopperLayerCount( 2 ); // Default design is a double sided board
@ -322,7 +322,7 @@ void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
} }
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_ID aLayer, bool aNewState ) void BOARD_DESIGN_SETTINGS::SetLayerVisibility( PCB_LAYER_ID aLayer, bool aNewState )
{ {
if( aNewState && IsLayerEnabled( aLayer ) ) if( aNewState && IsLayerEnabled( aLayer ) )
m_visibleLayers.set( aLayer, true ); m_visibleLayers.set( aLayer, true );
@ -331,15 +331,12 @@ void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_ID aLayer, bool aNewState
} }
void BOARD_DESIGN_SETTINGS::SetElementVisibility( int aElementCategory, bool aNewState ) void BOARD_DESIGN_SETTINGS::SetElementVisibility( GAL_LAYER_ID aElementCategory, bool aNewState )
{ {
if( aElementCategory < 0 || aElementCategory >= END_PCB_VISIBLE_LIST )
return;
if( aNewState ) if( aNewState )
m_visibleElements |= 1 << aElementCategory; m_visibleElements |= 1 << GAL_LAYER_INDEX( aElementCategory );
else else
m_visibleElements &= ~( 1 << aElementCategory ); m_visibleElements &= ~( 1 << GAL_LAYER_INDEX( aElementCategory ) );
} }
@ -389,7 +386,7 @@ struct list_size_check {
{ {
// Int (the type used for saving visibility settings) is only 32 bits guaranteed, // Int (the type used for saving visibility settings) is only 32 bits guaranteed,
// be sure that we do not cross the limit // be sure that we do not cross the limit
assert( END_PCB_VISIBLE_LIST <= 32 ); assert( GAL_LAYER_INDEX( GAL_LAYER_ID_BITMASK_END ) <= 32 );
}; };
}; };
static list_size_check check; static list_size_check check;

View File

@ -83,7 +83,7 @@ const wxString DIMENSION::GetText() const
} }
void DIMENSION::SetLayer( LAYER_ID aLayer ) void DIMENSION::SetLayer( PCB_LAYER_ID aLayer )
{ {
m_Layer = aLayer; m_Layer = aLayer;
m_Text.SetLayer( aLayer ); m_Text.SetLayer( aLayer );

View File

@ -96,7 +96,7 @@ public:
m_Text.SetTextSize( aTextSize ); m_Text.SetTextSize( aTextSize );
} }
void SetLayer( LAYER_ID aLayer ) override; void SetLayer( PCB_LAYER_ID aLayer ) override;
void SetShape( int aShape ) { m_Shape = aShape; } void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; } int GetShape() const { return m_Shape; }

View File

@ -205,7 +205,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
int l_trace; int l_trace;
int radius; int radius;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
COLOR4D color; COLOR4D color;
BOARD * brd = GetBoard( ); BOARD * brd = GetBoard( );

View File

@ -107,7 +107,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
const wxPoint& offset ) const wxPoint& offset )
{ {
int ux0, uy0, dx, dy, radius, StAngle, EndAngle; int ux0, uy0, dx, dy, radius, StAngle, EndAngle;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
MODULE* module = (MODULE*) m_Parent; MODULE* module = (MODULE*) m_Parent;

View File

@ -86,7 +86,7 @@ MARKER_PCB::~MARKER_PCB()
* param aLayer The layer to test for. * param aLayer The layer to test for.
* return bool - true if on given layer, else false. * return bool - true if on given layer, else false.
*/ */
bool MARKER_PCB::IsOnLayer( LAYER_ID aLayer ) const bool MARKER_PCB::IsOnLayer( PCB_LAYER_ID aLayer ) const
{ {
return IsCopperLayer( aLayer ); return IsCopperLayer( aLayer );
} }
@ -147,7 +147,7 @@ BITMAP_DEF MARKER_PCB::GetMenuImage() const
void MARKER_PCB::ViewGetLayers( int aLayers[], int& aCount ) const void MARKER_PCB::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aCount = 1; aCount = 1;
aLayers[0] = ITEM_GAL_LAYER( DRC_VISIBLE ); aLayers[0] = LAYER_DRC;
} }
const EDA_RECT MARKER_PCB::GetBoundingBox() const const EDA_RECT MARKER_PCB::GetBoundingBox() const

View File

@ -103,7 +103,7 @@ public:
return HitTestMarker( aPosition ); return HitTestMarker( aPosition );
} }
bool IsOnLayer( LAYER_ID aLayer ) const override; bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;

View File

@ -54,7 +54,7 @@ PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
m_Layer = Edge_Cuts; // a target is on all layers m_Layer = Edge_Cuts; // a target is on all layers
} }
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_ID aLayer, PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
const wxPoint& aPos, int aSize, int aWidth ) : const wxPoint& aPos, int aSize, int aWidth ) :
BOARD_ITEM( aParent, PCB_TARGET_T ) BOARD_ITEM( aParent, PCB_TARGET_T )
{ {

View File

@ -51,7 +51,7 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_ID aLayer, PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
const wxPoint& aPos, int aSize, int aWidth ); const wxPoint& aPos, int aSize, int aWidth );
// Do not create a copy constructor & operator=. // Do not create a copy constructor & operator=.

View File

@ -239,11 +239,11 @@ void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
{ {
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
if( GetBoard()->IsElementVisible( ANCHOR_VISIBLE ) ) if( GetBoard()->IsElementVisible( LAYER_ANCHOR ) )
{ {
GRDrawAnchor( panel->GetClipBox(), DC, m_Pos.x, m_Pos.y, GRDrawAnchor( panel->GetClipBox(), DC, m_Pos.x, m_Pos.y,
dim_ancre, dim_ancre,
g_ColorsSettings.GetItemColor( ANCHOR_VISIBLE ) ); g_ColorsSettings.GetItemColor( LAYER_ANCHOR ) );
} }
} }
@ -404,13 +404,13 @@ void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode ); DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode );
// Draw graphic items // Draw graphic items
if( brd->IsElementVisible( MOD_REFERENCES_VISIBLE ) ) if( brd->IsElementVisible( LAYER_MOD_REFERENCES ) )
{ {
if( !(m_Reference->IsMoving()) ) if( !(m_Reference->IsMoving()) )
m_Reference->Draw( aPanel, aDC, aDrawMode, aOffset ); m_Reference->Draw( aPanel, aDC, aDrawMode, aOffset );
} }
if( brd->IsElementVisible( MOD_VALUES_VISIBLE ) ) if( brd->IsElementVisible( LAYER_MOD_VALUES ) )
{ {
if( !(m_Value->IsMoving()) ) if( !(m_Value->IsMoving()) )
m_Value->Draw( aPanel, aDC, aDrawMode, aOffset ); m_Value->Draw( aPanel, aDC, aDrawMode, aOffset );
@ -837,7 +837,7 @@ void MODULE::RunOnChildren( std::function<void (BOARD_ITEM*)> aFunction )
void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aCount = 2; aCount = 2;
aLayers[0] = ITEM_GAL_LAYER( ANCHOR_VISIBLE ); aLayers[0] = LAYER_ANCHOR;
switch( m_Layer ) switch( m_Layer )
{ {
@ -846,11 +846,11 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
wxASSERT_MSG( false, "Illegal layer" ); // do you really have modules placed on other layers? wxASSERT_MSG( false, "Illegal layer" ); // do you really have modules placed on other layers?
// pass through // pass through
case F_Cu: case F_Cu:
aLayers[1] = ITEM_GAL_LAYER( MOD_FR_VISIBLE ); aLayers[1] = LAYER_MOD_FR;
break; break;
case B_Cu: case B_Cu:
aLayers[1] = ITEM_GAL_LAYER( MOD_BK_VISIBLE ); aLayers[1] = LAYER_MOD_BK;
break; break;
} }
} }
@ -858,11 +858,11 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
unsigned int MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const unsigned int MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{ {
int layer = ( m_Layer == F_Cu ) ? MOD_FR_VISIBLE : int layer = ( m_Layer == F_Cu ) ? LAYER_MOD_FR :
( m_Layer == B_Cu ) ? MOD_BK_VISIBLE : ANCHOR_VISIBLE; ( m_Layer == B_Cu ) ? LAYER_MOD_BK : LAYER_ANCHOR;
// Currently it is only for anchor layer // Currently it is only for anchor layer
if( aView->IsLayerVisible( ITEM_GAL_LAYER( layer ) ) ) if( aView->IsLayerVisible( layer ) )
return 30; return 30;
return std::numeric_limits<unsigned int>::max(); return std::numeric_limits<unsigned int>::max();

View File

@ -320,7 +320,7 @@ public:
* there is no copper left on the board (for instance when creating Gerber Files or 3D shapes) * there is no copper left on the board (for instance when creating Gerber Files or 3D shapes)
* default = false * default = false
*/ */
void TransformPadsShapesWithClearanceToPolygon( LAYER_ID aLayer, void TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
@ -348,7 +348,7 @@ public:
* if 0, use the aCircleToSegmentsCount value * if 0, use the aCircleToSegmentsCount value
*/ */
void TransformGraphicShapesWithClearanceToPolygonSet( void TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_ID aLayer, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
@ -367,7 +367,7 @@ public:
* @param aCircleToSegmentsCountForTexts * @param aCircleToSegmentsCountForTexts
*/ */
void TransformGraphicTextWithClearanceToPolygonSet( void TransformGraphicTextWithClearanceToPolygonSet(
LAYER_ID aLayer, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,

View File

@ -174,7 +174,7 @@ void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel,
{ {
GRSetDrawMode( DC, aDrawMode ); GRSetDrawMode( DC, aDrawMode );
COLOR4D color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE); COLOR4D color = g_ColorsSettings.GetItemColor( LAYER_RATSNEST );
GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC,
m_PadStart->GetPosition() - aOffset, m_PadStart->GetPosition() - aOffset,

View File

@ -931,31 +931,31 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
// These types of pads contain a hole // These types of pads contain a hole
if( m_Attribute == PAD_ATTRIB_STANDARD || m_Attribute == PAD_ATTRIB_HOLE_NOT_PLATED ) if( m_Attribute == PAD_ATTRIB_STANDARD || m_Attribute == PAD_ATTRIB_HOLE_NOT_PLATED )
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ); aLayers[aCount++] = LAYER_PADS_HOLES;
if( IsOnLayer( F_Cu ) && IsOnLayer( B_Cu ) ) if( IsOnLayer( F_Cu ) && IsOnLayer( B_Cu ) )
{ {
// Multi layer pad // Multi layer pad
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE ); aLayers[aCount++] = LAYER_PADS;
aLayers[aCount++] = NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ); aLayers[aCount++] = LAYER_PADS_NETNAMES;
} }
else if( IsOnLayer( F_Cu ) ) else if( IsOnLayer( F_Cu ) )
{ {
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE ); aLayers[aCount++] = LAYER_PAD_FR;
aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ); aLayers[aCount++] = LAYER_PAD_FR_NETNAMES;
} }
else if( IsOnLayer( B_Cu ) ) else if( IsOnLayer( B_Cu ) )
{ {
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE ); aLayers[aCount++] = LAYER_PAD_BK;
aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ); aLayers[aCount++] = LAYER_PAD_BK_NETNAMES;
} }
// Check non-copper layers. This list should include all the layers that the // Check non-copper layers. This list should include all the layers that the
// footprint editor allows a pad to be placed on. // footprint editor allows a pad to be placed on.
static const LAYER_ID layers_mech[] = { F_Mask, B_Mask, F_Paste, B_Paste, static const PCB_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 }; F_Adhes, B_Adhes, F_SilkS, B_SilkS, Dwgs_User, Eco1_User, Eco2_User };
for( LAYER_ID each_layer : layers_mech ) for( PCB_LAYER_ID each_layer : layers_mech )
{ {
if( IsOnLayer( each_layer ) ) if( IsOnLayer( each_layer ) )
aLayers[aCount++] = each_layer; aLayers[aCount++] = each_layer;
@ -1013,7 +1013,7 @@ const BOX2I D_PAD::ViewBBox() const
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask ) wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
{ {
// Try the single or no- layer case (easy) // Try the single or no- layer case (easy)
LAYER_ID layer = aMask.ExtractLayer(); PCB_LAYER_ID layer = aMask.ExtractLayer();
switch( (int) layer ) switch( (int) layer )
{ {

View File

@ -476,7 +476,7 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
bool IsOnLayer( LAYER_ID aLayer ) const override bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
{ {
return m_layerMask[aLayer]; return m_layerMask[aLayer];
} }

View File

@ -102,8 +102,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
*/ */
BOARD* brd = GetBoard(); BOARD* brd = GetBoard();
bool frontVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_FR_VISIBLE ) ); bool frontVisible = brd->IsElementVisible( LAYER_PAD_FR );
bool backVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_BK_VISIBLE ) ); bool backVisible = brd->IsElementVisible( LAYER_PAD_BK );
if( !frontVisible && !backVisible ) if( !frontVisible && !backVisible )
return; return;
@ -134,12 +134,12 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
if( m_layerMask[F_Cu] ) if( m_layerMask[F_Cu] )
{ {
color = brd->GetVisibleElementColor( PAD_FR_VISIBLE ); color = brd->GetVisibleElementColor( LAYER_PAD_FR );
} }
if( m_layerMask[B_Cu] ) if( m_layerMask[B_Cu] )
{ {
color = color.LegacyMix( brd->GetVisibleElementColor( PAD_BK_VISIBLE ) ); color = color.LegacyMix( brd->GetVisibleElementColor( LAYER_PAD_BK ) );
} }
if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show) if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show)
@ -150,7 +150,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR #ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
mask_non_copper_layers &= brd->GetVisibleLayers(); mask_non_copper_layers &= brd->GetVisibleLayers();
#endif #endif
LAYER_ID pad_layer = mask_non_copper_layers.ExtractLayer(); PCB_LAYER_ID pad_layer = mask_non_copper_layers.ExtractLayer();
switch( (int) pad_layer ) switch( (int) pad_layer )
{ {
@ -177,8 +177,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// when routing tracks // when routing tracks
if( frame->GetToolId() == ID_TRACK_BUTT ) if( frame->GetToolId() == ID_TRACK_BUTT )
{ {
LAYER_ID routeTop = screen->m_Route_Layer_TOP; PCB_LAYER_ID routeTop = screen->m_Route_Layer_TOP;
LAYER_ID routeBot = screen->m_Route_Layer_BOTTOM; PCB_LAYER_ID routeBot = screen->m_Route_Layer_BOTTOM;
// if routing between copper and component layers, // if routing between copper and component layers,
// or the current layer is one of said 2 external copper layers, // or the current layer is one of said 2 external copper layers,
@ -273,17 +273,17 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
DisplayIsol = false; DisplayIsol = false;
if( ( GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED ) && if( ( GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED ) &&
brd->IsElementVisible( NON_PLATED_VISIBLE ) ) brd->IsElementVisible( LAYER_NON_PLATED ) )
{ {
drawInfo.m_ShowNotPlatedHole = true; drawInfo.m_ShowNotPlatedHole = true;
drawInfo.m_NPHoleColor = brd->GetVisibleElementColor( NON_PLATED_VISIBLE ); drawInfo.m_NPHoleColor = brd->GetVisibleElementColor( LAYER_NON_PLATED );
} }
drawInfo.m_DrawMode = aDraw_mode; drawInfo.m_DrawMode = aDraw_mode;
drawInfo.m_Color = color; drawInfo.m_Color = color;
drawInfo.m_DrawPanel = aPanel; drawInfo.m_DrawPanel = aPanel;
drawInfo.m_Mask_margin = mask_margin; drawInfo.m_Mask_margin = mask_margin;
drawInfo.m_ShowNCMark = brd->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) ); drawInfo.m_ShowNCMark = brd->IsElementVisible( LAYER_NO_CONNECTS );
drawInfo.m_IsPrinting = screen->m_IsPrinting; drawInfo.m_IsPrinting = screen->m_IsPrinting;
color.a = 0.666; color.a = 0.666;

View File

@ -41,7 +41,7 @@
#include <class_pcb_layer_box_selector.h> #include <class_pcb_layer_box_selector.h>
// translate aLayer to its hotkey // translate aLayer to its hotkey
static int layer2hotkey_id( LAYER_ID aLayer ) static int layer2hotkey_id( PCB_LAYER_ID aLayer )
{ {
switch( aLayer ) switch( aLayer )
{ {
@ -90,7 +90,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
for( LSEQ seq = show.UIOrder(); seq; ++seq ) for( LSEQ seq = show.UIOrder(); seq; ++seq )
{ {
LAYER_ID layerid = *seq; PCB_LAYER_ID layerid = *seq;
if( !m_showNotEnabledBrdlayers && !activated[layerid] ) if( !m_showNotEnabledBrdlayers && !activated[layerid] )
continue; continue;

View File

@ -37,7 +37,7 @@
#include <confirm.h> #include <confirm.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <pcbstruct.h> // enum PCB_VISIBLE #include <pcbstruct.h>
#include <layer_widget.h> #include <layer_widget.h>
#include <macros.h> #include <macros.h>
#include <menus_helpers.h> #include <menus_helpers.h>
@ -58,32 +58,32 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
#define RR LAYER_WIDGET::ROW // Render Row abbreviation to reduce source width #define RR LAYER_WIDGET::ROW // Render Row abbreviation to reduce source width
// text id color tooltip // text id color tooltip
RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ), RR( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ),
RR( _( "Bl/Buried Via" ), VIA_BBLIND_VISIBLE, WHITE, _( "Show blind or buried vias" ) ), RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ),
RR( _( "Micro Via" ), VIA_MICROVIA_VISIBLE, WHITE, _( "Show micro vias") ), RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ),
RR( _( "Non Plated" ), NON_PLATED_VISIBLE, WHITE, _( "Show non plated holes") ), RR( _( "Non Plated" ), LAYER_NON_PLATED, WHITE, _( "Show non plated holes") ),
RR( _( "Ratsnest" ), RATSNEST_VISIBLE, WHITE, _( "Show unconnected nets as a ratsnest") ), RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ),
RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ), RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ),
RR( _( "Pads Back" ), PAD_BK_VISIBLE, WHITE, _( "Show footprint pads on board's back" ) ), RR( _( "Pads Back" ), LAYER_PAD_BK, WHITE, _( "Show footprint pads on board's back" ) ),
RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's front" ) ), RR( _( "Text Front" ), LAYER_MOD_TEXT_FR, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's front" ) ),
RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's back" ) ), RR( _( "Text Back" ), LAYER_MOD_TEXT_BK, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's back" ) ),
RR( _( "Hidden Text" ), MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ), RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
RR( _( "Anchors" ), ANCHOR_VISIBLE, WHITE, _( "Show footprint and text origins as a cross" ) ), RR( _( "Anchors" ), LAYER_ANCHOR, WHITE, _( "Show footprint and text origins as a cross" ) ),
RR( _( "Grid" ), GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ), RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "No-Connects" ), NO_CONNECTS_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show a marker on pads which have no net connected" ) ), RR( _( "No-Connects" ), LAYER_NO_CONNECTS, COLOR4D::UNSPECIFIED, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "Footprints Front" ), MOD_FR_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's front") ), RR( _( "Footprints Front" ),LAYER_MOD_FR, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's front") ),
RR( _( "Footprints Back" ), MOD_BK_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's back") ), RR( _( "Footprints Back" ), LAYER_MOD_BK, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's back") ),
RR( _( "Values" ), MOD_VALUES_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprint's values") ), RR( _( "Values" ), LAYER_MOD_VALUES, COLOR4D::UNSPECIFIED, _( "Show footprint's values") ),
RR( _( "References" ), MOD_REFERENCES_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprint's references") ), RR( _( "References" ), LAYER_MOD_REFERENCES, COLOR4D::UNSPECIFIED, _( "Show footprint's references") ),
}; };
static int s_allowed_in_FpEditor[] = static int s_allowed_in_FpEditor[] =
{ {
MOD_TEXT_INVISIBLE, PAD_FR_VISIBLE, PAD_BK_VISIBLE, LAYER_MOD_TEXT_INVISIBLE, LAYER_PAD_FR, LAYER_PAD_BK,
GRID_VISIBLE, MOD_VALUES_VISIBLE, MOD_REFERENCES_VISIBLE LAYER_GRID, LAYER_MOD_VALUES, LAYER_MOD_REFERENCES
}; };
@ -131,7 +131,7 @@ bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId )
} }
bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( LAYER_ID aLayer ) bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( PCB_LAYER_ID aLayer )
{ {
static LSET allowed = LSET::AllTechMask(); static LSET allowed = LSET::AllTechMask();
// Currently not in use because putting a graphic item on a copper layer // Currently not in use because putting a graphic item on a copper layer
@ -213,7 +213,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
{ {
bool isLast; bool isLast;
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB ); wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) ); PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
cb->SetValue( visible ); cb->SetValue( visible );
isLast = row == rowCount-1; isLast = row == rowCount-1;
@ -236,7 +236,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row = rowCount-1; row>=0; --row ) for( int row = rowCount-1; row>=0; --row )
{ {
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB ); wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) ); PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )
{ {
@ -249,7 +249,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row=0; row<rowCount; ++row ) for( int row=0; row<rowCount; ++row )
{ {
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB ); wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) ); PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )
{ {
@ -302,10 +302,10 @@ void PCB_LAYER_WIDGET::ReFillRender()
if( renderRow.color != COLOR4D::UNSPECIFIED ) // does this row show a color? if( renderRow.color != COLOR4D::UNSPECIFIED ) // does this row show a color?
{ {
// this window frame must have an established BOARD, i.e. after SetBoard() // this window frame must have an established BOARD, i.e. after SetBoard()
renderRow.color = board->GetVisibleElementColor( renderRow.id ); renderRow.color = board->GetVisibleElementColor( static_cast<GAL_LAYER_ID>( renderRow.id ) );
} }
renderRow.state = board->IsElementVisible( renderRow.id ); renderRow.state = board->IsElementVisible( static_cast<GAL_LAYER_ID>( renderRow.id ) );
AppendRenderRow( renderRow ); AppendRenderRow( renderRow );
} }
@ -324,7 +324,7 @@ void PCB_LAYER_WIDGET::SyncRenderStates()
continue; continue;
// this does not fire a UI event // this does not fire a UI event
SetRenderState( rowId, board->IsElementVisible( rowId ) ); SetRenderState( rowId, board->IsElementVisible( static_cast<GAL_LAYER_ID>( rowId ) ) );
} }
} }
@ -341,7 +341,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE ); wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE );
LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) ); PCB_LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
// this does not fire a UI event // this does not fire a UI event
SetLayerVisible( layerId, board->IsLayerVisible( layerId ) ); SetLayerVisible( layerId, board->IsLayerVisible( layerId ) );
@ -361,7 +361,7 @@ void PCB_LAYER_WIDGET::ReFill()
// show all coppers first, with front on top, back on bottom, then technical layers // show all coppers first, with front on top, back on bottom, then technical layers
for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack ) for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack )
{ {
LAYER_ID layer = *cu_stack; PCB_LAYER_ID layer = *cu_stack;
switch( layer ) switch( layer )
{ {
@ -395,7 +395,7 @@ void PCB_LAYER_WIDGET::ReFill()
// Because they are static, wxGetTranslation must be explicitly // Because they are static, wxGetTranslation must be explicitly
// called for tooltips. // called for tooltips.
static const struct { static const struct {
LAYER_ID layerId; PCB_LAYER_ID layerId;
wxString tooltip; wxString tooltip;
} non_cu_seq[] = { } non_cu_seq[] = {
{ F_Adhes, _( "Adhesive on board's front" ) }, { F_Adhes, _( "Adhesive on board's front" ) },
@ -420,7 +420,7 @@ void PCB_LAYER_WIDGET::ReFill()
for( unsigned i=0; i<DIM( non_cu_seq ); ++i ) for( unsigned i=0; i<DIM( non_cu_seq ); ++i )
{ {
LAYER_ID layer = non_cu_seq[i].layerId; PCB_LAYER_ID layer = non_cu_seq[i].layerId;
if( !enabled[layer] ) if( !enabled[layer] )
continue; continue;
@ -463,7 +463,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
{ {
// the layer change from the PCB_LAYER_WIDGET can be denied by returning // the layer change from the PCB_LAYER_WIDGET can be denied by returning
// false from this function. // false from this function.
LAYER_ID layer = ToLAYER_ID( aLayer ); PCB_LAYER_ID layer = ToLAYER_ID( aLayer );
if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) ) if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
return false; return false;
@ -517,7 +517,8 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor ) void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
{ {
myframe->GetBoard()->SetVisibleElementColor( aId, aColor ); wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
myframe->GetBoard()->SetVisibleElementColor( static_cast<GAL_LAYER_ID>( aId ), aColor );
if( myframe->GetGalCanvas() ) if( myframe->GetGalCanvas() )
{ {
@ -533,28 +534,29 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{ {
BOARD* brd = myframe->GetBoard(); BOARD* brd = myframe->GetBoard();
wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
LSET visibleLayers = brd->GetVisibleLayers(); LSET visibleLayers = brd->GetVisibleLayers();
visibleLayers.set( aId, isEnabled ); visibleLayers.set( aId, isEnabled );
// The layer visibility status is saved in the board file so set the board modified // The layer visibility status is saved in the board file so set the board modified
// state so the user has the option to save the changes. // state so the user has the option to save the changes.
if( brd->IsElementVisible( aId ) != isEnabled ) if( brd->IsElementVisible( static_cast<GAL_LAYER_ID>( aId ) ) != isEnabled )
myframe->OnModify(); myframe->OnModify();
brd->SetElementVisibility( aId, isEnabled ); brd->SetElementVisibility( static_cast<GAL_LAYER_ID>( aId ), isEnabled );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas ) if( galCanvas )
{ {
if( aId == GRID_VISIBLE ) if( aId == LAYER_GRID )
{ {
galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() ); galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
} }
else else
galCanvas->GetView()->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled ); galCanvas->GetView()->SetLayerVisible( aId , isEnabled );
} }
if( galCanvas && myframe->IsGalCanvasActive() ) if( galCanvas && myframe->IsGalCanvasActive() )

View File

@ -141,10 +141,10 @@ protected:
* listed layer can be reachable in the graphic item properties dialog. * listed layer can be reachable in the graphic item properties dialog.
* *
* @param aLayer is the layer id to test * @param aLayer is the layer id to test
* @return true if LAYER_ID aLayer has meaning in footprint editor mode. * @return true if PCB_LAYER_ID aLayer has meaning in footprint editor mode.
* and therefore is shown in render panel * and therefore is shown in render panel
*/ */
bool isLayerAllowedInFpMode( LAYER_ID aLayer ); bool isLayerAllowedInFpMode( PCB_LAYER_ID aLayer );
/** /**
* Function OnRightDownLayers * Function OnRightDownLayers

View File

@ -87,7 +87,7 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
// shade text if high contrast mode is active // shade text if high contrast mode is active
if( ( DrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay ) if( ( DrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay )
{ {
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) ) if( !IsOnLayer( curr_layer ) )
color = COLOR4D( DARKDARKGRAY ); color = COLOR4D( DARKDARKGRAY );
@ -95,8 +95,8 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
COLOR4D anchor_color = COLOR4D::UNSPECIFIED; COLOR4D anchor_color = COLOR4D::UNSPECIFIED;
if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) if( brd->IsElementVisible( LAYER_ANCHOR ) )
anchor_color = brd->GetVisibleElementColor( ANCHOR_VISIBLE ); anchor_color = brd->GetVisibleElementColor( LAYER_ANCHOR );
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
EDA_TEXT::Draw( clipbox, DC, offset, color, EDA_TEXT::Draw( clipbox, DC, offset, color,

View File

@ -224,21 +224,21 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod
BOARD* brd = GetBoard( ); BOARD* brd = GetBoard( );
COLOR4D color = brd->GetLayerColor( GetLayer() ); COLOR4D color = brd->GetLayerColor( GetLayer() );
LAYER_ID text_layer = GetLayer(); PCB_LAYER_ID text_layer = GetLayer();
if( !brd->IsLayerVisible( m_Layer ) if( !brd->IsLayerVisible( m_Layer )
|| (IsFrontLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE )) || ( IsFrontLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_FR ) )
|| (IsBackLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE )) ) || ( IsBackLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_BK ) ) )
return; return;
// Invisible texts are still drawn (not plotted) in MOD_TEXT_INVISIBLE // Invisible texts are still drawn (not plotted) in LAYER_MOD_TEXT_INVISIBLE
// Just because we must have to edit them (at least to make them visible) // Just because we must have to edit them (at least to make them visible)
if( !IsVisible() ) if( !IsVisible() )
{ {
if( !brd->IsElementVisible( MOD_TEXT_INVISIBLE ) ) if( !brd->IsElementVisible( LAYER_MOD_TEXT_INVISIBLE ) )
return; return;
color = brd->GetVisibleElementColor( MOD_TEXT_INVISIBLE ); color = brd->GetVisibleElementColor( LAYER_MOD_TEXT_INVISIBLE );
} }
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions(); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions();
@ -246,7 +246,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod
// shade text if high contrast mode is active // shade text if high contrast mode is active
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay ) if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay )
{ {
LAYER_ID curr_layer = ( (PCB_SCREEN*) aPanel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) aPanel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) ) if( !IsOnLayer( curr_layer ) )
color = COLOR4D( DARKDARKGRAY ); color = COLOR4D( DARKDARKGRAY );
@ -262,9 +262,9 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod
wxPoint pos = GetTextPos() - aOffset; wxPoint pos = GetTextPos() - aOffset;
// Draw the text anchor point // Draw the text anchor point
if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) if( brd->IsElementVisible( LAYER_ANCHOR ) )
{ {
COLOR4D anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE); COLOR4D anchor_color = brd->GetVisibleElementColor( LAYER_ANCHOR );
GRDrawAnchor( aPanel->GetClipBox(), aDC, pos.x, pos.y, DIM_ANCRE_TEXTE, anchor_color ); GRDrawAnchor( aPanel->GetClipBox(), aDC, pos.x, pos.y, DIM_ANCRE_TEXTE, anchor_color );
} }
@ -433,11 +433,11 @@ const BOX2I TEXTE_MODULE::ViewBBox() const
void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
if( !IsVisible() ) // Hidden text if( !IsVisible() ) // Hidden text
aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_INVISIBLE ); aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
//else if( IsFrontLayer( m_Layer ) ) //else if( IsFrontLayer( m_Layer ) )
//aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ); //aLayers[0] = LAYER_MOD_TEXT_FR;
//else if( IsBackLayer( m_Layer ) ) //else if( IsBackLayer( m_Layer ) )
//aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ); //aLayers[0] = LAYER_MOD_TEXT_BK;
else else
aLayers[0] = GetLayer(); aLayers[0] = GetLayer();
@ -452,18 +452,18 @@ unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
if( !aView ) if( !aView )
return 0; return 0;
if( m_Type == TEXT_is_VALUE && !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ) ) ) if( m_Type == TEXT_is_VALUE && !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
return MAX; return MAX;
if( m_Type == TEXT_is_REFERENCE && !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE ) ) ) if( m_Type == TEXT_is_REFERENCE && !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
return MAX; return MAX;
if( IsFrontLayer( m_Layer ) && ( !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ) ) || if( IsFrontLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_FR ) ||
!aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ) ) ) !aView->IsLayerVisible( LAYER_MOD_FR ) ) )
return MAX; return MAX;
if( IsBackLayer( m_Layer ) && ( !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ) ) || if( IsBackLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_BK ) ||
!aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ) ) ) !aView->IsLayerVisible( LAYER_MOD_BK ) ) )
return MAX; return MAX;
return 0; return 0;

View File

@ -196,8 +196,8 @@ wxString VIA::GetSelectMenuText() const
wxString netname = GetNetname(); wxString netname = GetNetname();
// say which layers, only two for now // say which layers, only two for now
LAYER_ID topLayer; PCB_LAYER_ID topLayer;
LAYER_ID botLayer; PCB_LAYER_ID botLayer;
LayerPair( &topLayer, &botLayer ); LayerPair( &topLayer, &botLayer );
text.Printf( format.GetData(), GetChars( ShowWidth() ), text.Printf( format.GetData(), GetChars( ShowWidth() ),
GetChars( netname ), GetNetCode(), GetChars( netname ), GetNetCode(),
@ -364,8 +364,8 @@ void VIA::Flip( const wxPoint& aCentre )
if( GetViaType() != VIA_THROUGH ) if( GetViaType() != VIA_THROUGH )
{ {
int copperLayerCount = GetBoard()->GetCopperLayerCount(); int copperLayerCount = GetBoard()->GetCopperLayerCount();
LAYER_ID top_layer; PCB_LAYER_ID top_layer;
LAYER_ID bottom_layer; PCB_LAYER_ID bottom_layer;
LayerPair( &top_layer, &bottom_layer ); LayerPair( &top_layer, &bottom_layer );
top_layer = FlipLayer( top_layer, copperLayerCount ); top_layer = FlipLayer( top_layer, copperLayerCount );
bottom_layer = FlipLayer( bottom_layer, copperLayerCount ); bottom_layer = FlipLayer( bottom_layer, copperLayerCount );
@ -390,9 +390,9 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
} }
bool VIA::IsOnLayer( LAYER_ID layer_number ) const bool VIA::IsOnLayer( PCB_LAYER_ID layer_number ) const
{ {
LAYER_ID bottom_layer, top_layer; PCB_LAYER_ID bottom_layer, top_layer;
LayerPair( &top_layer, &bottom_layer ); LayerPair( &top_layer, &bottom_layer );
@ -416,7 +416,7 @@ LSET VIA::GetLayerSet() const
wxASSERT( m_Layer <= m_BottomLayer ); wxASSERT( m_Layer <= m_BottomLayer );
// LAYER_IDs are numbered from front to back, this is top to bottom. // PCB_LAYER_IDs are numbered from front to back, this is top to bottom.
for( LAYER_NUM id = m_Layer; id <= m_BottomLayer; ++id ) for( LAYER_NUM id = m_Layer; id <= m_BottomLayer; ++id )
{ {
layermask.set( id ); layermask.set( id );
@ -426,7 +426,7 @@ LSET VIA::GetLayerSet() const
} }
void VIA::SetLayerPair( LAYER_ID aTopLayer, LAYER_ID aBottomLayer ) void VIA::SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer )
{ {
if( GetViaType() == VIA_THROUGH ) if( GetViaType() == VIA_THROUGH )
{ {
@ -442,10 +442,10 @@ void VIA::SetLayerPair( LAYER_ID aTopLayer, LAYER_ID aBottomLayer )
} }
void VIA::LayerPair( LAYER_ID* top_layer, LAYER_ID* bottom_layer ) const void VIA::LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const
{ {
LAYER_ID t_layer = F_Cu; PCB_LAYER_ID t_layer = F_Cu;
LAYER_ID b_layer = B_Cu; PCB_LAYER_ID b_layer = B_Cu;
if( GetViaType() != VIA_THROUGH ) if( GetViaType() != VIA_THROUGH )
{ {
@ -613,7 +613,7 @@ void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel,
} }
} }
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( ( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) if( ( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE )
&& ( !(!IsOnLayer( curr_layer )&& displ_opts->m_ContrastModeDisplay) ) ) && ( !(!IsOnLayer( curr_layer )&& displ_opts->m_ContrastModeDisplay) ) )
@ -652,7 +652,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay ) if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )
{ {
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) ) if( !IsOnLayer( curr_layer ) )
color = COLOR4D( DARKDARKGRAY ); color = COLOR4D( DARKDARKGRAY );
@ -720,7 +720,7 @@ void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay ) if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )
{ {
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) ) if( !IsOnLayer( curr_layer ) )
color = COLOR4D( DARKDARKGRAY ); color = COLOR4D( DARKDARKGRAY );
@ -783,7 +783,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
wxCHECK_RET( panel != NULL, wxT( "VIA::Draw panel cannot be NULL." ) ); wxCHECK_RET( panel != NULL, wxT( "VIA::Draw panel cannot be NULL." ) );
int radius; int radius;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int fillvia = 0; int fillvia = 0;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
@ -796,9 +796,9 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
BOARD * brd = GetBoard(); BOARD * brd = GetBoard();
COLOR4D color = brd->GetVisibleElementColor( VIAS_VISIBLE + GetViaType() ); COLOR4D color = brd->GetVisibleElementColor( LAYER_VIAS + GetViaType() );
if( brd->IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + GetViaType()) ) == false if( brd->IsElementVisible( LAYER_VIAS + GetViaType() ) == false
&& !( aDrawMode & GR_HIGHLIGHT ) ) && !( aDrawMode & GR_HIGHLIGHT ) )
return; return;
@ -929,7 +929,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
if( GetViaType() == VIA_BLIND_BURIED ) if( GetViaType() == VIA_BLIND_BURIED )
{ {
int ax = 0, ay = radius, bx = 0, by = drill_radius; int ax = 0, ay = radius, bx = 0, by = drill_radius;
LAYER_ID layer_top, layer_bottom; PCB_LAYER_ID layer_top, layer_bottom;
LayerPair( &layer_top, &layer_bottom ); LayerPair( &layer_top, &layer_bottom );
@ -990,25 +990,25 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
void VIA::ViewGetLayers( int aLayers[], int& aCount ) const void VIA::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aLayers[0] = ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ); aLayers[0] = LAYER_VIAS_HOLES;
aCount = 2; aCount = 2;
// Just show it on common via & via holes layers // Just show it on common via & via holes layers
switch( GetViaType() ) switch( GetViaType() )
{ {
case VIA_THROUGH: case VIA_THROUGH:
aLayers[1] = ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ); aLayers[1] = LAYER_VIA_THROUGH;
break; break;
case VIA_BLIND_BURIED: case VIA_BLIND_BURIED:
aLayers[1] = ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE ); aLayers[1] = LAYER_VIA_BBLIND;
aLayers[2] = m_Layer; aLayers[2] = m_Layer;
aLayers[3] = m_BottomLayer; aLayers[3] = m_BottomLayer;
aCount += 2; aCount += 2;
break; break;
case VIA_MICROVIA: case VIA_MICROVIA:
aLayers[1] = ITEM_GAL_LAYER( VIA_MICROVIA_VISIBLE ); aLayers[1] = LAYER_VIA_MICROVIA;
break; break;
default: default:
@ -1213,7 +1213,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
// Display layer pair // Display layer pair
LAYER_ID top_layer, bottom_layer; PCB_LAYER_ID top_layer, bottom_layer;
LayerPair( &top_layer, &bottom_layer ); LayerPair( &top_layer, &bottom_layer );
@ -1312,7 +1312,7 @@ bool VIA::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
} }
VIA* TRACK::GetVia( const wxPoint& aPosition, LAYER_ID aLayer) VIA* TRACK::GetVia( const wxPoint& aPosition, PCB_LAYER_ID aLayer)
{ {
for( VIA* via = GetFirstVia( this ); via; via = GetFirstVia( via->Next() ) ) for( VIA* via = GetFirstVia( this ); via; via = GetFirstVia( via->Next() ) )
{ {

View File

@ -45,6 +45,7 @@ class MSG_PANEL_ITEM;
// Via types // Via types
// Note that this enum must be synchronized to GAL_LAYER_ID
enum VIATYPE_T enum VIATYPE_T
{ {
VIA_THROUGH = 3, /* Always a through hole via */ VIA_THROUGH = 3, /* Always a through hole via */
@ -232,7 +233,7 @@ public:
* @param aLayer The layer to match, pass -1 for a don't care. * @param aLayer The layer to match, pass -1 for a don't care.
* @return A pointer to a VIA object if found, else NULL. * @return A pointer to a VIA object if found, else NULL.
*/ */
VIA* GetVia( const wxPoint& aPosition, LAYER_ID aLayer = UNDEFINED_LAYER ); VIA* GetVia( const wxPoint& aPosition, PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
/** /**
* Function GetVia * Function GetVia
@ -390,7 +391,7 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset ) override; GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset ) override;
bool IsOnLayer( LAYER_ID aLayer ) const override; bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
virtual LSET GetLayerSet() const override; virtual LSET GetLayerSet() const override;
@ -401,7 +402,7 @@ public:
* @param aTopLayer = first layer connected by the via * @param aTopLayer = first layer connected by the via
* @param aBottomLayer = last layer connected by the via * @param aBottomLayer = last layer connected by the via
*/ */
void SetLayerPair( LAYER_ID aTopLayer, LAYER_ID aBottomLayer ); void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
/** /**
* Function LayerPair * Function LayerPair
@ -410,7 +411,7 @@ public:
* @param top_layer = pointer to the first layer (can be null) * @param top_layer = pointer to the first layer (can be null)
* @param bottom_layer = pointer to the last layer (can be null) * @param bottom_layer = pointer to the last layer (can be null)
*/ */
void LayerPair( LAYER_ID* top_layer, LAYER_ID* bottom_layer ) const; void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
const wxPoint& GetPosition() const override { return m_Start; } const wxPoint& GetPosition() const override { return m_Start; }
void SetPosition( const wxPoint& aPoint ) override { m_Start = aPoint; m_End = aPoint; } void SetPosition( const wxPoint& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
@ -481,7 +482,7 @@ protected:
private: private:
/// The bottom layer of the via (the top layer is in m_Layer) /// The bottom layer of the via (the top layer is in m_Layer)
LAYER_ID m_BottomLayer; PCB_LAYER_ID m_BottomLayer;
VIATYPE_T m_ViaType; // Type of via VIATYPE_T m_ViaType; // Type of via

View File

@ -183,7 +183,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod
return; return;
wxPoint seg_start, seg_end; wxPoint seg_start, seg_end;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard(); BOARD* brd = GetBoard();
COLOR4D color = brd->GetLayerColor( m_Layer ); COLOR4D color = brd->GetLayerColor( m_Layer );
@ -257,7 +257,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
return; return;
BOARD* brd = GetBoard(); BOARD* brd = GetBoard();
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
COLOR4D color = brd->GetLayerColor( m_Layer ); COLOR4D color = brd->GetLayerColor( m_Layer );
if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
@ -382,7 +382,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,
if( !DC ) if( !DC )
return; return;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard(); BOARD* brd = GetBoard();
COLOR4D color = brd->GetLayerColor( m_Layer ); COLOR4D color = brd->GetLayerColor( m_Layer );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();

View File

@ -64,7 +64,7 @@ public:
int m_ZoneMinThickness; ///< Min thickness value in filled areas int m_ZoneMinThickness; ///< Min thickness value in filled areas
int m_NetcodeSelection; ///< Net code selection for the current zone int m_NetcodeSelection; ///< Net code selection for the current zone
LAYER_ID m_CurrentZone_Layer; ///< Layer used to create the current zone PCB_LAYER_ID m_CurrentZone_Layer; ///< Layer used to create the current zone
/// Option to show the zone area (outlines only, short hatches or full hatches /// Option to show the zone area (outlines only, short hatches or full hatches
int m_Zone_HatchingStyle; int m_Zone_HatchingStyle;

View File

@ -403,7 +403,7 @@ const ZONE_CONTAINER* TRACKS_CLEANER::zoneForTrackEndpoint( const TRACK* aTrack,
ENDPOINT_T aEndPoint ) ENDPOINT_T aEndPoint )
{ {
// Vias are special cased, since they get a layer range, not a single one // Vias are special cased, since they get a layer range, not a single one
LAYER_ID top_layer, bottom_layer; PCB_LAYER_ID top_layer, bottom_layer;
const VIA* via = dyn_cast<const VIA*>( aTrack ); const VIA* via = dyn_cast<const VIA*>( aTrack );
if( via ) if( via )

View File

@ -380,7 +380,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) ||
m_Guide->IgnorePreferredLayer() ) m_Guide->IgnorePreferredLayer() )
{ {
LAYER_ID layer = item->GetLayer(); PCB_LAYER_ID layer = item->GetLayer();
/* Modules and their subcomponents: reference, value and pads /* Modules and their subcomponents: reference, value and pads
* are not sensitive to the layer visibility controls. They all * are not sensitive to the layer visibility controls. They all
@ -413,7 +413,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
// no effect on other criteria, since there is a separate "ignore" control for // no effect on other criteria, since there is a separate "ignore" control for
// those in the COLLECTORS_GUIDE // those in the COLLECTORS_GUIDE
LAYER_ID layer = item->GetLayer(); PCB_LAYER_ID layer = item->GetLayer();
/* Modules and their subcomponents: reference, value and pads /* Modules and their subcomponents: reference, value and pads
* are not sensitive to the layer visibility controls. They all * are not sensitive to the layer visibility controls. They all

View File

@ -71,13 +71,13 @@ public:
* Function IsLayerLocked * Function IsLayerLocked
* @return bool - true if the given layer is locked, else false. * @return bool - true if the given layer is locked, else false.
*/ */
virtual bool IsLayerLocked( LAYER_ID layer ) const = 0; virtual bool IsLayerLocked( PCB_LAYER_ID layer ) const = 0;
/** /**
* Function IsLayerVisible * Function IsLayerVisible
* @return bool - true if the given layer is visible, else false. * @return bool - true if the given layer is visible, else false.
*/ */
virtual bool IsLayerVisible( LAYER_ID layer ) const = 0; virtual bool IsLayerVisible( PCB_LAYER_ID layer ) const = 0;
/** /**
* Function IgnoreLockedLayers * Function IgnoreLockedLayers
@ -95,7 +95,7 @@ public:
* Function GetPreferredLayer * Function GetPreferredLayer
* @return int - the preferred layer for HitTest()ing. * @return int - the preferred layer for HitTest()ing.
*/ */
virtual LAYER_ID GetPreferredLayer() const = 0; virtual PCB_LAYER_ID GetPreferredLayer() const = 0;
/** /**
* Function IgnorePreferredLayer * Function IgnorePreferredLayer
@ -381,7 +381,7 @@ private:
// the storage architecture here is not important, since this is only // the storage architecture here is not important, since this is only
// a carrier object and its functions are what is used, and data only indirectly. // a carrier object and its functions are what is used, and data only indirectly.
LAYER_ID m_PreferredLayer; PCB_LAYER_ID m_PreferredLayer;
bool m_IgnorePreferredLayer; bool m_IgnorePreferredLayer;
LSET m_LayerLocked; ///< bit-mapped layer locked bits LSET m_LayerLocked; ///< bit-mapped layer locked bits
@ -412,7 +412,7 @@ public:
* @param aVisibleLayerMask = current visible layers (bit mask) * @param aVisibleLayerMask = current visible layers (bit mask)
* @param aPreferredLayer = the layer to search first * @param aPreferredLayer = the layer to search first
*/ */
GENERAL_COLLECTORS_GUIDE( LSET aVisibleLayerMask, LAYER_ID aPreferredLayer ) GENERAL_COLLECTORS_GUIDE( LSET aVisibleLayerMask, PCB_LAYER_ID aPreferredLayer )
{ {
m_PreferredLayer = aPreferredLayer; m_PreferredLayer = aPreferredLayer;
m_IgnorePreferredLayer = false; m_IgnorePreferredLayer = false;
@ -445,12 +445,12 @@ public:
* Function IsLayerLocked * Function IsLayerLocked
* @return bool - true if the given layer is locked, else false. * @return bool - true if the given layer is locked, else false.
*/ */
bool IsLayerLocked( LAYER_ID aLayerId ) const override bool IsLayerLocked( PCB_LAYER_ID aLayerId ) const override
{ {
return m_LayerLocked[aLayerId]; return m_LayerLocked[aLayerId];
} }
void SetLayerLocked( LAYER_ID aLayerId, bool isLocked ) void SetLayerLocked( PCB_LAYER_ID aLayerId, bool isLocked )
{ {
m_LayerLocked.set( aLayerId, isLocked ); m_LayerLocked.set( aLayerId, isLocked );
} }
@ -459,11 +459,11 @@ public:
* Function IsLayerVisible * Function IsLayerVisible
* @return bool - true if the given layer is visible, else false. * @return bool - true if the given layer is visible, else false.
*/ */
bool IsLayerVisible( LAYER_ID aLayerId ) const override bool IsLayerVisible( PCB_LAYER_ID aLayerId ) const override
{ {
return m_LayerVisible[aLayerId]; return m_LayerVisible[aLayerId];
} }
void SetLayerVisible( LAYER_ID aLayerId, bool isVisible ) void SetLayerVisible( PCB_LAYER_ID aLayerId, bool isVisible )
{ {
m_LayerVisible.set( aLayerId, isVisible ); m_LayerVisible.set( aLayerId, isVisible );
} }
@ -489,8 +489,8 @@ public:
* Function GetPreferredLayer * Function GetPreferredLayer
* @return int - the preferred layer for HitTest()ing. * @return int - the preferred layer for HitTest()ing.
*/ */
LAYER_ID GetPreferredLayer() const override { return m_PreferredLayer; } PCB_LAYER_ID GetPreferredLayer() const override { return m_PreferredLayer; }
void SetPreferredLayer( LAYER_ID aLayer ) { m_PreferredLayer = aLayer; } void SetPreferredLayer( PCB_LAYER_ID aLayer ) { m_PreferredLayer = aLayer; }
/** /**

View File

@ -51,7 +51,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
{ {
if( g_CurrentTrackList.GetCount() > 0 ) if( g_CurrentTrackList.GetCount() > 0 )
{ {
LAYER_ID previous_layer = GetActiveLayer(); PCB_LAYER_ID previous_layer = GetActiveLayer();
DBG( g_CurrentTrackList.VerifyListIntegrity(); ) DBG( g_CurrentTrackList.VerifyListIntegrity(); )

View File

@ -62,7 +62,7 @@ private:
LSET m_printMaskLayer; LSET m_printMaskLayer;
// the list of existing board layers in wxCheckListBox, with the // the list of existing board layers in wxCheckListBox, with the
// board layers id: // board layers id:
std::pair<wxCheckListBox*, int> m_boxSelectLayer[LAYER_ID_COUNT]; std::pair<wxCheckListBox*, int> m_boxSelectLayer[PCB_LAYER_ID_COUNT];
bool m_printBW; bool m_printBW;
wxString m_outputDirectory; wxString m_outputDirectory;
bool m_printMirror; bool m_printMirror;
@ -160,7 +160,7 @@ void DIALOG_SVG_PRINT::initDialog()
for( ; seq; ++seq ) for( ; seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
int checkIndex; int checkIndex;
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )
@ -286,7 +286,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
for( LSEQ seq = all_selected.Seq(); seq; ++seq ) for( LSEQ seq = all_selected.Seq(); seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
wxFileName fn( boardFilename ); wxFileName fn( boardFilename );

View File

@ -71,7 +71,7 @@ private:
long m_NetFiltering; long m_NetFiltering;
std::vector<LAYER_ID> m_LayerId; ///< Handle the real layer number from layer std::vector<PCB_LAYER_ID> m_LayerId; ///< Handle the real layer number from layer
///< name position in m_LayerSelectionCtrl ///< name position in m_LayerSelectionCtrl
static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*"). static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*").
@ -245,7 +245,7 @@ void DIALOG_COPPER_ZONE::initDialog()
for( LSEQ cu_stack = cu_set.UIOrder(); cu_stack; ++cu_stack, imgIdx++ ) for( LSEQ cu_stack = cu_set.UIOrder(); cu_stack; ++cu_stack, imgIdx++ )
{ {
LAYER_ID layer = *cu_stack; PCB_LAYER_ID layer = *cu_stack;
m_LayerId.push_back( layer ); m_LayerId.push_back( layer );

View File

@ -99,7 +99,7 @@ bool DIALOG_DISPLAY_OPTIONS::TransferDataToWindow()
m_OptDisplayModOutlines->SetValue( displ_opts->m_DisplayModEdgeFill == SKETCH ); m_OptDisplayModOutlines->SetValue( displ_opts->m_DisplayModEdgeFill == SKETCH );
m_OptDisplayPadClearence->SetValue( displ_opts->m_DisplayPadIsol ); m_OptDisplayPadClearence->SetValue( displ_opts->m_DisplayPadIsol );
m_OptDisplayPadNumber->SetValue( displ_opts->m_DisplayPadNum ); m_OptDisplayPadNumber->SetValue( displ_opts->m_DisplayPadNum );
m_OptDisplayPadNoConn->SetValue( m_parent->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) ) ); m_OptDisplayPadNoConn->SetValue( m_parent->IsElementVisible( LAYER_NO_CONNECTS ) );
m_OptDisplayDrawings->SetValue( displ_opts->m_DisplayDrawItemsFill == SKETCH ); m_OptDisplayDrawings->SetValue( displ_opts->m_DisplayDrawItemsFill == SKETCH );
m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode ); m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode );
@ -133,7 +133,7 @@ bool DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow()
displ_opts->m_DisplayPadNum = m_OptDisplayPadNumber->GetValue(); displ_opts->m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
m_parent->SetElementVisibility( PCB_VISIBLE( NO_CONNECTS_VISIBLE ), m_parent->SetElementVisibility( LAYER_NO_CONNECTS,
m_OptDisplayPadNoConn->GetValue() ); m_OptDisplayPadNoConn->GetValue() );
displ_opts->m_DisplayDrawItemsFill = not m_OptDisplayDrawings->GetValue(); displ_opts->m_DisplayDrawItemsFill = not m_OptDisplayDrawings->GetValue();

View File

@ -123,7 +123,7 @@ void DIALOG_EXCHANGE_MODULE::OnOkClick( wxCommandEvent& event )
if( result ) if( result )
{ {
if( m_parent->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) if( m_parent->GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
m_parent->Compile_Ratsnest( NULL, true ); m_parent->Compile_Ratsnest( NULL, true );
m_parent->GetCanvas()->Refresh(); m_parent->GetCanvas()->Refresh();

View File

@ -75,7 +75,7 @@ void DIALOG_GENERALOPTIONS::init()
m_MaxShowLinks->SetValue( displ_opts->m_MaxLinksShowed ); m_MaxShowLinks->SetValue( displ_opts->m_MaxLinksShowed );
m_DrcOn->SetValue( g_Drc_On ); m_DrcOn->SetValue( g_Drc_On );
m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible( RATSNEST_VISIBLE ) ); m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible( LAYER_RATSNEST ) );
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack ); m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed ); m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed );
m_Segments_45_Only_Ctrl->SetValue( g_Segments_45_Only ); m_Segments_45_Only_Ctrl->SetValue( g_Segments_45_Only );
@ -113,9 +113,9 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
displ_opts->m_MaxLinksShowed = m_MaxShowLinks->GetValue(); displ_opts->m_MaxLinksShowed = m_MaxShowLinks->GetValue();
g_Drc_On = m_DrcOn->GetValue(); g_Drc_On = m_DrcOn->GetValue();
if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() ) if( m_Board->IsElementVisible( LAYER_RATSNEST ) != m_ShowGlobalRatsnest->GetValue() )
{ {
GetParent()->SetElementVisibility( RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() ); GetParent()->SetElementVisibility( LAYER_RATSNEST, m_ShowGlobalRatsnest->GetValue() );
GetParent()->GetCanvas()->Refresh(); GetParent()->GetCanvas()->Refresh();
GetParent()->OnModify(); GetParent()->OnModify();
} }

View File

@ -159,7 +159,7 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog()
for( LSEQ cu_stack = show.UIOrder(); cu_stack; ++cu_stack, imgIdx++ ) for( LSEQ cu_stack = show.UIOrder(); cu_stack; ++cu_stack, imgIdx++ )
{ {
LAYER_ID layer = *cu_stack; PCB_LAYER_ID layer = *cu_stack;
m_layerId.push_back( layer ); m_layerId.push_back( layer );

View File

@ -73,7 +73,7 @@ static LSEQ dlg_layers()
{ {
// layers that are put out into the dialog UI, coordinate with wxformbuilder and // layers that are put out into the dialog UI, coordinate with wxformbuilder and
// getCTLs( LAYER_NUM aLayerNumber ) // getCTLs( LAYER_NUM aLayerNumber )
static const LAYER_ID layers[] = { static const PCB_LAYER_ID layers[] = {
F_CrtYd, F_CrtYd,
F_Fab, F_Fab,
F_Adhes, F_Adhes,
@ -396,7 +396,7 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames()
for( LSEQ seq = dlg_layers(); seq; ++seq ) for( LSEQ seq = dlg_layers(); seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
wxControl* ctl = getName( layer ); wxControl* ctl = getName( layer );
@ -421,7 +421,7 @@ void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( LSET enabledLayers )
// the check boxes // the check boxes
for( LSEQ seq = dlg_layers(); seq; ++seq ) for( LSEQ seq = dlg_layers(); seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
setLayerCheckBox( layer, enabledLayers[layer] ); setLayerCheckBox( layer, enabledLayers[layer] );
} }
} }
@ -448,7 +448,7 @@ void DIALOG_LAYERS_SETUP::showLayerTypes()
{ {
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq ) for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{ {
LAYER_ID cu_layer = *seq; PCB_LAYER_ID cu_layer = *seq;
wxChoice* ctl = getChoice( cu_layer ); wxChoice* ctl = getChoice( cu_layer );
ctl->SetSelection( m_pcb->GetLayerType( cu_layer ) ); ctl->SetSelection( m_pcb->GetLayerType( cu_layer ) );
@ -462,7 +462,7 @@ LSET DIALOG_LAYERS_SETUP::getUILayerMask()
for( LSEQ seq = dlg_layers(); seq; ++seq ) for( LSEQ seq = dlg_layers(); seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
wxCheckBox* ctl = getCheckBox( layer ); wxCheckBox* ctl = getCheckBox( layer );
if( ctl->GetValue() ) if( ctl->GetValue() )
@ -498,7 +498,7 @@ void DIALOG_LAYERS_SETUP::setCopperLayerCheckBoxes( int copperCount )
for( LSEQ seq = LSET::InternalCuMask().Seq(); seq; ++seq, --copperCount ) for( LSEQ seq = LSET::InternalCuMask().Seq(); seq; ++seq, --copperCount )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
bool state = copperCount > 0; bool state = copperCount > 0;
#ifdef HIDE_INACTIVE_LAYERS #ifdef HIDE_INACTIVE_LAYERS
@ -607,7 +607,7 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq ) for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
if( m_enabledLayers[layer] ) if( m_enabledLayers[layer] )
{ {
@ -671,7 +671,7 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq ) for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
// we _can_ rely on m_enabledLayers being current here: // we _can_ rely on m_enabledLayers being current here:
if( !m_enabledLayers[layer] ) if( !m_enabledLayers[layer] )

View File

@ -143,7 +143,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
LAYER_ID lyrSelect = m_parent->GetActiveLayer(); PCB_LAYER_ID lyrSelect = m_parent->GetActiveLayer();
if( m_zone ) if( m_zone )
lyrSelect = m_zone->GetLayer(); lyrSelect = m_zone->GetLayer();
@ -153,7 +153,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++imgIdx ) for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++imgIdx )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
COLOR4D layerColor = board->GetLayerColor( layer ); COLOR4D layerColor = board->GetLayerColor( layer );
imageList->Add( makeLayerBitmap( layerColor ) ); imageList->Add( makeLayerBitmap( layerColor ) );

View File

@ -171,12 +171,12 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
if( m_dummyPad->GetLayerSet()[F_Cu] ) if( m_dummyPad->GetLayerSet()[F_Cu] )
{ {
color = m_board->GetVisibleElementColor( PAD_FR_VISIBLE ); color = m_board->GetVisibleElementColor( LAYER_PAD_FR );
} }
if( m_dummyPad->GetLayerSet()[B_Cu] ) if( m_dummyPad->GetLayerSet()[B_Cu] )
{ {
color = color.LegacyMix( m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) ); color = color.LegacyMix( m_board->GetVisibleElementColor( LAYER_PAD_BK ) );
} }
// What could happen: the pad color is *actually* black, or no // What could happen: the pad color is *actually* black, or no

View File

@ -149,7 +149,7 @@ void DIALOG_PLOT::Init_Dialog()
// Populate the check list box by all enabled layers names // Populate the check list box by all enabled layers names
for( LSEQ seq = m_layerList; seq; ++seq ) for( LSEQ seq = m_layerList; seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
int checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) ); int checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
@ -768,7 +768,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq ) for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
// All copper layers that are disabled are actually selected // All copper layers that are disabled are actually selected
// This is due to wonkyness in automatically selecting copper layers // This is due to wonkyness in automatically selecting copper layers

View File

@ -83,7 +83,7 @@ private:
wxConfigBase* m_config; wxConfigBase* m_config;
// the list of existing board layers in wxCheckListBox, with the // the list of existing board layers in wxCheckListBox, with the
// board layers id: // board layers id:
std::pair<wxCheckListBox*, int> m_boxSelectLayer[LAYER_ID_COUNT]; std::pair<wxCheckListBox*, int> m_boxSelectLayer[PCB_LAYER_ID_COUNT];
static bool m_ExcludeEdgeLayer; static bool m_ExcludeEdgeLayer;
void OnCloseWindow( wxCloseEvent& event ) override; void OnCloseWindow( wxCloseEvent& event ) override;
@ -178,7 +178,7 @@ void DIALOG_PRINT_USING_PRINTER::initValues( )
for( ; seq; ++seq ) for( ; seq; ++seq )
{ {
LAYER_ID layer = *seq; PCB_LAYER_ID layer = *seq;
int checkIndex; int checkIndex;
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )

View File

@ -51,7 +51,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
boost::optional<int> trackEndX = boost::make_optional<int>( false, 0 ); boost::optional<int> trackEndX = boost::make_optional<int>( false, 0 );
boost::optional<int> trackEndY = boost::make_optional<int>( false, 0 ); boost::optional<int> trackEndY = boost::make_optional<int>( false, 0 );
boost::optional<int> trackWidth = boost::make_optional<int>( false, 0 ); boost::optional<int> trackWidth = boost::make_optional<int>( false, 0 );
boost::optional<LAYER_ID> trackLayer = boost::make_optional<LAYER_ID>( false, (LAYER_ID) 0 ); boost::optional<PCB_LAYER_ID> trackLayer = boost::make_optional<PCB_LAYER_ID>( false, (PCB_LAYER_ID) 0 );
boost::optional<int> viaX, viaY, viaDiameter; boost::optional<int> viaX, viaY, viaDiameter;
boost::optional<int> viaDrill = boost::make_optional<int>( false, 0 ); boost::optional<int> viaDrill = boost::make_optional<int>( false, 0 );
@ -262,7 +262,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::Apply( COMMIT& aCommit )
LAYER_NUM layer = m_TrackLayerCtrl->GetLayerSelection(); LAYER_NUM layer = m_TrackLayerCtrl->GetLayerSelection();
if( layer != UNDEFINED_LAYER ) if( layer != UNDEFINED_LAYER )
t->SetLayer( (LAYER_ID) layer ); t->SetLayer( (PCB_LAYER_ID) layer );
if( changeLock ) if( changeLock )
t->SetLocked( setLock ); t->SetLocked( setLock );

View File

@ -162,7 +162,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
{ {
BOARD_COMMIT commit( m_parent ); BOARD_COMMIT commit( m_parent );
LAYER_ID newlayer = ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ); PCB_LAYER_ID newlayer = ToLAYER_ID( m_SelLayerBox->GetLayerSelection() );
if( !m_parent->GetBoard()->IsLayerEnabled( newlayer ) ) if( !m_parent->GetBoard()->IsLayerEnabled( newlayer ) )
{ {

Some files were not shown because too many files have changed in this diff Show More