diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index 2ee8290dfe..15784d6cb3 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -209,8 +209,7 @@ public: for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i ) { SCH_SYMBOL* symbol = m_symbolsList[ i ].GetSymbol(); - m_dataStore[ symbol->m_Uuid ][ aFieldName ] = symbol->GetFieldText( aFieldName, - m_frame ); + m_dataStore[ symbol->m_Uuid ][ aFieldName ] = symbol->GetFieldText( aFieldName ); } } diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index b50d4179e1..6d33cbd237 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -1117,10 +1117,10 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map& aProper switch( j - i ) { - case 0: bezier->SetStart( pos ); break; + case 0: bezier->SetStart( pos ); break; case 1: bezier->SetBezierC1( pos ); break; case 2: bezier->SetBezierC2( pos ); break; - case 3: bezier->SetEnd( pos ); break; + case 3: bezier->SetEnd( pos ); break; default: break; // Can't get here but silence warnings } } @@ -2342,16 +2342,30 @@ void SCH_ALTIUM_PLUGIN::ParseParameter( const std::map& aPro SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first ); SCH_FIELD* field = nullptr; + wxString upperName = elem.name.Upper(); - if( elem.name.Upper() == "COMMENT" ) + if( upperName == "COMMENT" ) + { field = symbol->GetField( VALUE_FIELD ); + } else { int fieldIdx = symbol->GetFieldCount(); wxString fieldName = elem.name.Upper(); - if( fieldName == "VALUE" ) + if( fieldName.IsEmpty() ) + { + int disambiguate = 1; + + do + { + fieldName = wxString::Format( "ALTIUM_UNNAMED_%d", disambiguate++ ); + } while( !symbol->GetFieldText( fieldName ).IsEmpty() ); + } + else if( fieldName == "VALUE" ) + { fieldName = "ALTIUM_VALUE"; + } field = symbol->AddField( SCH_FIELD( VECTOR2I(), fieldIdx, symbol, fieldName ) ); } diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index e85ca94563..83e8b36e75 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -708,7 +708,7 @@ SCH_FIELD* SCH_SYMBOL::GetFieldById( int aFieldId ) } -wxString SCH_SYMBOL::GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const +wxString SCH_SYMBOL::GetFieldText( const wxString& aFieldName ) const { for( const SCH_FIELD& field : m_fields ) { diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index 97c3f400ef..8294115c0a 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -353,7 +353,7 @@ public: * * @param aFieldName is the name of the field */ - wxString GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const; + wxString GetFieldText( const wxString& aFieldName ) const; /** * Populate a std::vector with SCH_FIELDs.