Initialize the PCB_LAYER_T enum in the property manager

Since all the property descriptions are static initialization, each instance
should contain the code to initially populate the enum if it is empty,
otherwise an assert is thrown warning the enum may be empty.
This commit is contained in:
Ian McInerney 2020-08-18 22:42:56 +01:00
parent b60a7e2aca
commit 8bca145b75
2 changed files with 20 additions and 0 deletions

View File

@ -1679,6 +1679,16 @@ static struct MODULE_DESC
{ {
MODULE_DESC() MODULE_DESC()
{ {
ENUM_MAP<PCB_LAYER_ID>& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance();
if( layerEnum.Choices().GetCount() == 0 )
{
layerEnum.Undefined( UNDEFINED_LAYER );
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
layerEnum.Map( *seq, LSET::Name( *seq ) );
}
wxPGChoices fpLayers; // footprints might be placed only on F.Cu & B.Cu wxPGChoices fpLayers; // footprints might be placed only on F.Cu & B.Cu
fpLayers.Add( LSET::Name( F_Cu ), F_Cu ); fpLayers.Add( LSET::Name( F_Cu ), F_Cu );
fpLayers.Add( LSET::Name( B_Cu ), B_Cu ); fpLayers.Add( LSET::Name( B_Cu ), B_Cu );

View File

@ -1107,6 +1107,16 @@ static struct TRACK_VIA_DESC
.Map( VIATYPE::BLIND_BURIED, _( "Blind/Buried" ) ) .Map( VIATYPE::BLIND_BURIED, _( "Blind/Buried" ) )
.Map( VIATYPE::MICROVIA, _( "Microvia" ) ); .Map( VIATYPE::MICROVIA, _( "Microvia" ) );
ENUM_MAP<PCB_LAYER_ID>& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance();
if( layerEnum.Choices().GetCount() == 0 )
{
layerEnum.Undefined( UNDEFINED_LAYER );
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
layerEnum.Map( *seq, LSET::Name( *seq ) );
}
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
// Track // Track