diff --git a/eeschema/dialogs/dialog_field_properties.cpp b/eeschema/dialogs/dialog_field_properties.cpp index a55a4438df..39fe2676c0 100644 --- a/eeschema/dialogs/dialog_field_properties.cpp +++ b/eeschema/dialogs/dialog_field_properties.cpp @@ -53,8 +53,6 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const { wxASSERT( aTextItem ); - SetTitle( aTitle ); - m_note->SetFont( KIUI::GetInfoFont( this ).Italic() ); m_note->Show( false ); @@ -348,7 +346,14 @@ DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen m_isPower = false; - m_textLabel->SetLabel( m_field->GetName() + wxT( ":" ) ); + wxString translated_fieldname; + + if( m_field->GetId() < MANDATORY_FIELDS ) + translated_fieldname = TEMPLATE_FIELDNAME::GetDefaultFieldName( m_field->GetId(), DO_TRANSLATE ); + else + translated_fieldname = m_field->GetName(); + + m_textLabel->SetLabel( translated_fieldname + ":" ); m_position = m_field->GetPosition(); diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index d0784cc19d..1991fd533a 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -236,7 +236,7 @@ public: // FIX ME: the column label should be displayed translated. // but when translated, and the DATASHEET column is shown, a new field // with the translated DATASHEET field name is added when saving fields - // return TEMPLATE_FIELDNAME::GetDefaultFieldName( aCol DO_TRANSLATE ); + // return TEMPLATE_FIELDNAME::GetDefaultFieldName( aCol, DO_TRANSLATE ); return TEMPLATE_FIELDNAME::GetDefaultFieldName( aCol ); else return m_fieldNames[ aCol ]; @@ -619,19 +619,21 @@ public: const wxString& srcValue = srcData.second; SCH_FIELD* destField = symbol.FindField( srcName ); - if( !destField && !srcValue.IsEmpty() ) + // Add a not existing field if it has a value for this symbol + bool createField = !destField && !srcValue.IsEmpty(); + + if( createField ) { const wxPoint symbolPos = symbol.GetPosition(); destField = symbol.AddField( SCH_FIELD( symbolPos, -1, &symbol, srcName ) ); } if( !destField ) + continue; + + if( destField->GetId() == REFERENCE_FIELD ) { - symbol.RemoveField( srcName ); - } - else if( destField->GetId() == REFERENCE_FIELD ) - { - // Reference is not editable + // Reference is not editable from this dialog } else if( destField->GetId() == VALUE_FIELD ) { diff --git a/eeschema/dialogs/dialog_symbol_fields_table.h b/eeschema/dialogs/dialog_symbol_fields_table.h index 403c7429d7..461b238796 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.h +++ b/eeschema/dialogs/dialog_symbol_fields_table.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 Oliver Walters - * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -74,6 +74,8 @@ private: SCH_REFERENCE_LIST m_symbolsList; FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel; + static int m_newFieldsOption; // Store the option choice for new fields + // during a session: }; #endif /* DIALOG_SYMBOL_FIELDS_TABLE_H */ diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index bf90a7d0ea..12adf227a4 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -1122,7 +1122,11 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField ) // Use title caps for mandatory fields. "Edit Sheet name Field" looks dorky. if( parentType == SCH_SYMBOL_T && aField->GetId() < MANDATORY_FIELDS ) - caption.Printf( _( "Edit %s Field" ), TitleCaps( aField->GetName() ) ); + { + wxString translated_fieldname; + translated_fieldname = TEMPLATE_FIELDNAME::GetDefaultFieldName( aField->GetId(), DO_TRANSLATE ); + caption.Printf( _( "Edit %s Field" ), TitleCaps( translated_fieldname ) ); + } else if( parentType == SCH_SHEET_T && aField->GetId() < SHEET_MANDATORY_FIELDS ) caption.Printf( _( "Edit %s Field" ), TitleCaps( aField->GetName() ) ); else