Delete empty fields from Symbol Fields editor.
Fixes: lp:1784718 * https://bugs.launchpad.net/kicad/+bug/1784718
This commit is contained in:
parent
f8a5e2c1c8
commit
196bdc05db
|
@ -585,8 +585,10 @@ public:
|
|||
if( !destField && !srcValue.IsEmpty() )
|
||||
destField = comp->AddField( SCH_FIELD( wxPoint( 0, 0 ), -1, comp, srcName ) );
|
||||
|
||||
if( destField )
|
||||
if( destField && !srcValue.IsEmpty() )
|
||||
destField->SetText( srcValue );
|
||||
else
|
||||
comp->RemoveField( srcName );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -934,6 +934,19 @@ SCH_FIELD* SCH_COMPONENT::AddField( const SCH_FIELD& aField )
|
|||
}
|
||||
|
||||
|
||||
void SCH_COMPONENT::RemoveField( const wxString& aFieldName )
|
||||
{
|
||||
for( unsigned i = MANDATORY_FIELDS; i < m_Fields.size(); ++i )
|
||||
{
|
||||
if( aFieldName == m_Fields[i].GetName( false ) )
|
||||
{
|
||||
m_Fields.erase( m_Fields.begin() + i );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_FIELD* SCH_COMPONENT::FindField( const wxString& aFieldName, bool aIncludeDefaultFields )
|
||||
{
|
||||
unsigned start = aIncludeDefaultFields ? 0 : MANDATORY_FIELDS;
|
||||
|
|
|
@ -349,6 +349,13 @@ public:
|
|||
*/
|
||||
SCH_FIELD* AddField( const SCH_FIELD& aField );
|
||||
|
||||
/**
|
||||
* Removes a user field from the symbol.
|
||||
* @param aFieldName is the user fieldName to remove. Attempts to remove a mandatory
|
||||
* field or a non-existant field are silently ignored.
|
||||
*/
|
||||
void RemoveField( const wxString& aFieldName );
|
||||
|
||||
/**
|
||||
* Search for a #SCH_FIELD with \a aFieldName
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue