pcbnew: fix missing layer names and missing layers in stackup table

This commit is contained in:
Fabien Corona 2021-06-24 08:52:51 +00:00 committed by jean-pierre charras
parent 450b0c9e27
commit 95ab53d119
1 changed files with 40 additions and 24 deletions

View File

@ -236,6 +236,8 @@ std::vector<BOARD_ITEM*> DRAWING_TOOL::DrawSpecificationStackup(
//Get Layer names //Get Layer names
BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings(); BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
BOARD_STACKUP& stackup = dsnSettings.GetStackupDescriptor(); BOARD_STACKUP& stackup = dsnSettings.GetStackupDescriptor();
stackup.SynchronizeWithBoard( &dsnSettings );
std::vector<BOARD_STACKUP_ITEM*> layers = stackup.GetList(); std::vector<BOARD_STACKUP_ITEM*> layers = stackup.GetList();
std::vector<PCB_TEXT*> colLayer; std::vector<PCB_TEXT*> colLayer;
@ -281,12 +283,24 @@ std::vector<BOARD_ITEM*> DRAWING_TOOL::DrawSpecificationStackup(
t->SetText( _( "Loss Tangent" ) ); t->SetText( _( "Loss Tangent" ) );
colTanD.push_back( t ); colTanD.push_back( t );
int i; int i, j;
for( i = 0; i < stackup.GetCount(); i++ ) for( i = 0; i < stackup.GetCount(); i++ )
{ {
for( j = 0; j < layers.at( i )->GetSublayersCount(); j++ )
{
// Layer names are empty untill we close at least once the board setup dialog.
// If the user did not open the dialog, then get the names from the board.
// But dielectric layer names will be missing.
t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() ); t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() );
if( layers.at( i )->GetLayerName().IsEmpty() )
{
t->SetText( m_frame->GetBoard()->GetLayerName( layers.at( i )->GetBrdLayerId() ) );
}
else
{
t->SetText( layers.at( i )->GetLayerName() ); t->SetText( layers.at( i )->GetLayerName() );
}
colLayer.push_back( t ); colLayer.push_back( t );
t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() ); t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() );
@ -294,12 +308,12 @@ std::vector<BOARD_ITEM*> DRAWING_TOOL::DrawSpecificationStackup(
colType.push_back( t ); colType.push_back( t );
t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() ); t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() );
t->SetText( layers.at( i )->GetMaterial() ); t->SetText( layers.at( i )->GetMaterial( j ) );
colMaterial.push_back( t ); colMaterial.push_back( t );
t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() ); t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() );
t->SetText( t->SetText( StringFromValue( m_frame->GetUserUnits(), layers.at( i )->GetThickness( j ),
StringFromValue( m_frame->GetUserUnits(), layers.at( i )->GetThickness(), true ) ); true ) );
colThickness.push_back( t ); colThickness.push_back( t );
t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() ); t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() );
@ -307,14 +321,16 @@ std::vector<BOARD_ITEM*> DRAWING_TOOL::DrawSpecificationStackup(
colColor.push_back( t ); colColor.push_back( t );
t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() ); t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() );
t->SetText( StringFromValue( EDA_UNITS::UNSCALED, layers.at( i )->GetEpsilonR(), false ) ); t->SetText( StringFromValue( EDA_UNITS::UNSCALED, layers.at( i )->GetEpsilonR( j ),
false ) );
colEpsilon.push_back( t ); colEpsilon.push_back( t );
t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() ); t = static_cast<PCB_TEXT*>( dataStyle->Duplicate() );
t->SetText( t->SetText( StringFromValue( EDA_UNITS::UNSCALED, layers.at( i )->GetLossTangent( j ),
StringFromValue( EDA_UNITS::UNSCALED, layers.at( i )->GetLossTangent(), false ) ); false ) );
colTanD.push_back( t ); colTanD.push_back( t );
} }
}
texts.push_back( colLayer ); texts.push_back( colLayer );
texts.push_back( colType ); texts.push_back( colType );