diff --git a/include/properties/property_mgr.h b/include/properties/property_mgr.h index 61872a68c9..907ce0cb0f 100644 --- a/include/properties/property_mgr.h +++ b/include/properties/property_mgr.h @@ -140,6 +140,14 @@ public: */ PROPERTY_BASE& AddProperty( PROPERTY_BASE* aProperty, const wxString& aGroup = wxEmptyString ); + /** + * Replace an existing property. This is used to modify the implementation of a property without + * moving it in the display order. + * @param aProperty is the property to register. + * @param aGroup is an optional grouping key for the property + */ + PROPERTY_BASE& ReplaceProperty( PROPERTY_BASE* aProperty, const wxString& aGroup ); + /** * Replace an existing property for a specific type. * diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 5200cdbdd1..07068d764c 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -4809,25 +4809,8 @@ static struct FOOTPRINT_DESC propMgr.AddProperty( new PROPERTY( _HKI( "Reference" ), &FOOTPRINT::SetReference, &FOOTPRINT::GetReferenceAsString ), groupFields ); - propMgr.AddProperty( new PROPERTY( _HKI( "Value" ), - &FOOTPRINT::SetValue, &FOOTPRINT::GetValueAsString ), - groupFields ); - propMgr.AddProperty( new PROPERTY( _HKI( "Library Link" ), - NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetFPIDAsString ), - groupFields ); - propMgr.AddProperty( new PROPERTY( _HKI( "Library Description" ), - NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetLibDescription ), - groupFields ); - propMgr.AddProperty( new PROPERTY( _HKI( "Keywords" ), - NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetKeywords ), - groupFields ); - - // Note: Also used by DRC engine - propMgr.AddProperty( new PROPERTY( _HKI( "Component Class" ), - NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetComponentClassAsString ), - groupFields ) - .SetIsHiddenFromLibraryEditors(); + // Remaining fields are variant-specific, and so are added in PCB_PROPERTIES_PANEL::rebuildProperties(). const wxString groupAttributes = _HKI( "Attributes" ); diff --git a/pcbnew/widgets/pcb_properties_panel.cpp b/pcbnew/widgets/pcb_properties_panel.cpp index 735cf33a71..1c411650c4 100644 --- a/pcbnew/widgets/pcb_properties_panel.cpp +++ b/pcbnew/widgets/pcb_properties_panel.cpp @@ -399,6 +399,11 @@ void PCB_PROPERTIES_PANEL::rebuildProperties( const SELECTION& aSelection ) const wxString groupFields = _HKI( "Fields" ); + // Make sure value comes immediately after reference. (Reference is invariant, so was added by + // FOOTPRINT_DESC(). We *could* still add it here, but then the whole Fields section comes at + // the end, which isn't ideal.) + m_propMgr.AddProperty( new PCB_FOOTPRINT_FIELD_PROPERTY( _HKI( "Value" ) ), groupFields ); + for( const wxString& name : m_currentFieldNames ) { if( !m_propMgr.GetProperty( TYPE_HASH( FOOTPRINT ), name ) ) @@ -411,6 +416,22 @@ void PCB_PROPERTIES_PANEL::rebuildProperties( const SELECTION& aSelection ) } } + m_propMgr.AddProperty( new PROPERTY( _HKI( "Library Link" ), + NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetFPIDAsString ), + groupFields ); + m_propMgr.AddProperty( new PROPERTY( _HKI( "Library Description" ), + NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetLibDescription ), + groupFields ); + m_propMgr.AddProperty( new PROPERTY( _HKI( "Keywords" ), + NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetKeywords ), + groupFields ); + + // Note: Also used by DRC engine + m_propMgr.AddProperty( new PROPERTY( _HKI( "Component Class" ), + NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetComponentClassAsString ), + groupFields ) + .SetIsHiddenFromLibraryEditors(); + PROPERTIES_PANEL::rebuildProperties( aSelection ); }