From 74a2e4cad9f2e7f208e458767fcb7a2dbd6ec95f Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Fri, 25 Nov 2022 18:44:02 -0500 Subject: [PATCH] Properties: Add support for zone connection style --- pcbnew/footprint.cpp | 16 ++++++++- pcbnew/pad.cpp | 78 ++++++++++++++++++++++++++------------------ pcbnew/zone.cpp | 22 ++++++++----- pcbnew/zone.h | 4 +++ 4 files changed, 79 insertions(+), 41 deletions(-) diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 97194a5228..bbce5f8882 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -2819,6 +2819,18 @@ static struct FOOTPRINT_DESC { FOOTPRINT_DESC() { + ENUM_MAP& zcMap = ENUM_MAP::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& layerEnum = ENUM_MAP::Instance(); if( layerEnum.Choices().GetCount() == 0 ) @@ -2880,6 +2892,8 @@ static struct FOOTPRINT_DESC _HKI( "Solderpaste Margin Ratio Override" ), &FOOTPRINT::SetLocalSolderPasteMarginRatio, &FOOTPRINT::GetLocalSolderPasteMarginRatio ) ); - // TODO zone connection + propMgr.AddProperty( new PROPERTY_ENUM( + _HKI( "Zone Connection Style" ), + &FOOTPRINT::SetZoneConnection, &FOOTPRINT::GetZoneConnection ) ); } } _FOOTPRINT_DESC; diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 7250f8b3e6..b9fcf11164 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -1706,6 +1706,18 @@ static struct PAD_DESC .Map( PAD_PROP::HEATSINK, _HKI( "Heatsink pad" ) ) .Map( PAD_PROP::CASTELLATED, _HKI( "Castellated pad" ) ); + ENUM_MAP& zcMap = ENUM_MAP::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(); REGISTER_TYPE( PAD ); propMgr.InheritsAfter( TYPE_HASH( PAD ), TYPE_HASH( BOARD_CONNECTED_ITEM ) ); @@ -1718,6 +1730,8 @@ static struct PAD_DESC &PAD::SetShape, &PAD::GetShape ); propMgr.AddProperty( shape ); + propMgr.AddProperty( new PROPERTY( _HKI( "Parent" ), + NO_SETTER( PAD, wxString ), &PAD::GetParentAsString ) ); propMgr.AddProperty( new PROPERTY( _HKI( "Pad Number" ), &PAD::SetNumber, &PAD::GetNumber ) ); propMgr.AddProperty( new PROPERTY( _HKI( "Pin Name" ), @@ -1733,34 +1747,6 @@ static struct PAD_DESC propMgr.AddProperty( new PROPERTY( _HKI( "Size Y" ), &PAD::SetSizeY, &PAD::GetSizeY, PROPERTY_DISPLAY::PT_SIZE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Hole Size X" ), - &PAD::SetDrillSizeX, &PAD::GetDrillSizeX, - PROPERTY_DISPLAY::PT_SIZE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Hole Size Y" ), - &PAD::SetDrillSizeY, &PAD::GetDrillSizeY, - PROPERTY_DISPLAY::PT_SIZE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Pad To Die Length" ), - &PAD::SetPadToDieLength, &PAD::GetPadToDieLength, - PROPERTY_DISPLAY::PT_SIZE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Soldermask Margin Override" ), - &PAD::SetLocalSolderMaskMargin, &PAD::GetLocalSolderMaskMargin, - PROPERTY_DISPLAY::PT_SIZE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Solderpaste Margin Override" ), - &PAD::SetLocalSolderPasteMargin, &PAD::GetLocalSolderPasteMargin, - PROPERTY_DISPLAY::PT_SIZE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Solderpaste Margin Ratio Override" ), - &PAD::SetLocalSolderPasteMarginRatio, &PAD::GetLocalSolderPasteMarginRatio ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Spoke Width" ), - &PAD::SetThermalSpokeWidth, &PAD::GetThermalSpokeWidth, - PROPERTY_DISPLAY::PT_SIZE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Spoke Angle" ), - &PAD::SetThermalSpokeAngleDegrees, &PAD::GetThermalSpokeAngleDegrees, - PROPERTY_DISPLAY::PT_DEGREE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Gap" ), - &PAD::SetThermalGap, &PAD::GetThermalGap, - PROPERTY_DISPLAY::PT_SIZE ) ); - propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Fabrication Property" ), - &PAD::SetProperty, &PAD::GetProperty ) ); auto roundRadiusRatio = new PROPERTY( _HKI( "Round Radius Ratio" ), &PAD::SetRoundRectRadiusRatio, &PAD::GetRoundRectRadiusRatio ); @@ -1771,13 +1757,43 @@ static struct PAD_DESC } ); propMgr.AddProperty( roundRadiusRatio ); + propMgr.AddProperty( new PROPERTY( _HKI( "Hole Size X" ), + &PAD::SetDrillSizeX, &PAD::GetDrillSizeX, + PROPERTY_DISPLAY::PT_SIZE ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Hole Size Y" ), + &PAD::SetDrillSizeY, &PAD::GetDrillSizeY, + PROPERTY_DISPLAY::PT_SIZE ) ); + + propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Fabrication Property" ), + &PAD::SetProperty, &PAD::GetProperty ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Pad To Die Length" ), + &PAD::SetPadToDieLength, &PAD::GetPadToDieLength, + PROPERTY_DISPLAY::PT_SIZE ) ); propMgr.AddProperty( new PROPERTY( _HKI( "Clearance Override" ), &PAD::SetLocalClearance, &PAD::GetLocalClearance, PROPERTY_DISPLAY::PT_SIZE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Parent" ), - NO_SETTER( PAD, wxString ), &PAD::GetParentAsString ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Soldermask Margin Override" ), + &PAD::SetLocalSolderMaskMargin, &PAD::GetLocalSolderMaskMargin, + PROPERTY_DISPLAY::PT_SIZE ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Solderpaste Margin Override" ), + &PAD::SetLocalSolderPasteMargin, &PAD::GetLocalSolderPasteMargin, + PROPERTY_DISPLAY::PT_SIZE ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Solderpaste Margin Ratio Override" ), + &PAD::SetLocalSolderPasteMarginRatio, &PAD::GetLocalSolderPasteMarginRatio ) ); + propMgr.AddProperty( new PROPERTY_ENUM( + _HKI( "Zone Connection Style" ), + &PAD::SetZoneConnection, &PAD::GetZoneConnection ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Spoke Width" ), + &PAD::SetThermalSpokeWidth, &PAD::GetThermalSpokeWidth, + PROPERTY_DISPLAY::PT_SIZE ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Spoke Angle" ), + &PAD::SetThermalSpokeAngleDegrees, &PAD::GetThermalSpokeAngleDegrees, + PROPERTY_DISPLAY::PT_DEGREE ) ); + propMgr.AddProperty( new PROPERTY( _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; diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index fe4485ad4f..980451a54a 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -1354,20 +1354,24 @@ static struct ZONE_DESC { ZONE_DESC() { - ENUM_MAP::Instance() - .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& zcMap = ENUM_MAP::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(); REGISTER_TYPE( ZONE ); propMgr.InheritsAfter( TYPE_HASH( ZONE ), TYPE_HASH( BOARD_CONNECTED_ITEM ) ); propMgr.AddProperty( new PROPERTY( _HKI( "Priority" ), &ZONE::SetAssignedPriority, &ZONE::GetAssignedPriority ) ); - //propMgr.AddProperty( new PROPERTY( "Filled", - //&ZONE::SetIsFilled, &ZONE::IsFilled ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Name" ), &ZONE::SetZoneName, &ZONE::GetZoneName ) ); propMgr.AddProperty( new PROPERTY( _HKI( "Clearance Override" ), @@ -1387,4 +1391,4 @@ static struct ZONE_DESC } } _ZONE_DESC; -ENUM_TO_WXANY( ZONE_CONNECTION ); +IMPLEMENT_ENUM_TO_WXANY( ZONE_CONNECTION ) diff --git a/pcbnew/zone.h b/pcbnew/zone.h index c4966761dd..ee7b04a329 100644 --- a/pcbnew/zone.h +++ b/pcbnew/zone.h @@ -918,4 +918,8 @@ public: double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override; }; +#ifndef SWIG +DECLARE_ENUM_TO_WXANY( ZONE_CONNECTION ) +#endif + #endif // ZONE_H