Some fixes related to translated/not translated mandatory field names.
DIALOG_SYMBOL_FIELDS_TABLE: add new fields to symbols only if the field is not empty.
(cherry picked from commit 45b167dff5
)
This commit is contained in:
parent
f663b42d77
commit
46b3188737
|
@ -53,8 +53,6 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
|
||||||
{
|
{
|
||||||
wxASSERT( aTextItem );
|
wxASSERT( aTextItem );
|
||||||
|
|
||||||
SetTitle( aTitle );
|
|
||||||
|
|
||||||
m_note->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
m_note->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||||
m_note->Show( false );
|
m_note->Show( false );
|
||||||
|
|
||||||
|
@ -348,7 +346,14 @@ DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen
|
||||||
|
|
||||||
m_isPower = false;
|
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();
|
m_position = m_field->GetPosition();
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ public:
|
||||||
// FIX ME: the column label should be displayed translated.
|
// FIX ME: the column label should be displayed translated.
|
||||||
// but when translated, and the DATASHEET column is shown, a new field
|
// but when translated, and the DATASHEET column is shown, a new field
|
||||||
// with the translated DATASHEET field name is added when saving fields
|
// 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 );
|
return TEMPLATE_FIELDNAME::GetDefaultFieldName( aCol );
|
||||||
else
|
else
|
||||||
return m_fieldNames[ aCol ];
|
return m_fieldNames[ aCol ];
|
||||||
|
@ -619,19 +619,21 @@ public:
|
||||||
const wxString& srcValue = srcData.second;
|
const wxString& srcValue = srcData.second;
|
||||||
SCH_FIELD* destField = symbol.FindField( srcName );
|
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();
|
const wxPoint symbolPos = symbol.GetPosition();
|
||||||
destField = symbol.AddField( SCH_FIELD( symbolPos, -1, &symbol, srcName ) );
|
destField = symbol.AddField( SCH_FIELD( symbolPos, -1, &symbol, srcName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !destField )
|
if( !destField )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( destField->GetId() == REFERENCE_FIELD )
|
||||||
{
|
{
|
||||||
symbol.RemoveField( srcName );
|
// Reference is not editable from this dialog
|
||||||
}
|
|
||||||
else if( destField->GetId() == REFERENCE_FIELD )
|
|
||||||
{
|
|
||||||
// Reference is not editable
|
|
||||||
}
|
}
|
||||||
else if( destField->GetId() == VALUE_FIELD )
|
else if( destField->GetId() == VALUE_FIELD )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Oliver Walters
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -74,6 +74,8 @@ private:
|
||||||
|
|
||||||
SCH_REFERENCE_LIST m_symbolsList;
|
SCH_REFERENCE_LIST m_symbolsList;
|
||||||
FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
|
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 */
|
#endif /* DIALOG_SYMBOL_FIELDS_TABLE_H */
|
||||||
|
|
|
@ -1122,7 +1122,11 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
|
||||||
|
|
||||||
// Use title caps for mandatory fields. "Edit Sheet name Field" looks dorky.
|
// Use title caps for mandatory fields. "Edit Sheet name Field" looks dorky.
|
||||||
if( parentType == SCH_SYMBOL_T && aField->GetId() < MANDATORY_FIELDS )
|
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 )
|
else if( parentType == SCH_SHEET_T && aField->GetId() < SHEET_MANDATORY_FIELDS )
|
||||||
caption.Printf( _( "Edit %s Field" ), TitleCaps( aField->GetName() ) );
|
caption.Printf( _( "Edit %s Field" ), TitleCaps( aField->GetName() ) );
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue