7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 18:51:40 +00:00

Another go at supressing FOOTPRINT field on FOOTPRINT objects

This commit is contained in:
JamesJCode 2024-12-28 20:40:57 +00:00
parent 86bcf840c1
commit dfe0d6345b
23 changed files with 163 additions and 86 deletions

View File

@ -298,9 +298,9 @@ public:
{
for( const auto& it : aList )
{
if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
testData,
scanTypes ) == INSPECT_RESULT::QUIT )
EDA_ITEM* item = static_cast<EDA_ITEM*>( it );
if( item && item->Visit( inspector, testData, scanTypes ) == INSPECT_RESULT::QUIT )
{
return INSPECT_RESULT::QUIT;
}
@ -318,9 +318,9 @@ public:
{
for( const auto& it : aList )
{
if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
testData,
scanTypes ) == INSPECT_RESULT::QUIT )
EDA_ITEM* item = static_cast<EDA_ITEM*>( it );
if( item && item->Visit( inspector, testData, scanTypes ) == INSPECT_RESULT::QUIT )
{
return INSPECT_RESULT::QUIT;
}

View File

@ -1434,9 +1434,9 @@ BOARD_ITEM* BOARD::GetItem( const KIID& aID ) const
return pad;
}
for( PCB_FIELD* field : footprint->Fields() )
for( PCB_FIELD* field : footprint->GetFields() )
{
if( field->m_Uuid == aID )
if( field && field->m_Uuid == aID )
return field;
}

View File

@ -565,7 +565,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
}
nlohmann::ordered_map<wxString, wxString> fields;
for( PCB_FIELD* field : footprint->Fields() )
for( PCB_FIELD* field : footprint->GetFields() )
fields[field->GetCanonicalName()] = field->GetText();
component->SetFields( fields );

View File

