Properties: Add support for zone connection style

This commit is contained in:
Jon Evans 2022-11-25 18:44:02 -05:00
parent 96fe93618e
commit 74a2e4cad9
4 changed files with 79 additions and 41 deletions

View File

@ -2819,6 +2819,18 @@ static struct FOOTPRINT_DESC
{ {
FOOTPRINT_DESC() FOOTPRINT_DESC()
{ {
ENUM_MAP<ZONE_CONNECTION>& zcMap = ENUM_MAP<ZONE_CONNECTION>::Instance();
if( zcMap.Choices().GetCount() == 0 )
{
zcMap.Undefined( ZONE_CONNECTION::INHERITED );
zcMap.Map( ZONE_CONNECTION::INHERITED, _HKI( "Inherited" ) )
.Map( ZONE_CONNECTION::NONE, _HKI( "None" ) )
.Map( ZONE_CONNECTION::THERMAL, _HKI( "Thermal reliefs" ) )
.Map( ZONE_CONNECTION::FULL, _HKI( "Solid" ) )
.Map( ZONE_CONNECTION::THT_THERMAL, _HKI( "Thermal reliefs for PTH" ) );
}
ENUM_MAP<PCB_LAYER_ID>& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance(); ENUM_MAP<PCB_LAYER_ID>& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance();
if( layerEnum.Choices().GetCount() == 0 ) if( layerEnum.Choices().GetCount() == 0 )
@ -2880,6 +2892,8 @@ static struct FOOTPRINT_DESC
_HKI( "Solderpaste Margin Ratio Override" ), _HKI( "Solderpaste Margin Ratio Override" ),
&FOOTPRINT::SetLocalSolderPasteMarginRatio, &FOOTPRINT::SetLocalSolderPasteMarginRatio,
&FOOTPRINT::GetLocalSolderPasteMarginRatio ) ); &FOOTPRINT::GetLocalSolderPasteMarginRatio ) );
// TODO zone connection propMgr.AddProperty( new PROPERTY_ENUM<FOOTPRINT, ZONE_CONNECTION>(
_HKI( "Zone Connection Style" ),
&FOOTPRINT::SetZoneConnection, &FOOTPRINT::GetZoneConnection ) );
} }
} _FOOTPRINT_DESC; } _FOOTPRINT_DESC;

View File

@ -1706,6 +1706,18 @@ static struct PAD_DESC
.Map( PAD_PROP::HEATSINK, _HKI( "Heatsink pad" ) ) .Map( PAD_PROP::HEATSINK, _HKI( "Heatsink pad" ) )
.Map( PAD_PROP::CASTELLATED, _HKI( "Castellated pad" ) ); .Map( PAD_PROP::CASTELLATED, _HKI( "Castellated pad" ) );
ENUM_MAP<ZONE_CONNECTION>& zcMap = ENUM_MAP<ZONE_CONNECTION>::Instance();
if( zcMap.Choices().GetCount() == 0 )
{
zcMap.Undefined( ZONE_CONNECTION::INHERITED );
zcMap.Map( ZONE_CONNECTION::INHERITED, _HKI( "Inherited" ) )
.Map( ZONE_CONNECTION::NONE, _HKI( "None" ) )
.Map( ZONE_CONNECTION::THERMAL, _HKI( "Thermal reliefs" ) )
.Map( ZONE_CONNECTION::FULL, _HKI( "Solid" ) )
.Map( ZONE_CONNECTION::THT_THERMAL, _HKI( "Thermal reliefs for PTH" ) );
}
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PAD ); REGISTER_TYPE( PAD );
propMgr.InheritsAfter( TYPE_HASH( PAD ), TYPE_HASH( BOARD_CONNECTED_ITEM ) ); propMgr.InheritsAfter( TYPE_HASH( PAD ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
@ -1718,6 +1730,8 @@ static struct PAD_DESC
&PAD::SetShape, &PAD::GetShape ); &PAD::SetShape, &PAD::GetShape );
propMgr.AddProperty( shape ); propMgr.AddProperty( shape );
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Parent" ),
NO_SETTER( PAD, wxString ), &PAD::GetParentAsString ) );
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pad Number" ), propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pad Number" ),
&PAD::SetNumber, &PAD::GetNumber ) ); &PAD::SetNumber, &PAD::GetNumber ) );
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Name" ), propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Name" ),
@ -1733,34 +1747,6 @@ static struct PAD_DESC
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Size Y" ), propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Size Y" ),
&PAD::SetSizeY, &PAD::GetSizeY, &PAD::SetSizeY, &PAD::GetSizeY,
PROPERTY_DISPLAY::PT_SIZE ) ); PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Hole Size X" ),
&PAD::SetDrillSizeX, &PAD::GetDrillSizeX,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Hole Size Y" ),
&PAD::SetDrillSizeY, &PAD::GetDrillSizeY,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Pad To Die Length" ),
&PAD::SetPadToDieLength, &PAD::GetPadToDieLength,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Soldermask Margin Override" ),
&PAD::SetLocalSolderMaskMargin, &PAD::GetLocalSolderMaskMargin,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Solderpaste Margin Override" ),
&PAD::SetLocalSolderPasteMargin, &PAD::GetLocalSolderPasteMargin,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, double>( _HKI( "Solderpaste Margin Ratio Override" ),
&PAD::SetLocalSolderPasteMarginRatio, &PAD::GetLocalSolderPasteMarginRatio ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Thermal Relief Spoke Width" ),
&PAD::SetThermalSpokeWidth, &PAD::GetThermalSpokeWidth,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, double>( _HKI( "Thermal Relief Spoke Angle" ),
&PAD::SetThermalSpokeAngleDegrees, &PAD::GetThermalSpokeAngleDegrees,
PROPERTY_DISPLAY::PT_DEGREE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Thermal Relief Gap" ),
&PAD::SetThermalGap, &PAD::GetThermalGap,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY_ENUM<PAD, PAD_PROP>( _HKI( "Fabrication Property" ),
&PAD::SetProperty, &PAD::GetProperty ) );
auto roundRadiusRatio = new PROPERTY<PAD, double>( _HKI( "Round Radius Ratio" ), auto roundRadiusRatio = new PROPERTY<PAD, double>( _HKI( "Round Radius Ratio" ),
&PAD::SetRoundRectRadiusRatio, &PAD::GetRoundRectRadiusRatio ); &PAD::SetRoundRectRadiusRatio, &PAD::GetRoundRectRadiusRatio );
@ -1771,13 +1757,43 @@ static struct PAD_DESC
} ); } );
propMgr.AddProperty( roundRadiusRatio ); propMgr.AddProperty( roundRadiusRatio );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Hole Size X" ),
&PAD::SetDrillSizeX, &PAD::GetDrillSizeX,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Hole Size Y" ),
&PAD::SetDrillSizeY, &PAD::GetDrillSizeY,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY_ENUM<PAD, PAD_PROP>( _HKI( "Fabrication Property" ),
&PAD::SetProperty, &PAD::GetProperty ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Pad To Die Length" ),
&PAD::SetPadToDieLength, &PAD::GetPadToDieLength,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Clearance Override" ), propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Clearance Override" ),
&PAD::SetLocalClearance, &PAD::GetLocalClearance, &PAD::SetLocalClearance, &PAD::GetLocalClearance,
PROPERTY_DISPLAY::PT_SIZE ) ); PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Parent" ), propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Soldermask Margin Override" ),
NO_SETTER( PAD, wxString ), &PAD::GetParentAsString ) ); &PAD::SetLocalSolderMaskMargin, &PAD::GetLocalSolderMaskMargin,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Solderpaste Margin Override" ),
&PAD::SetLocalSolderPasteMargin, &PAD::GetLocalSolderPasteMargin,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, double>( _HKI( "Solderpaste Margin Ratio Override" ),
&PAD::SetLocalSolderPasteMarginRatio, &PAD::GetLocalSolderPasteMarginRatio ) );
propMgr.AddProperty( new PROPERTY_ENUM<PAD, ZONE_CONNECTION>(
_HKI( "Zone Connection Style" ),
&PAD::SetZoneConnection, &PAD::GetZoneConnection ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Thermal Relief Spoke Width" ),
&PAD::SetThermalSpokeWidth, &PAD::GetThermalSpokeWidth,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PAD, double>( _HKI( "Thermal Relief Spoke Angle" ),
&PAD::SetThermalSpokeAngleDegrees, &PAD::GetThermalSpokeAngleDegrees,
PROPERTY_DISPLAY::PT_DEGREE ) );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Thermal Relief Gap" ),
&PAD::SetThermalGap, &PAD::GetThermalGap,
PROPERTY_DISPLAY::PT_SIZE ) );
// TODO delta, drill shape offset, layer set, zone connection // TODO delta, drill shape offset, layer set
} }
} _PAD_DESC; } _PAD_DESC;

View File

@ -1354,20 +1354,24 @@ static struct ZONE_DESC
{ {
ZONE_DESC() ZONE_DESC()
{ {
ENUM_MAP<ZONE_CONNECTION>::Instance() ENUM_MAP<ZONE_CONNECTION>& zcMap = ENUM_MAP<ZONE_CONNECTION>::Instance();
.Map( ZONE_CONNECTION::INHERITED, _HKI( "Inherited" ) )
.Map( ZONE_CONNECTION::NONE, _HKI( "None" ) ) if( zcMap.Choices().GetCount() == 0 )
.Map( ZONE_CONNECTION::THERMAL, _HKI( "Thermal reliefs" ) ) {
.Map( ZONE_CONNECTION::FULL, _HKI( "Solid" ) ) zcMap.Undefined( ZONE_CONNECTION::INHERITED );
.Map( ZONE_CONNECTION::THT_THERMAL, _HKI( "Thermal reliefs for PTH" ) ); zcMap.Map( ZONE_CONNECTION::INHERITED, _HKI( "Inherited" ) )
.Map( ZONE_CONNECTION::NONE, _HKI( "None" ) )
.Map( ZONE_CONNECTION::THERMAL, _HKI( "Thermal reliefs" ) )
.Map( ZONE_CONNECTION::FULL, _HKI( "Solid" ) )
.Map( ZONE_CONNECTION::THT_THERMAL, _HKI( "Thermal reliefs for PTH" ) );
}
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( ZONE ); REGISTER_TYPE( ZONE );
propMgr.InheritsAfter( TYPE_HASH( ZONE ), TYPE_HASH( BOARD_CONNECTED_ITEM ) ); propMgr.InheritsAfter( TYPE_HASH( ZONE ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
propMgr.AddProperty( new PROPERTY<ZONE, unsigned>( _HKI( "Priority" ), propMgr.AddProperty( new PROPERTY<ZONE, unsigned>( _HKI( "Priority" ),
&ZONE::SetAssignedPriority, &ZONE::GetAssignedPriority ) ); &ZONE::SetAssignedPriority, &ZONE::GetAssignedPriority ) );
//propMgr.AddProperty( new PROPERTY<ZONE, bool>( "Filled",
//&ZONE::SetIsFilled, &ZONE::IsFilled ) );
propMgr.AddProperty( new PROPERTY<ZONE, wxString>( _HKI( "Name" ), propMgr.AddProperty( new PROPERTY<ZONE, wxString>( _HKI( "Name" ),
&ZONE::SetZoneName, &ZONE::GetZoneName ) ); &ZONE::SetZoneName, &ZONE::GetZoneName ) );
propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Clearance Override" ), propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Clearance Override" ),
@ -1387,4 +1391,4 @@ static struct ZONE_DESC
} }
} _ZONE_DESC; } _ZONE_DESC;
ENUM_TO_WXANY( ZONE_CONNECTION ); IMPLEMENT_ENUM_TO_WXANY( ZONE_CONNECTION )

View File

@ -918,4 +918,8 @@ public:
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override; double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
}; };
#ifndef SWIG
DECLARE_ENUM_TO_WXANY( ZONE_CONNECTION )
#endif
#endif // ZONE_H #endif // ZONE_H