From 028f500cd9059e3d99567b582cfd76114f69ec94 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Tue, 2 May 2023 08:19:39 -0400 Subject: [PATCH] Footprints: rename properties to fields for consistency with symbols --- .../dialogs/dialog_footprint_properties_base.cpp | 2 +- .../dialogs/dialog_footprint_properties_base.fbp | 2 +- .../dialog_footprint_properties_fp_editor_base.cpp | 2 +- .../dialog_footprint_properties_fp_editor_base.fbp | 2 +- pcbnew/footprint.cpp | 12 ++++++------ pcbnew/footprint.h | 14 +++++++------- pcbnew/netlist_reader/board_netlist_updater.cpp | 4 ++-- pcbnew/netlist_reader/pcb_netlist.cpp | 2 +- pcbnew/pcb_edit_frame.cpp | 2 +- pcbnew/pcb_expr_functions.cpp | 4 ++-- pcbnew/plot_board_layers.cpp | 2 +- pcbnew/plugins/kicad/pcb_parser.cpp | 2 +- pcbnew/plugins/kicad/pcb_plugin.cpp | 2 +- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pcbnew/dialogs/dialog_footprint_properties_base.cpp b/pcbnew/dialogs/dialog_footprint_properties_base.cpp index 6d2d372ad1..4d6b2c6194 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_base.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_base.cpp @@ -25,7 +25,7 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa m_PanelPropertiesBoxSizer = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbSizerTexts; - sbSizerTexts = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, wxEmptyString ), wxVERTICAL ); + sbSizerTexts = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Fields") ), wxVERTICAL ); m_itemsGrid = new WX_GRID( sbSizerTexts->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 ); diff --git a/pcbnew/dialogs/dialog_footprint_properties_base.fbp b/pcbnew/dialogs/dialog_footprint_properties_base.fbp index 573fbf89b3..b89f727bf3 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_base.fbp +++ b/pcbnew/dialogs/dialog_footprint_properties_base.fbp @@ -187,7 +187,7 @@ 1 wxID_ANY - + Fields sbSizerTexts wxVERTICAL diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp index 0e483dc18c..573b4bcb0e 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp @@ -25,7 +25,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO m_PanelPropertiesBoxSizer = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbSizerTexts; - sbSizerTexts = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, wxEmptyString ), wxVERTICAL ); + sbSizerTexts = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Fields") ), wxVERTICAL ); m_itemsGrid = new WX_GRID( sbSizerTexts->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 ); diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp index 080323ec10..713895f69c 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp @@ -186,7 +186,7 @@ 1 wxID_ANY - + Fields sbSizerTexts wxVERTICAL diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 4c6a9fc636..c4d79b43b4 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -180,7 +180,7 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) : m_3D_Drawings = aFootprint.m_3D_Drawings; m_doc = aFootprint.m_doc; m_keywords = aFootprint.m_keywords; - m_properties = aFootprint.m_properties; + m_fields = aFootprint.m_fields; m_privateLayers = aFootprint.m_privateLayers; m_arflag = 0; @@ -354,7 +354,7 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther ) m_3D_Drawings = aOther.m_3D_Drawings; m_doc = aOther.m_doc; m_keywords = aOther.m_keywords; - m_properties = aOther.m_properties; + m_fields = aOther.m_fields; m_privateLayers = aOther.m_privateLayers; m_initial_comments = aOther.m_initial_comments; @@ -462,7 +462,7 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther ) m_3D_Drawings = aOther.m_3D_Drawings; m_doc = aOther.m_doc; m_keywords = aOther.m_keywords; - m_properties = aOther.m_properties; + m_fields = aOther.m_fields; m_privateLayers = aOther.m_privateLayers; m_initial_comments = aOther.m_initial_comments ? @@ -543,9 +543,9 @@ bool FOOTPRINT::ResolveTextVar( wxString* token, int aDepth ) const } } } - else if( m_properties.count( *token ) ) + else if( m_fields.count( *token ) ) { - *token = m_properties.at( *token ); + *token = m_fields.at( *token ); return true; } @@ -2811,7 +2811,7 @@ static struct FOOTPRINT_DESC &FOOTPRINT::SetOrientationDegrees, &FOOTPRINT::GetOrientationDegrees, PROPERTY_DISPLAY::PT_DEGREE ) ); - const wxString groupFootprint = _HKI( "Footprint Properties" ); + const wxString groupFootprint = _HKI( "Fields" ); propMgr.AddProperty( new PROPERTY( _HKI( "Reference" ), &FOOTPRINT::SetReference, &FOOTPRINT::GetReferenceAsString ), diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index a7cb6e3fa1..155fac64db 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -573,14 +573,14 @@ public: PCB_TEXT& Value() const { return *m_value; } PCB_TEXT& Reference() const { return *m_reference; } - const std::map& GetProperties() const { return m_properties; } - void SetProperties( const std::map& aProps ) { m_properties = aProps; } - const wxString& GetProperty( const wxString& aKey) { return m_properties[ aKey ]; } - bool HasProperty( const wxString& aKey) + const std::map& GetFields() const { return m_fields; } + void SetFields( const std::map& aFields ) { m_fields = aFields; } + const wxString& GetField( const wxString& aKey) { return m_fields[ aKey ]; } + bool HasField( const wxString& aKey) { - return m_properties.find( aKey ) != m_properties.end(); + return m_fields.find( aKey ) != m_fields.end(); } - void SetProperty( const wxString& aKey, const wxString& aVal ) { m_properties[ aKey ] = aVal; } + void SetField( const wxString& aKey, const wxString& aVal ) { m_fields[ aKey ] = aVal; } bool IsBoardOnly() const { return m_attributes & FP_BOARD_ONLY; } void SetBoardOnly( bool aIsBoardOnly = true ) @@ -888,7 +888,7 @@ private: LSET m_privateLayers; // Layers visible only in the footprint editor std::vector m_3D_Drawings; // 3D models. - std::map m_properties; + std::map m_fields; wxArrayString* m_initial_comments; // s-expression comments in the footprint, // lazily allocated only if needed for speed diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index ee27d08118..21019e7698 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -343,7 +343,7 @@ bool BOARD_NETLIST_UPDATER::updateFootprintParameters( FOOTPRINT* aPcbFootprint, m_reporter->Report( msg, RPT_SEVERITY_ACTION ); } - if( aPcbFootprint->GetProperties() != aNetlistComponent->GetProperties() ) + if( aPcbFootprint->GetFields() != aNetlistComponent->GetProperties() ) { if( m_isDryRun ) { @@ -356,7 +356,7 @@ bool BOARD_NETLIST_UPDATER::updateFootprintParameters( FOOTPRINT* aPcbFootprint, aPcbFootprint->GetReference() ); changed = true; - aPcbFootprint->SetProperties( aNetlistComponent->GetProperties() ); + aPcbFootprint->SetFields( aNetlistComponent->GetProperties() ); } m_reporter->Report( msg, RPT_SEVERITY_ACTION ); diff --git a/pcbnew/netlist_reader/pcb_netlist.cpp b/pcbnew/netlist_reader/pcb_netlist.cpp index e4402be80e..b25b3e1847 100644 --- a/pcbnew/netlist_reader/pcb_netlist.cpp +++ b/pcbnew/netlist_reader/pcb_netlist.cpp @@ -52,7 +52,7 @@ void COMPONENT::SetFootprint( FOOTPRINT* aFootprint ) aFootprint->SetValue( m_value ); aFootprint->SetFPID( m_fpid ); aFootprint->SetPath( path ); - aFootprint->SetProperties( m_properties ); + aFootprint->SetFields( m_properties ); } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 3c359a7aa9..bb22880b40 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -2309,7 +2309,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, // Updating other parameters const_cast( aNew->m_Uuid ) = aExisting->m_Uuid; - aNew->SetProperties( aExisting->GetProperties() ); + aNew->SetFields( aExisting->GetFields() ); aNew->SetPath( aExisting->GetPath() ); aCommit.Remove( aExisting ); diff --git a/pcbnew/pcb_expr_functions.cpp b/pcbnew/pcb_expr_functions.cpp index acb695bca8..23e6fcee6f 100644 --- a/pcbnew/pcb_expr_functions.cpp +++ b/pcbnew/pcb_expr_functions.cpp @@ -993,8 +993,8 @@ static void getFieldFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { FOOTPRINT* fp = static_cast( item ); - if( fp->HasProperty( arg->AsString() ) ) - return fp->GetProperty( arg->AsString() ); + if( fp->HasField( arg->AsString() ) ) + return fp->GetField( arg->AsString() ); } return ""; diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index efc72ef80b..aefc94ecff 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -95,7 +95,7 @@ void PlotInteractiveLayer( BOARD* aBoard, PLOTTER* aPlotter, const PCB_PLOT_PARA _( "Value" ), fp->Value().GetShownText( false ) ) ); - for( const auto& [ name, value ] : fp->GetProperties() ) + for( const auto& [name, value] : fp->GetFields() ) properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), name, value ) ); properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 79b6e0f6dc..6f606ea3b8 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -4067,7 +4067,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments footprint->SetAttributes( attributes ); footprint->SetFPID( fpid ); - footprint->SetProperties( properties ); + footprint->SetFields( properties ); return footprint.release(); } diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index 65df243491..0d7163adb2 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -1118,7 +1118,7 @@ void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const m_out->Quotew( aFootprint->GetKeywords() ).c_str() ); } - const std::map& props = aFootprint->GetProperties(); + const std::map& props = aFootprint->GetFields(); for( const std::pair& prop : props ) {