Properties: Use parent footprint references instead of UUIDs

Also remove redundant Net Name property (Net is used)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12334
This commit is contained in:
Jon Evans 2022-11-24 22:40:45 -05:00
parent 11e784cf10
commit 308576b78d
9 changed files with 42 additions and 8 deletions

View File

@ -165,8 +165,6 @@ static struct BOARD_CONNECTED_ITEM_DESC
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" ),
NO_SETTER( BOARD_CONNECTED_ITEM, wxString ), &BOARD_CONNECTED_ITEM::GetNetname ) );
propMgr.AddProperty( new PROPERTY<BOARD_CONNECTED_ITEM, wxString>( _HKI( "Net Class" ),
NO_SETTER( BOARD_CONNECTED_ITEM, wxString ), &BOARD_CONNECTED_ITEM::GetNetClassName ) );
}

View File

@ -405,6 +405,15 @@ double FP_SHAPE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
}
wxString FP_SHAPE::GetParentAsString() const
{
if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( m_parent ) )
return fp->GetReference();
return m_parent->m_Uuid.AsString();
}
static struct FP_SHAPE_DESC
{
FP_SHAPE_DESC()

View File

@ -125,7 +125,7 @@ public:
return wxT( "MGRAPHIC" );
}
wxString GetParentAsString() const { return m_parent->m_Uuid.AsString(); }
wxString GetParentAsString() const;
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;

View File

@ -503,6 +503,15 @@ void FP_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLa
}
wxString FP_TEXT::GetParentAsString() const
{
if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( m_parent ) )
return fp->GetReference();
return m_parent->m_Uuid.AsString();
}
static struct FP_TEXT_DESC
{
FP_TEXT_DESC()

View File

@ -77,7 +77,7 @@ public:
return false;
}
wxString GetParentAsString() const { return m_parent->m_Uuid.AsString(); }
wxString GetParentAsString() const;
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
{

View File

@ -510,6 +510,15 @@ void FP_TEXTBOX::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID
}
wxString FP_TEXTBOX::GetParentAsString() const
{
if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( m_parent ) )
return fp->GetReference();
return m_parent->m_Uuid.AsString();
}
static struct FP_TEXTBOX_DESC
{
FP_TEXTBOX_DESC()

View File

@ -71,7 +71,7 @@ public:
void SetRight( int aVal ) override;
void SetBottom( int aVal ) override;
wxString GetParentAsString() const { return m_parent->m_Uuid.AsString(); }
wxString GetParentAsString() const;
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
{

View File

@ -1669,6 +1669,15 @@ void PAD::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
}
wxString PAD::GetParentAsString() const
{
if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( m_parent ) )
return fp->GetReference();
return m_parent->m_Uuid.AsString();
}
static struct PAD_DESC
{
PAD_DESC()
@ -1712,9 +1721,9 @@ static struct PAD_DESC
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pad Number" ),
&PAD::SetNumber, &PAD::GetNumber ) );
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Name" ),
&PAD::SetPinFunction, &PAD::GetPinFunction ) );
NO_SETTER( PAD, wxString ), &PAD::GetPinFunction ) );
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Type" ),
&PAD::SetPinType, &PAD::GetPinType ) );
NO_SETTER( PAD, wxString ), &PAD::GetPinType ) );
propMgr.AddProperty( new PROPERTY<PAD, double>( _HKI( "Orientation" ),
&PAD::SetOrientationDegrees, &PAD::GetOrientationDegrees,
PROPERTY_DISPLAY::PT_DEGREE ) );

View File

@ -110,7 +110,7 @@ public:
FOOTPRINT* GetParent() const;
wxString GetParentAsString() const { return m_parent->m_Uuid.AsString(); }
wxString GetParentAsString() const;
bool IsLocked() const override;