Properties Panel: Correctly limit layers for connectable items to copper layers

This commit is contained in:
Roberto Fernandez Bautista 2022-05-12 19:16:11 +01:00 committed by Jon Evans
parent 7208ceb5f1
commit 4108099641
3 changed files with 13 additions and 14 deletions

View File

@ -155,10 +155,6 @@ static struct BOARD_CONNECTED_ITEM_DESC
REGISTER_TYPE( BOARD_CONNECTED_ITEM );
propMgr.InheritsAfter( TYPE_HASH( BOARD_CONNECTED_ITEM ), TYPE_HASH( BOARD_ITEM ) );
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ),
new PROPERTY_ENUM<BOARD_CONNECTED_ITEM, PCB_LAYER_ID, BOARD_ITEM>( _HKI( "Layer" ),
&BOARD_CONNECTED_ITEM::SetLayer, &BOARD_CONNECTED_ITEM::GetLayer ) );
propMgr.AddProperty( new PROPERTY_ENUM<BOARD_CONNECTED_ITEM, int>( _HKI( "Net" ),
&BOARD_CONNECTED_ITEM::SetNetCode, &BOARD_CONNECTED_ITEM::GetNetCode ) );
propMgr.AddProperty( new PROPERTY<BOARD_CONNECTED_ITEM, wxString>( _HKI( "Net Name" ),

View File

@ -28,6 +28,7 @@
#include <board_connected_item.h>
#include <pg_properties.h>
#include <pcb_shape.h>
#include <pcb_track.h>
#include <settings/color_settings.h>
@ -101,21 +102,22 @@ void PCB_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
void PCB_PROPERTIES_PANEL::updateLists( const BOARD* aBoard )
{
wxPGChoices layersAll, layersCu, layersNonCu, nets;
wxPGChoices layersAll, layersCu, nets;
// Regenerate all layers
for( LSEQ layerSeq = aBoard->GetEnabledLayers().UIOrder(); layerSeq; ++layerSeq )
layersAll.Add( LSET::Name( *layerSeq ), *layerSeq );
for( LSEQ seq = aBoard->GetEnabledLayers().UIOrder(); seq; ++seq )
layersAll.Add( LSET::Name( *seq ), *seq );
if( m_propMgr.GetProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ) ) )
m_propMgr.GetProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ) )->SetChoices( layersAll );
for( LSEQ seq = LSET( aBoard->GetEnabledLayers() & LSET::AllCuMask() ).UIOrder(); seq; ++seq )
layersCu.Add( LSET::Name( *seq ), *seq );
if( m_propMgr.GetProperty( TYPE_HASH( PCB_SHAPE ), _HKI( "Layer" ) ) )
m_propMgr.GetProperty( TYPE_HASH( PCB_SHAPE ), _HKI( "Layer" ) )->SetChoices( layersAll );
m_propMgr.GetProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ) )->SetChoices( layersAll );
m_propMgr.GetProperty( TYPE_HASH( PCB_SHAPE ), _HKI( "Layer" ) )->SetChoices( layersAll );
if( m_propMgr.GetProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Layer" ) ) )
m_propMgr.GetProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Layer" ) )
->SetChoices( layersAll );
// Copper only properties
m_propMgr.GetProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Layer" ) )->SetChoices( layersCu );
m_propMgr.GetProperty( TYPE_HASH( PCB_VIA ), _HKI( "Layer Top" ) )->SetChoices( layersCu );
m_propMgr.GetProperty( TYPE_HASH( PCB_VIA ), _HKI( "Layer Bottom" ) )->SetChoices( layersCu );
// Regenerate nets
for( const auto& netinfo : aBoard->GetNetInfo().NetsByNetcode() )

View File

@ -318,6 +318,7 @@ static struct PCB_SHAPE_DESC
REGISTER_TYPE( PCB_SHAPE );
propMgr.AddTypeCast( new TYPE_CAST<PCB_SHAPE, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_SHAPE, EDA_SHAPE> );
propMgr.InheritsAfter( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( EDA_SHAPE ) );
}
} _PCB_SHAPE_DESC;