@ -275,7 +275,7 @@ void DIALOG_FIND::search( bool aDirection )
}
}
for( PCB_FIELD* field : fp->Fields() )
for( PCB_FIELD* field : fp->GetFields() )
{
if( field->Matches( m_frame->GetFindReplaceData(), nullptr ) )
m_hitList.push_back( fp );

View File

@ -612,7 +612,7 @@ static size_t hashFootprint( const FOOTPRINT* aFootprint )
constexpr int flags = HASH_FLAGS::HASH_POS | HASH_FLAGS::REL_COORD
| HASH_FLAGS::HASH_ROT | HASH_FLAGS::HASH_LAYER;
for( PCB_FIELD* i : aFootprint->Fields() )
for( PCB_FIELD* i : aFootprint->GetFields() )
ret += hash_fp_item( i, flags );
for( BOARD_ITEM* i : aFootprint->GraphicalItems() )

View File

@ -88,11 +88,21 @@ FOOTPRINT::FOOTPRINT( BOARD* parent ) :
// These are the mandatory fields for the editor to work
for( int i = 0; i < MANDATORY_FIELDS; i++ )
{
PCB_FIELD* field = new PCB_FIELD( this, i );
m_fields.push_back( field );
PCB_FIELD* field;
if( i == FOOTPRINT_FIELD )
{
m_fields.push_back( nullptr );
}
else
{
field = new PCB_FIELD( this, i );
m_fields.push_back( field );
}
switch( i )
{
case FOOTPRINT_FIELD: break;
case REFERENCE_FIELD:
field->SetLayer( F_SilkS );
field->SetVisible( true );
@ -145,11 +155,18 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
// Copy fields
for( PCB_FIELD* field : aFootprint.Fields() )
for( PCB_FIELD* field : aFootprint.m_fields )
{
PCB_FIELD* newField = static_cast<PCB_FIELD*>( field->Clone() );
ptrMap[field] = newField;
Add( newField, ADD_MODE::APPEND ); // Append to ensure indexes are identical
if( field )
{
PCB_FIELD* newField = static_cast<PCB_FIELD*>( field->Clone() );
ptrMap[field] = newField;
Add( newField, ADD_MODE::APPEND ); // Append to ensure indexes are identical
}
else
{
m_fields.push_back( nullptr );
}
}
// Copy pads
@ -338,8 +355,11 @@ void FOOTPRINT::Serialize( google::protobuf::Any &aContainer ) const
for( PCB_LAYER_ID layer : GetPrivateLayers().Seq() )
def->add_private_layers( ToProtoEnum<PCB_LAYER_ID, types::BoardLayer>( layer ) );
for( const PCB_FIELD* item : Fields() )
for( const PCB_FIELD* item : m_fields )
{
if( !item )
continue;
if( item->GetId() < MANDATORY_FIELDS )
continue;
@ -494,9 +514,9 @@ bool FOOTPRINT::Deserialize( const google::protobuf::Any &aContainer )
SetPrivateLayers( privateLayers );
// Footprint items
for( PCB_FIELD* field : Fields() )
for( PCB_FIELD* field : m_fields )
{
if( field->GetId() >= MANDATORY_FIELDS )
if( field && field->GetId() >= MANDATORY_FIELDS )
Remove( field );
}
@ -554,12 +574,18 @@ bool FOOTPRINT::Deserialize( const google::protobuf::Any &aContainer )
PCB_FIELD* FOOTPRINT::GetField( MANDATORY_FIELD_T aFieldType )
{
PCB_FIELD* field = m_fields[aFieldType];
wxASSERT_MSG( field, wxT( "Requesting a null field (likely FOOTPRINT)" ) );
return m_fields[aFieldType];
}
const PCB_FIELD* FOOTPRINT::GetField( MANDATORY_FIELD_T aFieldType ) const
{
const PCB_FIELD* field = m_fields[aFieldType];
wxASSERT_MSG( field, wxT( "Requesting a null field (likely FOOTPRINT)" ) );
return m_fields[aFieldType];
}
@ -568,7 +594,7 @@ PCB_FIELD* FOOTPRINT::GetFieldById( int aFieldId )
{
for( PCB_FIELD* field : m_fields )
{
if( field->GetId() == aFieldId )
if( field && field->GetId() == aFieldId )
return field;
}
@ -579,7 +605,7 @@ bool FOOTPRINT::HasFieldByName( const wxString& aFieldName ) const
{
for( PCB_FIELD* field : m_fields )
{
if( field->GetCanonicalName() == aFieldName )
if( field && field->GetCanonicalName() == aFieldName )
return true;
}
@ -593,7 +619,7 @@ PCB_FIELD* FOOTPRINT::GetFieldByName( const wxString& aFieldName )
for( PCB_FIELD* field : m_fields )
{
if( field->GetName() == aFieldName )
if( field && field->GetName() == aFieldName )
return field;
}
@ -605,7 +631,7 @@ wxString FOOTPRINT::GetFieldText( const wxString& aFieldName ) const
{
for( const PCB_FIELD* field : m_fields )
{
if( aFieldName == field->GetName() || aFieldName == field->GetCanonicalName() )
if( field && ( aFieldName == field->GetName() || aFieldName == field->GetCanonicalName() ) )
return field->GetText();
}
@ -613,14 +639,16 @@ wxString FOOTPRINT::GetFieldText( const wxString& aFieldName ) const
}
void FOOTPRINT::GetFields( std::vector<PCB_FIELD*>& aVector, bool aVisibleOnly )
std::vector<PCB_FIELD*> FOOTPRINT::GetFields( bool aVisibleOnly ) const
{
std::vector<PCB_FIELD*> fields;
for( PCB_FIELD* field : m_fields )
{
// FOOTPRINT field doesn't exist on FOOTPRINT, but it's kept in the m_fields vector
// for the moment so that the MANDATORY_FIELD ids line up with vector indices.
// This could be cleaned up by making m_fields a map in the future.
if( field->GetId() == FOOTPRINT_FIELD )
if( !field || field->GetId() == FOOTPRINT_FIELD )
continue;
if( aVisibleOnly )
@ -629,8 +657,16 @@ void FOOTPRINT::GetFields( std::vector<PCB_FIELD*>& aVector, bool aVisibleOnly )
continue;
}
aVector.push_back( field );
fields.push_back( field );
}
return fields;
}
void FOOTPRINT::GetFields( std::vector<PCB_FIELD*>& aVector, bool aVisibleOnly ) const
{
aVector = GetFields( aVisibleOnly );
}
@ -662,7 +698,10 @@ void FOOTPRINT::ApplyDefaultSettings( const BOARD& board, bool aStyleFields, boo
if( aStyleFields )
{
for( PCB_FIELD* field : m_fields )
field->StyleFromSettings( board.GetDesignSettings() );
{
if( field )
field->StyleFromSettings( board.GetDesignSettings() );
}
}
for( BOARD_ITEM* item : m_drawings )
@ -695,7 +734,10 @@ bool FOOTPRINT::FixUuids()
std::vector< BOARD_ITEM* > item_list;
for( PCB_FIELD* field : m_fields )
item_list.push_back( field );
{
if( field )
item_list.push_back( field );
}
for( PAD* pad : m_pads )
item_list.push_back( pad );
@ -759,8 +801,13 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther )
// Move the fields
m_fields.clear();
for( PCB_FIELD* field : aOther.Fields() )
Add( field );
for( PCB_FIELD* field : aOther.m_fields )
{
if( field )
Add( field );
else
m_fields.push_back( nullptr );
}
// Move the pads
m_pads.clear();
@ -811,7 +858,7 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther )
m_initial_comments = aOther.m_initial_comments;
// Clear the other item's containers since this is a move
aOther.Fields().clear();
aOther.m_fields.clear();
aOther.Pads().clear();
aOther.Zones().clear();
aOther.GraphicalItems().clear();
@ -855,11 +902,18 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
// Copy fields
m_fields.clear();
for( PCB_FIELD* field : aOther.GetFields() )
for( PCB_FIELD* field : aOther.m_fields )
{
PCB_FIELD* newField = new PCB_FIELD( *field );
ptrMap[field] = newField;
Add( newField );
if( field )
{
PCB_FIELD* newField = new PCB_FIELD( *field );
ptrMap[field] = newField;
Add( newField );
}
else
{
m_fields.push_back( nullptr );
}
}
// Copy pads
@ -1362,7 +1416,7 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText ) const
for( PCB_FIELD* field : m_fields )
{
// Reference and value get their own processing
if( !field->IsReference() && !field->IsValue() )
if( field && !field->IsReference() && !field->IsValue() )
texts.push_back( field );
}
@ -1703,7 +1757,7 @@ bool FOOTPRINT::IsOnLayer( PCB_LAYER_ID aLayer ) const
for( PCB_FIELD* field : m_fields )
{
if( field->IsOnLayer( aLayer ) )
if( field && field->IsOnLayer( aLayer ) )
return true;
}
@ -2083,7 +2137,10 @@ void FOOTPRINT::RunOnChildren( const std::function<void ( BOARD_ITEM* )>& aFunct
try
{
for( PCB_FIELD* field : m_fields )
aFunction( field );
{
if( field )
aFunction( field );
}
for( PAD* pad : m_pads )
aFunction( pad );
@ -2114,7 +2171,10 @@ void FOOTPRINT::RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFun
try
{
for( PCB_FIELD* field : m_fields )
aFunction( field );
{
if( field )
aFunction( field );
}
for( PAD* pad : m_pads )
aFunction( pad );
@ -2304,7 +2364,10 @@ void FOOTPRINT::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
SetOrientation( newOrientation );
for( PCB_FIELD* field : m_fields )
field->KeepUpright();
{
if( field )
field->KeepUpright();
}
for( BOARD_ITEM* item : m_drawings )
{
@ -2355,7 +2418,10 @@ void FOOTPRINT::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
// Mirror fields to other side of board.
for( PCB_FIELD* field : m_fields )
field->Flip( m_pos, FLIP_DIRECTION::TOP_BOTTOM );
{
if( field )
field->Flip( m_pos, FLIP_DIRECTION::TOP_BOTTOM );
}
// Mirror pads to other side of board.
for( PAD* pad : m_pads )
@ -2392,7 +2458,10 @@ void FOOTPRINT::SetPosition( const VECTOR2I& aPos )
m_pos += delta;
for( PCB_FIELD* field : m_fields )
field->EDA_TEXT::Offset( delta );
{
if( field )
field->EDA_TEXT::Offset( delta );
}
for( PAD* pad : m_pads )
pad->SetPosition( pad->GetPosition() + delta );
@ -2428,7 +2497,10 @@ void FOOTPRINT::MoveAnchorPosition( const VECTOR2I& aMoveVector )
// Update field local coordinates
for( PCB_FIELD* field : m_fields )
field->Move( moveVector );
{
if( field )
field->Move( moveVector );
}
// Update the pad local coordinates.
for( PAD* pad : m_pads )
@ -2463,7 +2535,10 @@ void FOOTPRINT::SetOrientation( const EDA_ANGLE& aNewAngle )
m_orient.Normalize180();
for( PCB_FIELD* field : m_fields )
field->Rotate( GetPosition(), angleChange );
{
if( field )
field->Rotate( GetPosition(), angleChange );
}
for( PAD* pad : m_pads )
pad->Rotate( GetPosition(), angleChange );
@ -3305,7 +3380,7 @@ void FOOTPRINT::CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
for( PCB_FIELD* field : m_fields )
{
if( field->IsOnCopperLayer() )
if( field && field->IsOnCopperLayer() )
copperItems.push_back( field );
}
@ -3485,8 +3560,11 @@ bool FOOTPRINT::operator==( const FOOTPRINT& aOther ) const
for( size_t ii = 0; ii < m_fields.size(); ++ii )
{
if( !( *m_fields[ii] == *aOther.m_fields[ii] ) )
return false;
if( m_fields[ii] )
{
if( !( *m_fields[ii] == *aOther.m_fields[ii] ) )
return false;
}
}
return true;
@ -3860,7 +3938,7 @@ void FOOTPRINT::TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_I
{
for( const PCB_FIELD* field : m_fields )
{
if( field->GetLayer() == aLayer && field->IsVisible() )
if( field && field->GetLayer() == aLayer && field->IsVisible() )
texts.push_back( field );
}
}

View File

@ -195,13 +195,7 @@ public:
*/
const BOX2I GetLayerBoundingBox( LSET aLayers ) const;
VECTOR2I GetCenter() const override
{
return GetBoundingBox( false ).GetCenter();
}
PCB_FIELDS& Fields() { return m_fields; }
const PCB_FIELDS& Fields() const { return m_fields; }
VECTOR2I GetCenter() const override { return GetBoundingBox( false ).GetCenter(); }
std::deque<PAD*>& Pads() { return m_pads; }
const std::deque<PAD*>& Pads() const { return m_pads; }
@ -708,13 +702,19 @@ public:
* @param aVector is the vector to populate.
* @param aVisibleOnly is used to add only the fields that are visible and contain text.
*/
void GetFields( std::vector<PCB_FIELD*>& aVector, bool aVisibleOnly );
void GetFields( std::vector<PCB_FIELD*>& aVector, bool aVisibleOnly ) const;
/**
* Return a vector of fields from the symbol
*
* @param aVisibleOnly is used to add only the fields that are visible and contain text.
*/
PCB_FIELDS GetFields() { return m_fields; }
const PCB_FIELDS& GetFields() const { return m_fields; }
std::vector<PCB_FIELD*> GetFields( bool aVisibleOnly = false ) const;
/**
* Clears all fields from the footprint
*/
void ClearFields() { m_fields.clear(); }
/**
* Add a field to the symbol.
@ -733,9 +733,9 @@ public:
void RemoveField( const wxString& aFieldName );
/**
* Return the number of fields in this symbol.
* Return the next ID for a field for this footprint
*/
int GetFieldCount() const { return (int) m_fields.size(); }
int GetNextFieldId() const { return m_fields.size(); }
/**
* @brief Apply default board settings to the footprint field text properties.

View File

@ -410,7 +410,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( copy ) )
{
if( field->IsMandatoryField() )
field->SetId( footprint->GetFieldCount() );
field->SetId( footprint->GetNextFieldId() );
}
copy = footprint;

View File

@ -526,7 +526,7 @@ bool BOARD_NETLIST_UPDATER::updateFootprintParameters( FOOTPRINT* aPcbFootprint,
}
else
{
int idx = aPcbFootprint->GetFieldCount();
int idx = aPcbFootprint->GetNextFieldId();
PCB_FIELD* newField = aPcbFootprint->AddField( PCB_FIELD( aPcbFootprint, idx ) );
newField->SetName( name );

View File

@ -769,7 +769,7 @@ FOOTPRINT* ALTIUM_PCB::ParseFootprint( ALTIUM_PCB_COMPOUND_FILE& altiumLibFile,
const VECTOR2I defaultTextSize( pcbIUScale.mmToIU( 1.0 ), pcbIUScale.mmToIU( 1.0 ) );
const int defaultTextThickness( pcbIUScale.mmToIU( 0.15 ) );
for( PCB_FIELD* field : footprint->Fields() )
for( PCB_FIELD* field : footprint->GetFields() )
{
field->SetTextSize( defaultTextSize );
field->SetTextThickness( defaultTextThickness );

View File

@ -650,7 +650,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(
if( euuid )
{
PCB_FIELD field( footprint, footprint->GetFieldCount(),
PCB_FIELD field( footprint, footprint->GetNextFieldId(),
DIRECT_MODEL_UUID_KEY );
field.SetLayer( Cmts_User );
field.SetVisible( false );
@ -676,7 +676,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(
fitXmm = KiROUND( fitXmm / rounding ) * rounding;
fitYmm = KiROUND( fitYmm / rounding ) * rounding;
PCB_FIELD field( footprint, footprint->GetFieldCount(), MODEL_SIZE_KEY );
PCB_FIELD field( footprint, footprint->GetNextFieldId(), MODEL_SIZE_KEY );
field.SetLayer( Cmts_User );
field.SetVisible( false );
field.SetText( wxString::FromCDouble( fitXmm ) + wxS( " " )

View File

@ -213,7 +213,7 @@ void PCB_IO_EASYEDAPRO_PARSER::fillFootprintModelInfo( FOOTPRINT* footprint, con
if( !modelUuid.IsEmpty() && !footprint->GetFieldByName( QUERY_MODEL_UUID_KEY ) )
{
PCB_FIELD field( footprint, footprint->GetFieldCount(), QUERY_MODEL_UUID_KEY );
PCB_FIELD field( footprint, footprint->GetNextFieldId(), QUERY_MODEL_UUID_KEY );
field.SetLayer( Cmts_User );
field.SetVisible( false );
field.SetText( modelUuid );
@ -229,7 +229,7 @@ void PCB_IO_EASYEDAPRO_PARSER::fillFootprintModelInfo( FOOTPRINT* footprint, con
if( fitXmm > 0.0 && fitYmm > 0.0 )
{
PCB_FIELD field( footprint, footprint->GetFieldCount(), MODEL_SIZE_KEY );
PCB_FIELD field( footprint, footprint->GetNextFieldId(), MODEL_SIZE_KEY );
field.SetLayer( Cmts_User );
field.SetVisible( false );
field.SetText( wxString::FromCDouble( fitXmm ) + wxS( " " )
@ -736,7 +736,7 @@ FOOTPRINT* PCB_IO_EASYEDAPRO_PARSER::ParseFootprint( const nlohmann::json&
const VECTOR2I defaultTextSize( pcbIUScale.mmToIU( 1.0 ), pcbIUScale.mmToIU( 1.0 ) );
const int defaultTextThickness( pcbIUScale.mmToIU( 0.15 ) );
for( PCB_FIELD* field : footprint->Fields() )
for( PCB_FIELD* field : footprint->GetFields() )
{
field->SetTextSize( defaultTextSize );
field->SetTextThickness( defaultTextThickness );

View File

@ -4533,7 +4533,8 @@ FOOTPRINT* PCB_IO_KICAD_SEXPR_PARSER::parseFOOTPRINT_unchecked( wxArrayString* a
// Use the text effect parsing function because it will handle ki_fp_filters as a property
// with no text effects, but will also handle parsing the text effects. We just drop the effects
// if they're present.
PCB_FIELD ignored = PCB_FIELD( footprint.get(), footprint->GetFieldCount(), pName );
PCB_FIELD ignored =
PCB_FIELD( footprint.get(), footprint->GetNextFieldId(), pName );
parsePCB_TEXT_effects( &ignored );
@ -4558,8 +4559,8 @@ FOOTPRINT* PCB_IO_KICAD_SEXPR_PARSER::parseFOOTPRINT_unchecked( wxArrayString* a
}
else
{
field = footprint->AddField( PCB_FIELD( footprint.get(), footprint->GetFieldCount(),
pName ) );
field = footprint->AddField(
PCB_FIELD( footprint.get(), footprint->GetNextFieldId(), pName ) );
field->SetText( pValue );
field->SetLayer( footprint->GetLayer() == F_Cu ? F_Fab : B_Fab );

View File

@ -61,7 +61,7 @@ ODB_COMPONENT& COMPONENTS_MANAGER::AddComponent( const FOOTPRINT* aFp,
comp.m_comp_name = wxString::Format( "UNNAMED%zu", m_compList.size() );
}
for( PCB_FIELD* field : aFp->Fields() )
for( PCB_FIELD* field : aFp->GetFields() )
{
if( field->GetId() == REFERENCE_FIELD )
continue;

View File

@ -111,10 +111,8 @@ void PlotInteractiveLayer( BOARD* aBoard, PLOTTER* aPlotter, const PCB_PLOT_PARA
_( "Footprint" ),
fp->GetFPID().GetUniStringLibItemName() ) );
for( int i = 0; i < fp->GetFieldCount(); i++ )
for( const PCB_FIELD* field : fp->GetFields() )
{
PCB_FIELD* field = fp->GetFields().at( i );
if( field->IsReference() || field->IsValue() )
continue;
@ -947,7 +945,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
// add shapes inflated by aMinThickness/2 in areas
footprint->TransformPadsToPolySet( areas, layer, inflate, maxError, ERROR_OUTSIDE );
for( const PCB_FIELD* field : footprint->Fields() )
for( const PCB_FIELD* field : footprint->GetFields() )
{
if( field->IsReference() && !itemplotter.GetPlotReference() )
continue;

View File

@ -384,7 +384,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
std::vector<PCB_TEXT*> texts;
// Skip the reference and value texts that are handled specially
for( PCB_FIELD* field : aFootprint->Fields() )
for( PCB_FIELD* field : aFootprint->GetFields() )
{
if( field->IsReference() || field->IsValue() )
continue;

View File

@ -1718,7 +1718,7 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld )
for( ZONE* zone : footprint->Zones() )
syncZone( aWorld, zone, boardOutline );
for( PCB_FIELD* field : footprint->Fields() )
for( PCB_FIELD* field : footprint->GetFields() )
syncTextItem( aWorld, static_cast<PCB_TEXT*>( field ), field->GetLayer() );
for( BOARD_ITEM* item : footprint->GraphicalItems() )

View File

@ -484,7 +484,7 @@ int BOARD_EDITOR_CONTROL::ExportNetlist( const TOOL_EVENT& aEvent )
nlohmann::ordered_map<wxString, wxString> fields;
for( PCB_FIELD* field : footprint->Fields() )
for( PCB_FIELD* field : footprint->GetFields() )
fields[field->GetCanonicalName()] = field->GetText();
component->SetFields( fields );

View File

@ -830,7 +830,7 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
VECTOR2I targetPos = refFP->GetPosition() + disp;
targetFP->SetPosition( targetPos );
for( PCB_FIELD* refField : refFP->Fields() )
for( PCB_FIELD* refField : refFP->GetFields() )
{
if( !refField->IsVisible() )
continue;

View File

@ -876,7 +876,7 @@ static void pasteFootprintItemsToFootprintEditor( FOOTPRINT* aClipFootprint, BOA
// Not all items can be added to the current footprint: mandatory fields are already existing
// in the current footprint.
//
for( PCB_FIELD* field : aClipFootprint->Fields() )
for( PCB_FIELD* field : aClipFootprint->GetFields() )
{
if( field->IsMandatoryField() )
{
@ -898,7 +898,7 @@ static void pasteFootprintItemsToFootprintEditor( FOOTPRINT* aClipFootprint, BOA
}
}
aClipFootprint->Fields().clear();
aClipFootprint->ClearFields();
for( BOARD_ITEM* item : aClipFootprint->GraphicalItems() )
{

View File

@ -174,7 +174,7 @@ int PCB_VIEWER_TOOLS::TextOutlines( const TOOL_EVENT& aEvent )
for( FOOTPRINT* fp : board()->Footprints() )
{
for( PCB_FIELD* field : fp->Fields() )
for( PCB_FIELD* field : fp->GetFields() )
{
view()->Update( field, KIGFX::REPAINT );
}

View File

@ -246,7 +246,7 @@ void CheckFootprint( const FOOTPRINT* expected, const FOOTPRINT* fp )
BOOST_CHECK_EQUAL( expected->GetTypeName(), fp->GetTypeName() );
// simple test if count matches
BOOST_CHECK_EQUAL( expected->Fields().size(), fp->Fields().size() );
BOOST_CHECK_EQUAL( expected->GetFields().size(), fp->GetFields().size() );
BOOST_CHECK_EQUAL( expected->Pads().size(), fp->Pads().size() );
BOOST_CHECK_EQUAL( expected->GraphicalItems().size(), fp->GraphicalItems().size() );
BOOST_CHECK_EQUAL( expected->Zones().size(), fp->Zones().size() );

View File

@ -77,7 +77,7 @@ public:
{
case PCB_FOOTPRINT_T: return new FOOTPRINT( &m_board );
case PCB_PAD_T: return new PAD( &m_footprint );
case PCB_FIELD_T: return new PCB_FIELD( &m_footprint, m_footprint.GetFieldCount() );
case PCB_FIELD_T: return new PCB_FIELD( &m_footprint, m_footprint.GetNextFieldId() );
case PCB_SHAPE_T: return new PCB_SHAPE( &m_board );
case PCB_TEXT_T: return new PCB_TEXT( &m_board );
case PCB_TEXTBOX_T: return new PCB_TEXTBOX( &m_board );